fix(锁定): 用户管理

bug: 用户管理列表页切换状态不生效

Closes IAJID5
This commit is contained in:
冷冷 2024-08-13 09:27:47 +08:00
parent 6affe64e92
commit 779a0ccd39
2 changed files with 346 additions and 334 deletions

View File

@ -86,6 +86,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
/** /**
* 保存用户信息 * 保存用户信息
*
* @param userDto DTO 对象 * @param userDto DTO 对象
* @return success/fail * @return success/fail
*/ */
@ -130,6 +131,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
/** /**
* 通过查用户的全部信息 * 通过查用户的全部信息
*
* @param sysUser 用户 * @param sysUser 用户
* @return * @return
*/ */
@ -160,6 +162,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
/** /**
* 分页查询用户信息含有角色信息 * 分页查询用户信息含有角色信息
*
* @param page 分页对象 * @param page 分页对象
* @param userDTO 参数列表 * @param userDTO 参数列表
* @return * @return
@ -171,6 +174,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
/** /**
* 通过ID查询用户信息 * 通过ID查询用户信息
*
* @param id 用户ID * @param id 用户ID
* @return 用户信息 * @return 用户信息
*/ */
@ -181,6 +185,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
/** /**
* 删除用户 * 删除用户
*
* @param ids 用户ID 列表 * @param ids 用户ID 列表
* @return Boolean * @return Boolean
*/ */
@ -227,6 +232,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
this.updateById(sysUser); this.updateById(sysUser);
// 更新用户角色表 // 更新用户角色表
if (Objects.nonNull(userDto.getRole())) {
sysUserRoleMapper.delete(Wrappers.<SysUserRole>lambdaQuery().eq(SysUserRole::getUserId, userDto.getUserId())); sysUserRoleMapper.delete(Wrappers.<SysUserRole>lambdaQuery().eq(SysUserRole::getUserId, userDto.getUserId()));
userDto.getRole().stream().map(roleId -> { userDto.getRole().stream().map(roleId -> {
SysUserRole userRole = new SysUserRole(); SysUserRole userRole = new SysUserRole();
@ -234,8 +240,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
userRole.setRoleId(roleId); userRole.setRoleId(roleId);
return userRole; return userRole;
}).forEach(SysUserRole::insert); }).forEach(SysUserRole::insert);
}
// 更新用户岗位表 // 更新用户岗位表
if (Objects.nonNull(userDto.getPost())) {
sysUserPostMapper.delete(Wrappers.<SysUserPost>lambdaQuery().eq(SysUserPost::getUserId, userDto.getUserId())); sysUserPostMapper.delete(Wrappers.<SysUserPost>lambdaQuery().eq(SysUserPost::getUserId, userDto.getUserId()));
userDto.getPost().stream().map(postId -> { userDto.getPost().stream().map(postId -> {
SysUserPost userPost = new SysUserPost(); SysUserPost userPost = new SysUserPost();
@ -243,11 +252,13 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
userPost.setPostId(postId); userPost.setPostId(postId);
return userPost; return userPost;
}).forEach(SysUserPost::insert); }).forEach(SysUserPost::insert);
}
return Boolean.TRUE; return Boolean.TRUE;
} }
/** /**
* 查询全部的用户 * 查询全部的用户
*
* @param userDTO 查询条件 * @param userDTO 查询条件
* @return list * @return list
*/ */
@ -275,6 +286,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
/** /**
* excel 导入用户, 插入正确的 错误的提示行号 * excel 导入用户, 插入正确的 错误的提示行号
*
* @param excelVOList excel 列表数据 * @param excelVOList excel 列表数据
* @param bindingResult 错误数据 * @param bindingResult 错误数据
* @return ok fail * @return ok fail
@ -332,8 +344,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
// 数据合法情况 // 数据合法情况
if (CollUtil.isEmpty(errorMsg)) { if (CollUtil.isEmpty(errorMsg)) {
insertExcelUser(excel, deptOptional, roleCollList, postCollList); insertExcelUser(excel, deptOptional, roleCollList, postCollList);
} } else {
else {
// 数据不合法情况 // 数据不合法情况
errorMessageList.add(new ErrorMessage(excel.getLineNum(), errorMsg)); errorMessageList.add(new ErrorMessage(excel.getLineNum(), errorMsg));
} }
@ -373,6 +384,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
/** /**
* 注册用户 赋予用户默认角色 * 注册用户 赋予用户默认角色
*
* @param userDto 用户信息 * @param userDto 用户信息
* @return success/false * @return success/false
*/ */
@ -390,6 +402,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
/** /**
* 锁定用户 * 锁定用户
*
* @param username 用户名 * @param username 用户名
* @return * @return
*/ */
@ -440,8 +453,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
if (!ENCODER.matches(password, sysUser.getPassword())) { if (!ENCODER.matches(password, sysUser.getPassword())) {
log.info("原密码错误"); log.info("原密码错误");
return R.failed("密码输入错误"); return R.failed("密码输入错误");
} } else {
else {
return R.ok(); return R.ok();
} }
} }

View File

@ -16,7 +16,7 @@
<properties> <properties>
<screw.version>0.0.6</screw.version> <screw.version>0.0.6</screw.version>
<anyline.version>8.7.2-20240717</anyline.version> <anyline.version>8.7.2-20240808</anyline.version>
<configuration.version>1.10</configuration.version> <configuration.version>1.10</configuration.version>
</properties> </properties>