退出接口修改-查询用户详情添加管理员的角色名

develop
guyuliang 2024-08-23 14:53:28 +08:00
parent 38574a6172
commit bcd5859129
1 changed files with 15 additions and 3 deletions

View File

@ -769,15 +769,27 @@ public class UserServiceImpl implements UserService {
}
}
user.setProjectIds(projectIds);
List<String> roleNames = new ArrayList<>();
List<Role> roles = roleRepository.listByUser(user.getId());
if (!roles.isEmpty()) {
List<String> roleNames = new ArrayList<>();
for (Role role : roles) {
roleNames.add(role.getName());
}
}
//给用户设置管理端的角色名
List<Role> 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());