refactor(user): 优化用户角色分配逻辑

main
zhaokai 2026-03-19 09:48:59 +08:00
parent 48189e0d80
commit 6b6cc3eb4e
1 changed files with 2 additions and 1 deletions

View File

@ -425,6 +425,8 @@ public class UserUpdateExe {
userE = new UserE();
BeanUtils.copyProperties(userDO, userE);
userE.setEmploymentFlag(employmentFlag);
Long roleId = userRepository.getDefaultRoleId();
userE.setRoleId(roleId);
userGateway.update(userE);
// }
if (userE == null) {
@ -479,7 +481,6 @@ public class UserUpdateExe {
userAddCmd.setAccount(userDO.getPhone());
userAddCmd.setName(userDO.getPhone());
RoleDeptAddCmd roleDeptAddCmd = new RoleDeptAddCmd();
Long roleId = userRepository.getDefaultRoleId();
roleDeptAddCmd.setRoleId(roleId);
roleDeptAddCmd.setDeptId(userDO.getDepartmentId());
List<RoleDeptAddCmd> roleDeptAddCmdList = Collections.singletonList(roleDeptAddCmd);