优化系统权限逻辑

This commit is contained in:
季圣华
2021-08-22 16:05:51 +08:00
parent 2a704dcdb5
commit b220608a69
7 changed files with 35 additions and 113 deletions

View File

@@ -40,20 +40,16 @@ public class RoleController {
HttpServletRequest request)throws Exception {
JSONArray arr = new JSONArray();
try {
//获取权限信息
String ubValue = userBusinessService.getUBValueByTypeAndKeyId(type, keyId);
List<Role> dataList = roleService.findUserRole();
if (null != dataList) {
for (Role role : dataList) {
JSONObject item = new JSONObject();
item.put("id", role.getId());
item.put("text", role.getName());
//勾选判断1
Boolean flag = false;
try {
flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + role.getId().toString() + "]");
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>>>>>设置用户对应的角色:类型" + type + " KeyId为 " + keyId + " 存在异常!");
}
if (flag == true) {
Boolean flag = ubValue.contains("[" + role.getId().toString() + "]");
if (flag) {
item.put("checked", true);
}
arr.add(item);
@@ -65,8 +61,8 @@ public class RoleController {
return arr;
}
@PostMapping(value = "/list")
public List<Role> list(HttpServletRequest request)throws Exception {
return roleService.getRole();
@GetMapping(value = "/allList")
public List<Role> allList(HttpServletRequest request)throws Exception {
return roleService.allList();
}
}