Commit 60ddfd96 authored by suntao's avatar suntao

update user role

parent c945fd97
...@@ -284,13 +284,12 @@ public class UserServiceImpl implements UserService { ...@@ -284,13 +284,12 @@ public class UserServiceImpl implements UserService {
} }
Long roleId = userModelVo.getRoleId(); Long roleId = userModelVo.getRoleId();
Role role = null;
if (roleId != null) { if (roleId != null) {
if (!roleRepository.exists(roleId)) { if (!roleRepository.exists(roleId)) {
log.error("{},不存在对应的角色 roleId={}", LOG_PRE, roleId); log.error("{},不存在对应的角色 roleId={}", LOG_PRE, roleId);
return Result.buildFail("不存在对应的角色"); return Result.buildFail("不存在对应的角色");
} }
role = roleRepository.getOne(roleId); Role role = roleRepository.getOne(roleId);
if (roleId == 1L) { if (roleId == 1L) {
// 将普通用户设置成超级管理,需要级联设置用户级别 // 将普通用户设置成超级管理,需要级联设置用户级别
exist.setRank(UserRank.SUPER_ADMINISTRATOR); exist.setRank(UserRank.SUPER_ADMINISTRATOR);
...@@ -300,6 +299,7 @@ public class UserServiceImpl implements UserService { ...@@ -300,6 +299,7 @@ public class UserServiceImpl implements UserService {
exist.setRank(UserRank.OPERATOR); exist.setRank(UserRank.OPERATOR);
} }
} }
exist.setRoles(Collections.singletonList(role));
} }
Long channelId = exist.getChannelId(); Long channelId = exist.getChannelId();
...@@ -314,7 +314,6 @@ public class UserServiceImpl implements UserService { ...@@ -314,7 +314,6 @@ public class UserServiceImpl implements UserService {
exist.setChannelName(configuration.getChannelName()); exist.setChannelName(configuration.getChannelName());
} }
exist.setRoles(Collections.singletonList(role));
exist.setUpdateTime(new Date()); exist.setUpdateTime(new Date());
userRepository.save(exist); userRepository.save(exist);
return Result.buildSuccess(true); return Result.buildSuccess(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment