1. 添加修改密码

topo_dev
xueqingkun 9 months ago
parent a20e6f218d
commit effe1eb914

@ -76,6 +76,12 @@ public class UserController {
} }
@Operation(summary = "修改密码")
@PostMapping("changePassWord")
public boolean changePassWord(@RequestBody UserInfoReqVo userInfo) {
return userService.changePassWord(userInfo.getAccount(),userInfo.getPassword());
}

@ -27,4 +27,5 @@ public interface SystemUserService extends IService<SystemUser> {
void updateUserStatus(UserStatusReqVo userStatusReqVo); void updateUserStatus(UserStatusReqVo userStatusReqVo);
boolean changePassWord(String account, String password);
} }

@ -171,6 +171,21 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
super.lambdaUpdate().set(SystemUser::getStatus, userStatusReqVo.getStatus()) super.lambdaUpdate().set(SystemUser::getStatus, userStatusReqVo.getStatus())
.eq(SystemUser::getId, userStatusReqVo.getId()).update(); .eq(SystemUser::getId, userStatusReqVo.getId()).update();
} }
@Override
public boolean changePassWord(String account, String password) {
Assert.notEmpty(account, "账号不能为空");
Assert.notEmpty(password, "密码不能为空");
Long count = super.lambdaQuery().eq(SystemUser::getAccount, account).count();
if (count == 0){
log.info("账号:{}不存在", account);
return false;
}
return super.lambdaUpdate().set(SystemUser::getUserPd, UserUtil.signPassword(password))
.eq(SystemUser::getAccount, account).update();
}
} }

Loading…
Cancel
Save