¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.constants.OperaType; |
| | | import com.doumee.core.model.ApiResponse; |
| | | 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.model.SystemUser; |
| | | import com.doumee.dao.system.vo.SystemUserListVO; |
| | | import com.doumee.service.system.SystemUserService; |
| | | import io.swagger.annotations.*; |
| | | 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; |
| | | |
| | | /** |
| | | * @author Eva.Caesar Liu |
| | | * @date 2023/03/21 14:49 |
| | | */ |
| | | @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(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) { |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | systemUserBiz.deleteByIdInBatch(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @Trace(withRequestParameters = false) |
| | | @ApiOperation("ä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @RequiresPermissions("system:user:update") |
| | | public ApiResponse updateById( @RequestBody CreateSystemUserDTO systemUser) { |
| | | systemUser.setUpdateUser(this.getLoginUser().getId()); |
| | | systemUserBiz.updateById(systemUser); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @RequiresPermissions("system:user:query") |
| | | public ApiResponse<PageData<SystemUserListVO>> findPage (@RequestBody PageWrap<QuerySystemUserDTO> pageWrap) { |
| | | return ApiResponse.success(systemUserService.findPage(pageWrap)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation("æ¥è¯¢ææç³»ç»ç¨æ·") |
| | | @PostMapping("/findAllList") |
| | | @RequiresPermissions("system:user:query") |
| | | public ApiResponse<List<SystemUser>> findAllList (@RequestBody SystemUser pageWrap) { |
| | | return ApiResponse.success(systemUserService.findAllList(pageWrap)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @RequiresPermissions("system:user:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(systemUserService.findById(id)); |
| | | } |
| | | |
| | | @ApiOperation("ç¨æ·å¯¼å
¥") |
| | | @PostMapping("/importSystemUserBatch") |
| | | @RequiresPermissions("system:user:query") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file", value = "file", required = true, paramType = "query", dataType = "file", dataTypeClass = File.class), |
| | | }) |
| | | public ApiResponse importSystemUserBatch(@ApiParam(value = "file") MultipartFile file){ |
| | | return ApiResponse.success(systemUserBiz.importSystemUserBatch(file)); |
| | | } |
| | | } |