¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.api.system; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.biz.system.SystemDepartmentBiz; |
| | | 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.QuerySystemUserDTO; |
| | | import com.doumee.dao.system.model.SystemDepartment; |
| | | import com.doumee.dao.system.vo.SystemDepartmentListVO; |
| | | import com.doumee.dao.system.vo.SystemUserListVO; |
| | | import com.doumee.service.system.SystemUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | 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 |
| | | * @date 2023/03/21 14:49 |
| | | */ |
| | | @Api(tags = "é¨é¨") |
| | | @RestController |
| | | @RequestMapping("/system/department") |
| | | public class SystemDepartmentController extends BaseController { |
| | | |
| | | @Autowired |
| | | private SystemDepartmentBiz systemDepartmentBiz; |
| | | |
| | | @Autowired |
| | | private SystemUserService systemUserService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @RequiresPermissions("system:department:create") |
| | | public ApiResponse create(@Validated(OperaType.Create.class) @RequestBody SystemDepartment systemDepartment) { |
| | | systemDepartment.setCreateUser(getLoginUser().getId()); |
| | | systemDepartment.setUpdateUser(getLoginUser().getId()); |
| | | return ApiResponse.success(systemDepartmentBiz.create(systemDepartment)); |
| | | } |
| | | |
| | | @ApiOperation("å é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @RequiresPermissions("system:department:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | systemDepartmentBiz.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @PreventRepeat |
| | | @RequiresPermissions("system:department: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)); |
| | | } |
| | | systemDepartmentBiz.deleteByIdInBatch(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("ä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @RequiresPermissions("system:department:update") |
| | | public ApiResponse updateById(@Validated(OperaType.Update.class) @RequestBody SystemDepartment systemDepartment) { |
| | | systemDepartment.setCreateUser(getLoginUser().getId()); |
| | | systemDepartment.setUpdateUser(getLoginUser().getId()); |
| | | systemDepartmentBiz.updateById(systemDepartment); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢é¨é¨å表") |
| | | @PostMapping("/tree") |
| | | @RequiresPermissions("system:department:query") |
| | | public ApiResponse<List<SystemDepartmentListVO>> findTree () { |
| | | return ApiResponse.success(systemDepartmentBiz.findTree()); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢é¨é¨å表åé¨é¨ä¸ç人å") |
| | | @GetMapping("/findTreeUser") |
| | | @RequiresPermissions("system:department:query") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "parentId", value = "parentId", paramType = "query", dataType = "Integer"), |
| | | }) |
| | | public ApiResponse<SystemDepartmentListVO> findTreeUser(Integer parentId) { |
| | | return ApiResponse.success(systemDepartmentBiz.findTreeUser(parentId)); |
| | | } |
| | | |
| | | @Trace(exclude = true) |
| | | @ApiOperation("æ¥è¯¢é¨é¨äººå") |
| | | @PostMapping("/users") |
| | | @RequiresPermissions("system:department:queryUsers") |
| | | public ApiResponse<PageData<SystemUserListVO>> findPage (@RequestBody PageWrap<QuerySystemUserDTO> pageWrap) { |
| | | return ApiResponse.success(systemUserService.findPage(pageWrap)); |
| | | } |
| | | } |