| | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_POST_NOT_EMPTY; |
| | | |
| | | @Tag(name = "管理后台 - 用户") |
| | | @RestController |
| | |
| | | @Operation(summary = "新增用户") |
| | | @PreAuthorize("@ss.hasPermission('system:user:create')") |
| | | public CommonResult<Long> createUser(@Valid @RequestBody UserSaveReqVO reqVO) { |
| | | // 校验岗位必填 |
| | | if (CollUtil.isEmpty(reqVO.getPostIds())) { |
| | | throw exception(USER_POST_NOT_EMPTY); |
| | | } |
| | | Long id = userService.createUser(reqVO); |
| | | return success(id); |
| | | } |
| | |
| | | @Operation(summary = "修改用户") |
| | | @PreAuthorize("@ss.hasPermission('system:user:update')") |
| | | public CommonResult<Boolean> updateUser(@Valid @RequestBody UserSaveReqVO reqVO) { |
| | | // 校验岗位必填 |
| | | if (CollUtil.isEmpty(reqVO.getPostIds())) { |
| | | throw exception(USER_POST_NOT_EMPTY); |
| | | } |
| | | userService.updateUser(reqVO); |
| | | return success(true); |
| | | } |