Parcourir la source

fix
权限问题

lifang il y a 3 mois
Parent
commit
01644b3f20

+ 5 - 0
tr-modules/tr-module-mobile/src/main/java/cn/tr/module/mobile/enums/MsgContentType.java

@@ -20,4 +20,9 @@ public interface MsgContentType {
      * 附件
      */
     String ATTACHMENT="attachment";
+
+    /**
+     * 视频
+     */
+    String Video="video";
 }

+ 0 - 2
tr-modules/tr-module-system/src/main/java/cn/tr/module/sys/oauth2/controller/CurrentUserController.java

@@ -57,7 +57,6 @@ public class CurrentUserController {
 
     @GetMapping("/listMenus-{portalId}")
     @ApiOperation("获得登录用户的菜单列表")
-//    @TenantIgnore
     public CommonResult<List<RouteItemVO>> getMenus(@PathVariable(value = "portalId",required = false) String portalId) {
         SaTokenUtils.getStpUtil().checkLogin();
         return CommonResult.success(TreeUtil.buildTree(currentUserService.currentUserMenus(portalId)));
@@ -65,7 +64,6 @@ public class CurrentUserController {
 
     @GetMapping("/listPortal")
     @ApiOperation("获取登录用户的门户列表")
-//    @TenantIgnore
     public CommonResult<List<SysUserPortalListDTO>> getPortals() {
         SaTokenUtils.getStpUtil().checkLogin();
         return CommonResult.success(currentUserService.currentUserPortals());

+ 21 - 0
tr-modules/tr-module-system/src/main/java/cn/tr/module/sys/tenant/po/SysInviteCodePO.java

@@ -0,0 +1,21 @@
+package cn.tr.module.sys.tenant.po;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.ToString;
+
+/**
+ * 患者信息实体
+ *
+ * @author lf
+ * @date  2025/06/09 15:58
+ **/
+@Data
+@TableName(value="sys_invite_code",autoResultMap = true)
+@ToString
+public class SysInviteCodePO {
+    @TableId
+    private String code;
+
+    private Boolean use;
+}

+ 26 - 0
tr-modules/tr-module-system/src/main/java/cn/tr/module/sys/tenant/repository/SysInviteCodeRepository.java

@@ -0,0 +1,26 @@
+package cn.tr.module.sys.tenant.repository;
+
+
+import cn.tr.module.sys.tenant.po.SysInviteCodePO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 诊室与医生绑定Mapper接口
+ *
+ * @author wangzl
+ * @date  2025/07/18 16:55
+ **/
+@Repository
+@Mapper
+public interface SysInviteCodeRepository extends BaseMapper<SysInviteCodePO> {
+    /**
+     * 随机查询一个邀请码
+     *
+     * @return 随机邀请码对象
+     */
+    @Select("SELECT * FROM sys_invite_code where use =0 ORDER BY RANDOM() LIMIT 1")
+    SysInviteCodePO selectRandomOne();
+}

+ 8 - 0
tr-modules/tr-module-system/src/main/java/cn/tr/module/sys/tenant/service/impl/SysTenantServiceImpl.java

@@ -15,7 +15,9 @@ import cn.tr.module.sys.tenant.dto.SysTenantAddDTO;
 import cn.tr.module.sys.tenant.dto.SysTenantCommonDTO;
 import cn.tr.module.sys.tenant.dto.SysTenantQueryDTO;
 import cn.tr.module.sys.tenant.mapper.SysTenantMapper;
+import cn.tr.module.sys.tenant.po.SysInviteCodePO;
 import cn.tr.module.sys.tenant.po.SysTenantPO;
+import cn.tr.module.sys.tenant.repository.SysInviteCodeRepository;
 import cn.tr.module.sys.tenant.repository.SysTenantRepository;
 import cn.tr.module.sys.tenant.service.ISysTenantPackageMenuService;
 import cn.tr.module.sys.tenant.service.ISysTenantService;
@@ -75,6 +77,8 @@ public class SysTenantServiceImpl implements ISysTenantService {
     @Lazy
     private ISysTenantPackageMenuService tenantPackageMenuService;
 
+    @Autowired
+    private SysInviteCodeRepository inviteCodeRepository;
 
     @Override
     @TenantIgnore
@@ -103,6 +107,10 @@ public class SysTenantServiceImpl implements ISysTenantService {
         validate();
         validateSource(source);
         SysTenantPO tenant = SysTenantMapper.INSTANCE.toPO(source);
+        SysInviteCodePO inviteCode=inviteCodeRepository.selectRandomOne();
+        tenant.setInviteCode(inviteCode.getCode());
+        inviteCode.setUse(Boolean.TRUE);
+        inviteCodeRepository.updateById(inviteCode);
         return tenantRepository.insert(tenant) != 0;
     }