diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java index bdfe6c1..97dbbaa 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java @@ -459,47 +459,31 @@ public class AdminAuthServiceImpl implements AdminAuthService { AdminUserDO user = userService.getUser(loginUserId); RoleNameAndSelectTypeVO roleNameAndSelectTypeVO = new RoleNameAndSelectTypeVO(); if (user != null) { - if (user.getPostIds() != null) { - if (user.getPostIds().contains(1L) || user.getPostIds().contains(2L)) { - // 全部权限,不需要设置任何条件 - roleNameAndSelectTypeVO.setRoleName("director"); - } else if (user.getPostIds().contains(4L)) { - // 本部门权限 - roleNameAndSelectTypeVO.setRoleName("queue"); - roleNameAndSelectTypeVO.setValue(user.getDeptId()); - } else { - // 仅自己权限 - roleNameAndSelectTypeVO.setRoleName("self"); - roleNameAndSelectTypeVO.setValue(loginUserId); - roleNameAndSelectTypeVO.setDeptId(user.getDeptId()); - } - } else { - //如果岗位不存在查询角色 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(UserRoleDO::getUserId, loginUserId); - List userRoleDO = userRoleMapper.selectList(wrapper); - - if (userRoleDO == null) { - throw exception(ROLE_ERROR); - } - - List collect = userRoleDO.stream().map(item -> item.getRoleId()).collect(Collectors.toList()); - if (collect.contains(164l) || collect.contains(1l)) { - // 全部权限,不需要设置任何条件 - roleNameAndSelectTypeVO.setRoleName("director"); - } else if (collect.contains(163L)) { - // 本部门权限 - roleNameAndSelectTypeVO.setRoleName("queue"); - roleNameAndSelectTypeVO.setValue(user.getDeptId()); - } else { - // 仅自己权限 - roleNameAndSelectTypeVO.setRoleName("self"); - roleNameAndSelectTypeVO.setValue(loginUserId); - roleNameAndSelectTypeVO.setDeptId(user.getDeptId()); - - } + //如果岗位不存在查询角色 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(UserRoleDO::getUserId, loginUserId); + List userRoleDO = userRoleMapper.selectList(wrapper); + + if (userRoleDO == null) { + throw exception(ROLE_ERROR); + } + + List collect = userRoleDO.stream().map(item -> item.getRoleId()).collect(Collectors.toList()); + if (collect.contains(164l) || collect.contains(1l)) { + // 全部权限,不需要设置任何条件 + roleNameAndSelectTypeVO.setRoleName("director"); + } else if (collect.contains(163L)) { + // 本部门权限 + roleNameAndSelectTypeVO.setRoleName("queue"); + roleNameAndSelectTypeVO.setValue(user.getDeptId()); + } else { + // 仅自己权限 + roleNameAndSelectTypeVO.setRoleName("self"); + roleNameAndSelectTypeVO.setValue(loginUserId); + roleNameAndSelectTypeVO.setDeptId(user.getDeptId()); } + } else { throw exception(USER_NOT_EXISTS); }