Explorar o código

权限搜索修改

wks %!s(int64=2) %!d(string=hai) anos
pai
achega
9e8084c18a

+ 0 - 21
src/main/java/com/ydtech/modules/admin/constants/RoleConstants.java

@@ -8,27 +8,6 @@ import lombok.Getter;
 @Getter
 public enum RoleConstants {
 
-//    R01("1", "超级管理员",""),
-//    R02("2", "初始用户权限",""),
-//    R17("17", "部长","42,22,19,17"),
-//    R18("18","门店长",""),
-//    R19("19","出单员",""),
-//    R20("20","代理人",""),
-//    R21("21","团队长",""),
-//    R22("22","后线人员",""),
-//    R23("23","运营总监",""),
-//    R24("24","系统管理员",""),
-//    R25("25","人员管理",""),
-//    R28("28","财务专员",""),
-//    R29("29","总公司最高管理权限",""),
-//    R30("30","核保部门",""),
-//    R31("31","总公司人事行政部",""),
-//    R32("32","财务部门",""),
-//    R38("38","运营管理权限",""),
-//    R39("39","测试角色",""),
-//    R40("40","cc",""),
-//    R42("42","机构管理员","42,22,19");
-
 
     R01("1","admin","15,16,17,18,22,23,24,25,28,29,30,31,32,38"),
     R02("2","初始用户","22"),

+ 12 - 3
src/main/java/com/ydtech/modules/admin/controller/SysRoleController.java

@@ -13,8 +13,11 @@ import com.ydtech.modules.admin.service.SysRoleService;
 import com.ydtech.modules.base.controller.BaseController;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.ObjectUtils;
 import org.springframework.web.bind.annotation.*;
 
+import java.lang.reflect.Array;
+import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -85,8 +88,14 @@ public class SysRoleController extends BaseController {
         LambdaQueryWrapper<SysRole> lqw = new LambdaQueryWrapper<>();
         //获取角色的配置信息
         RoleConstants roleConstants = RoleConstants.getRoleConstants(user.getRoleId());
-        if (!"".equals(roleConstants.getRoleIds())) {
-            lqw.in(SysRole::getId, roleConstants.getRoleIds().split(","));
+
+        if (!user.getId().equals("admin")) {
+            if(ObjectUtils.isEmpty(roleConstants)){
+                lqw.eq(SysRole::getId, RoleConstants.R22.getCode());
+            }else if (!"".equals(roleConstants.getRoleIds())) {
+                String[] split = roleConstants.getRoleIds().split(",");
+                lqw.in(SysRole::getId, Arrays.asList(split));
+            }
         }
 
         lqw.eq(SysRole::getDelFlag, "0");
@@ -105,7 +114,7 @@ public class SysRoleController extends BaseController {
     @PostMapping(value = "/saveRoleMenus")
     public HttpResult saveRoleMenus(@RequestBody List<SysRoleMenu> records) {
 
-        if (null == records || records.size() < 1) {
+        if (null == records || records.isEmpty()) {
             return HttpResult.error("参数空");
         }
         SysRole sysRole = sysRoleService.getById(records.get(0).getRoleId());