| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "some") |
| | | //@PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoUserInfo>>> some(QueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<VoUserInfo>> res = this.sv.selectSome(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | if(res.itemTotal == 0) { |
| | | return BaseResponseUtils.buildFail(SystemResultCode.THE_USER_NOT_EXIST.getMessage()); |
| | | }else { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | log.error("查询用户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | po.userId = null; |
| | | int count; |
| | | Long userId; |
| | | try { |
| | | po.supperAdmin = Constant.no.byteValue() ; |
| | | po.disabled = Disabled.NO;//默认不禁用 |
| | |
| | | } else { |
| | | po.password = MD5.encrypt(defaultPassword); |
| | | } |
| | | count = this.sv.save(po); |
| | | this.sv.setRoles(po.userId, po.roleIds); |
| | | userId = this.sv.save(po); |
| | | this.sv.setRoles(userId, po.roleIds); |
| | | } catch (Exception e) { |
| | | log.error("保存用户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | if (count <= 0) { |
| | | if (userId <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(true); |
| | |
| | | public BaseResponse<QueryResultVo<VoUserInfo>> getUserInfos(@PathVariable("userId") Long userId) { |
| | | try { |
| | | VoUserInfo res = this.sv.getUserInfos(userId); |
| | | if(res == null) { |
| | | return BaseResponseUtils.buildException(SystemResultCode.THE_USER_NOT_EXIST.getMessage()); |
| | | } |
| | | System.out.println(" :" + res); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |