| | |
| | | }) |
| | | @GetMapping(path = "one") |
| | | @SsoAop("-1") |
| | | public BaseResponse<BaUser> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | public BaseResponse<BaUser> one(@Parameter(description = "实体id", required = true) String id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(Long.parseLong(id))); |
| | | } |
| | | |
| | | /** |
| | |
| | | }) |
| | | @GetMapping(path = "changePassword", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | public BaseResponse<Boolean> changePassword(@Parameter(description = "实体id", required = true) Long id, |
| | | public BaseResponse<Boolean> changePassword(@Parameter(description = "实体id", required = true) String id, |
| | | @Parameter(description = "旧密码", required = true) String oldPassword, |
| | | @Parameter(description = "新密码", required = true) String newPassword) throws Exception{ |
| | | if(id == null){ |
| | |
| | | oldPassword = MD5.encrypt(oldPassword) ;//进行加密码 |
| | | newPassword = MD5.encrypt(newPassword) ;//进行加密码 |
| | | |
| | | Long idLg = Long.parseLong(id) ; |
| | | int count ; |
| | | try { |
| | | BaUser po = this.sv.selectById(id); |
| | | BaUser po = this.sv.selectById(idLg); |
| | | if(Objects.isNull(po)){ |
| | | return BaseResponseUtils.buildFail("未得到用户,请求失败") ; |
| | | }else{ |
| | | if(!po.password.equalsIgnoreCase(oldPassword)){ |
| | | return BaseResponseUtils.buildFail("旧密码不正确,请求失败") ; |
| | | }else{ |
| | | count = this.sv.changePassword(id, newPassword) ; |
| | | count = this.sv.changePassword(idLg, newPassword) ; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) String id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | } |
| | | int count; |
| | | try { |
| | | count = this.sv.delete(id); |
| | | count = this.sv.delete(Long.parseLong(id)); |
| | | } catch (Exception e) { |
| | | log.error("保存用户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |