1.修改用户更新逻辑
This commit is contained in:
@@ -85,7 +85,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserModel> implements
|
|||||||
throw new BusinessException(ErrorCode.USER_DOES_NOT_EXIST);
|
throw new BusinessException(ErrorCode.USER_DOES_NOT_EXIST);
|
||||||
}
|
}
|
||||||
// 用户没有密码的情况下设置密码
|
// 用户没有密码的情况下设置密码
|
||||||
if (userInfo.getPassword() == null) {
|
if (userInfo.getPassword() == null && userModelDTO.getNewPassword() != null) {
|
||||||
if (!userModelDTO.getNewPassword().isEmpty()){
|
if (!userModelDTO.getNewPassword().isEmpty()){
|
||||||
if (userModelDTO.getNewPassword().length()<6){
|
if (userModelDTO.getNewPassword().length()<6){
|
||||||
throw new BusinessException(ErrorCode.PARAMS_ERROR,"密码长度不能小于 6 位");
|
throw new BusinessException(ErrorCode.PARAMS_ERROR,"密码长度不能小于 6 位");
|
||||||
@@ -106,12 +106,11 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserModel> implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UserModel userModel = new UserModel();
|
UserModel userModel = BeanUtil.copyProperties(userModelDTO, UserModel.class);
|
||||||
BeanUtil.copyProperties(userModelDTO, userModel);
|
|
||||||
int i = userDao.updateById(userModel);
|
int i = userDao.updateById(userModel);
|
||||||
// 返回结果
|
// 返回结果
|
||||||
userDao.selectById(userModel.getId());
|
UserModel afterUserInfo = userDao.selectById(userModel.getId());
|
||||||
UserModelVO userModelVO = BeanUtil.copyProperties(userModel, UserModelVO.class);
|
UserModelVO userModelVO = BeanUtil.copyProperties(afterUserInfo, UserModelVO.class);
|
||||||
userModelVO.setNewAccount(false);
|
userModelVO.setNewAccount(false);
|
||||||
if (i == 1){
|
if (i == 1){
|
||||||
return userModelVO;
|
return userModelVO;
|
||||||
|
|||||||
Reference in New Issue
Block a user