From bcd5859129aa2e2b7e19eca0dab4c60624ae387b Mon Sep 17 00:00:00 2001 From: guyuliang Date: Fri, 23 Aug 2024 14:53:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E5=87=BA=E6=8E=A5=E5=8F=A3=E4=BF=AE?= =?UTF-8?q?=E6=94=B9-=E6=9F=A5=E8=AF=A2=E7=94=A8=E6=88=B7=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E6=B7=BB=E5=8A=A0=E7=AE=A1=E7=90=86=E5=91=98=E7=9A=84?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bocloud/sms/service/UserServiceImpl.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/bocloud.sms.service/src/main/java/com/bocloud/sms/service/UserServiceImpl.java b/bocloud.sms.service/src/main/java/com/bocloud/sms/service/UserServiceImpl.java index e55bb1a..8d235cd 100644 --- a/bocloud.sms.service/src/main/java/com/bocloud/sms/service/UserServiceImpl.java +++ b/bocloud.sms.service/src/main/java/com/bocloud/sms/service/UserServiceImpl.java @@ -769,15 +769,27 @@ public class UserServiceImpl implements UserService { } } user.setProjectIds(projectIds); + + List roleNames = new ArrayList<>(); List roles = roleRepository.listByUser(user.getId()); if (!roles.isEmpty()) { - List roleNames = new ArrayList<>(); for (Role role : roles) { roleNames.add(role.getName()); } - // 给用户设置角色名 - user.setRoleNames(roleNames); } + + //给用户设置管理端的角色名 + List managerRoles = roleRepository.listByManager(user.getId()); + if (!ListTool.isEmpty(roles)) { + for (Role role : managerRoles) { + if(!roleNames.contains(role.getName())){ + roleNames.add(role.getName()); + } + } + } + // 给用户设置角色名 + user.setRoleNames(roleNames); + Department department = departmentRepository.query(user.getDepartId()); if (department != null) { user.setDepartmentName(department.getName());