Skip to content

Commit

Permalink
fix(锁定): 用户管理
Browse files Browse the repository at this point in the history
bug: 用户管理列表页切换状态不生效

Closes IAJID5
  • Loading branch information
lltx committed Aug 13, 2024
1 parent 56634d5 commit 128abd4
Showing 1 changed file with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,22 +227,27 @@ public Boolean updateUser(UserDTO userDto) {
this.updateById(sysUser);

// 更新用户角色表
sysUserRoleMapper.delete(Wrappers.<SysUserRole>lambdaQuery().eq(SysUserRole::getUserId, userDto.getUserId()));
userDto.getRole().stream().map(roleId -> {
SysUserRole userRole = new SysUserRole();
userRole.setUserId(sysUser.getUserId());
userRole.setRoleId(roleId);
return userRole;
}).forEach(SysUserRole::insert);

// 更新用户岗位表
sysUserPostMapper.delete(Wrappers.<SysUserPost>lambdaQuery().eq(SysUserPost::getUserId, userDto.getUserId()));
userDto.getPost().stream().map(postId -> {
SysUserPost userPost = new SysUserPost();
userPost.setUserId(sysUser.getUserId());
userPost.setPostId(postId);
return userPost;
}).forEach(SysUserPost::insert);
if (Objects.nonNull(userDto.getRole())) {
// 删除用户角色关系
sysUserRoleMapper.delete(Wrappers.<SysUserRole>lambdaQuery().eq(SysUserRole::getUserId, userDto.getUserId()));
userDto.getRole().stream().map(roleId -> {
SysUserRole userRole = new SysUserRole();
userRole.setUserId(sysUser.getUserId());
userRole.setRoleId(roleId);
return userRole;
}).forEach(SysUserRole::insert);
}

if (Objects.nonNull(userDto.getPost())) {
// 删除用户岗位关系
sysUserPostMapper.delete(Wrappers.<SysUserPost>lambdaQuery().eq(SysUserPost::getUserId, userDto.getUserId()));
userDto.getPost().stream().map(postId -> {
SysUserPost userPost = new SysUserPost();
userPost.setUserId(sysUser.getUserId());
userPost.setPostId(postId);
return userPost;
}).forEach(SysUserPost::insert);
}
return Boolean.TRUE;
}

Expand Down

0 comments on commit 128abd4

Please sign in to comment.