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