|  |  |  | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.dao.system.dto.CreateSystemUserDTO; | 
|---|
|  |  |  | import com.doumee.dao.system.dto.CreateUserRoleDTO; | 
|---|
|  |  |  | import com.doumee.dao.system.dto.QuerySystemUserDTO; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 org.springframework.web.multipart.MultipartFile; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.io.File; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author Eva.Caesar Liu | 
|---|
|  |  |  | * @date 2023/03/21 14:49 | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("配置用户角色") | 
|---|
|  |  |  | @PostMapping("/createUserRole") | 
|---|
|  |  |  | @RequiresPermissions("system:user:createUserRole") | 
|---|
|  |  |  | public ApiResponse createUserRole (@Validated @RequestBody CreateUserRoleDTO dto) { | 
|---|
|  |  |  | public ApiResponse createUserRole (@Validated @RequestBody CreateUserRoleDTO dto, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | dto.setCreateUser(this.getLoginUser(token).getId()); | 
|---|
|  |  |  | systemUserBiz.createUserRole(dto); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("重置用户密码") | 
|---|
|  |  |  | @PostMapping("/resetPwd") | 
|---|
|  |  |  | @RequiresPermissions("system:user:resetPwd") | 
|---|
|  |  |  | public ApiResponse resetPwd (@Validated @RequestBody ResetSystemUserPwdDTO dto) { | 
|---|
|  |  |  | dto.setOperaUserId(this.getLoginUser().getId()); | 
|---|
|  |  |  | public ApiResponse resetPwd (@Validated @RequestBody ResetSystemUserPwdDTO dto, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | dto.setOperaUserId(this.getLoginUser(token).getId()); | 
|---|
|  |  |  | systemUserBiz.resetPwd(dto); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("新建") | 
|---|
|  |  |  | @PostMapping("/create") | 
|---|
|  |  |  | @RequiresPermissions("system:user:create") | 
|---|
|  |  |  | public ApiResponse create(@Validated(OperaType.Create.class) @RequestBody CreateSystemUserDTO systemUser) { | 
|---|
|  |  |  | systemUser.setCreateUser(this.getLoginUser().getId()); | 
|---|
|  |  |  | public ApiResponse create(@Validated(OperaType.Create.class) @RequestBody CreateSystemUserDTO systemUser, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | systemUser.setCreateUser(this.getLoginUser(token).getId()); | 
|---|
|  |  |  | systemUserBiz.create(systemUser); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("修改") | 
|---|
|  |  |  | @PostMapping("/updateById") | 
|---|
|  |  |  | @RequiresPermissions("system:user:update") | 
|---|
|  |  |  | public ApiResponse updateById( @RequestBody CreateSystemUserDTO systemUser) { | 
|---|
|  |  |  | systemUser.setUpdateUser(this.getLoginUser().getId()); | 
|---|
|  |  |  | public ApiResponse updateById( @RequestBody CreateSystemUserDTO systemUser, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | systemUser.setUpdateUser(this.getLoginUser(token).getId()); | 
|---|
|  |  |  | systemUserBiz.updateById(systemUser); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|