Jelajahi Sumber

初始化客户权限设置

qzyReal 3 tahun lalu
induk
melakukan
2307abb513

+ 3 - 1
sp-server/src/main/java/com/pj/constants/RoleEnum.java

@@ -24,7 +24,9 @@ public enum RoleEnum {
     PAY_ROLE("pay","业务支付",
             Arrays.asList(AuthConst.ADMIN_LIST,TbNotices.PERMISSION_CODE,TbNotices.PERMISSION_LIST,TbPassRecord.PERMISSION_CODE,TbPassRecord.PERMISSION_LIST,TbCostomer.PERMISSION_CODE,TbCostomer.PERMISSION_INFO,TbBusiness.PERMISSION_CODE,TbBusiness.PERMISSION_LIST,TbBusiness.PERMISSION_PAY)),
     ADMIN_ROLE("admin","管理员", Collections.emptyList()),
-    SUPER_ROLE("super","超级管理员", Collections.emptyList());
+    SUPER_ROLE("super","超级管理员", Collections.emptyList()),
+    COMMON_ROLE_PER("common","共同",Arrays.asList(TbPassRecord.PERMISSION_CODE,TbPassRecord.PERMISSION_LIST,TbNotices.PERMISSION_CODE,TbNotices.PERMISSION_LIST))
+    ;
     private String type;
     private String name;
     private List<String>perCode;

+ 2 - 0
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerService.java

@@ -56,6 +56,7 @@ public class TbCostomerService extends ServiceImpl<TbCostomerMapper, TbCostomer>
         t.setCreareTime(new Date()).setJudgeContent("平台创建,直接通过").setJudgeTime(new Date());
         this.save(t);
         List<RoleEnum> roleEnums = RoleEnum.getCustomerInitRoleList();
+        List<String>commonPer=RoleEnum.COMMON_ROLE_PER.getPerCode();
         roleEnums.forEach(roleEnum -> {
             SpRole spRole = new SpRole();
             spRole.setCustomerId(t.getId()).setInfo(roleEnum.getName())
@@ -63,6 +64,7 @@ public class TbCostomerService extends ServiceImpl<TbCostomerMapper, TbCostomer>
             spRoleMapper.add(spRole);
             long roleId = SP.publicMapper.getPrimarykey();
             spRolePermissionMapper.saveRolePer(roleId, roleEnum.getPerCode());
+            spRolePermissionMapper.saveRolePer(roleId,commonPer);
         });
         return 1;
     }