| | |
| | | } |
| | | po.id = null; |
| | | int count; |
| | | int count1; |
| | | try { |
| | | po.disabled = Disabled.NO;//默认不禁用 |
| | | po.deleted = Deleted.NO;//默认不删除 |
| | |
| | | po.password = MD5.encrypt(defaultPassword); |
| | | } |
| | | count = this.sv.save(po); |
| | | count1 = this.sv.setRoles(String.valueOf(po.id), po.roleIds); |
| | | this.sv.setRoles(po.id, po.roleIds); |
| | | } catch (Exception e) { |
| | | log.error("保存用户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | if (count <= 0 || count1 <= 0) { |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(true); |
| | |
| | | po.deleted = null;//设置为null,不做更新 |
| | | po.orgTag = null;//设置为null,不做更新 |
| | | count = this.sv.update(po); |
| | | this.sv.setRoles(po.id, po.roleIds); |
| | | } catch (Exception e) { |
| | | log.error("保存用户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | |
| | | * @param id 用户ID |
| | | * @return 是否成功 |
| | | */ |
| | | @Operation(summary = "重置密码", description = "提交用户ID") |
| | | @Operation(summary = "重置密码为默认密码", description = "提交用户ID") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "resetPassword", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @GetMapping(path = "resetPasswordByDefault", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | public BaseResponse<Boolean> resetPassword(@Parameter(description = "实体id", required = true) String id) throws Exception { |
| | | public BaseResponse<Boolean> resetPasswordByDefault(@Parameter(description = "实体id", required = true) String id) throws Exception { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | } |
| | |
| | | * @param id 用户ID |
| | | * @return 是否成功 |
| | | */ |
| | | @Operation(summary = "重置密码", description = "提交用户ID") |
| | | @Operation(summary = "重置密码为随机数字加字母", description = "提交用户ID") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "resetPassword1", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @GetMapping(path = "resetPasswordByRandom", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | public BaseResponse<String> resetPassword1(@Parameter(description = "实体id", required = true) String id) throws Exception { |
| | | public BaseResponse<String> resetPasswordByRandom(@Parameter(description = "实体id", required = true) String id) throws Exception { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * 2023-12-05 在 save和update方法中进行了角色设置关联,本方法废弃 |
| | | * 设置用户角色 |
| | | * |
| | | * @param id 用户ID |
| | | * @return 是否成功 |
| | | */ |
| | | |
| | | @Operation(summary = "设置用户角色", description = "提交用户ID,及所选择的角色ID集合(数组)") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | */ |
| | | |
| | | /** |
| | | * 删除用户 |