退出接口修改-查询用户详情添加管理员的角色名
parent
38574a6172
commit
bcd5859129
|
@ -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());
|
||||
}
|
||||
// 给用户设置角色名
|
||||
user.setRoleNames(roleNames);
|
||||
}
|
||||
|
||||
//给用户设置管理端的角色名
|
||||
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());
|
||||
|
|
Loading…
Reference in New Issue