package com.doumee.api.system; import com.doumee.api.BaseController; import com.doumee.biz.system.SystemUserBiz; import com.doumee.core.annotation.pr.PreventRepeat; import com.doumee.core.annotation.trace.Trace; import com.doumee.core.model.ApiResponse; import com.doumee.core.constants.Constants; import com.doumee.core.model.PageData; import com.doumee.core.model.PageWrap; import com.doumee.dao.system.dto.CreateSystemUserDTO; import com.doumee.dao.system.dto.CreateUserRoleDTO; import com.doumee.dao.system.dto.QuerySystemUserDTO; import com.doumee.dao.system.dto.ResetSystemUserPwdDTO; import com.doumee.dao.system.vo.SystemUserListVO; import com.doumee.service.system.SystemUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; /** * @author Eva.Caesar Liu * @since 2025/03/31 16:44 */ @Api(tags = "用户") @RestController @RequestMapping("/system/user") public class SystemUserController extends BaseController { @Autowired private SystemUserService systemUserService; @Autowired private SystemUserBiz systemUserBiz; @PreventRepeat @ApiOperation("配置用户角色") @PostMapping("/createUserRole") @RequiresPermissions("system:user:createUserRole") public ApiResponse createUserRole (@Validated @RequestBody CreateUserRoleDTO dto) { systemUserBiz.createUserRole(dto); return ApiResponse.success(null); } @Trace(withRequestParameters = false) @PreventRepeat @ApiOperation("重置用户密码") @PostMapping("/resetPwd") @RequiresPermissions("system:user:resetPwd") public ApiResponse resetPwd (@Validated @RequestBody ResetSystemUserPwdDTO dto) { dto.setOperaUserId(this.getLoginUser().getId()); systemUserBiz.resetPwd(dto); return ApiResponse.success(null); } @Trace(withRequestParameters = false) @PreventRepeat @ApiOperation("新建") @PostMapping("/create") @RequiresPermissions("system:user:create") public ApiResponse create(@Validated(Constants.OperaType.Create.class) @RequestBody CreateSystemUserDTO systemUser) { systemUser.setCreateUser(this.getLoginUser().getId()); systemUserBiz.create(systemUser); return ApiResponse.success(null); } @ApiOperation("删除") @GetMapping("/delete/{id}") @RequiresPermissions("system:user:delete") public ApiResponse deleteById(@PathVariable Integer id) { systemUserBiz.deleteById(id); return ApiResponse.success(null); } @ApiOperation("批量删除") @GetMapping("/delete/batch") @RequiresPermissions("system:user:delete") public ApiResponse deleteByIdInBatch(@RequestParam String ids) { systemUserBiz.deleteByIdInBatch(this.getIdList(ids)); return ApiResponse.success(null); } @Trace(withRequestParameters = false) @ApiOperation("修改") @PostMapping("/updateById") @RequiresPermissions("system:user:update") public ApiResponse updateById(@Validated(Constants.OperaType.Update.class) @RequestBody CreateSystemUserDTO systemUser) { systemUser.setUpdateUser(this.getLoginUser().getId()); systemUserBiz.updateById(systemUser); return ApiResponse.success(null); } @ApiOperation("分页查询") @PostMapping("/page") @RequiresPermissions("system:user:query") public ApiResponse> findPage (@RequestBody PageWrap pageWrap) { return ApiResponse.success(systemUserService.findPage(pageWrap)); } }