| | |
| | | import com.ycl.api.BasePageVO; |
| | | import com.ycl.api.CommonResult; |
| | | import com.ycl.controller.BaseController; |
| | | import com.ycl.entity.depart.DepartManager; |
| | | import com.ycl.dto.UmsDepartDto; |
| | | import com.ycl.entity.depart.UmsDepart; |
| | | import com.ycl.entity.user.UmsDepartManage; |
| | | import com.ycl.service.depart.UmsDepartService; |
| | | import com.ycl.service.user.UmsDepartManageService; |
| | | import com.ycl.utils.EasyExcelUtils; |
| | | import com.ycl.utils.auth.UserAuthUtil; |
| | | import com.ycl.vo.depart.DepartVO; |
| | | import com.ycl.vo.depart.UmsDepartVO; |
| | |
| | | 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 javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | return CommonResult.success(departService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | @ApiOperation("批处理-开启或者禁用部门") |
| | | @PutMapping(value = "/batch_status") |
| | | @LogSave(operationType = "部门管理", contain = "批量开启或者禁用部门") |
| | | public CommonResult updateBatch(@RequestBody List<UmsDepart> umsDepartList) { |
| | | if (umsDepartList.isEmpty()) { |
| | | return CommonResult.failed("bad request parameter"); |
| | | } |
| | | return CommonResult.success(departService.updateBatchById(umsDepartList)); |
| | | } |
| | | |
| | | @ApiOperation("详情") |
| | | @PostMapping(value = "/detail") |
| | | @LogSave(operationType = "部门管理", contain = "查看部门") |
| | |
| | | return CommonResult.success(page); |
| | | } |
| | | |
| | | @ApiOperation("部门导出") |
| | | @PostMapping("/export") |
| | | public void exportDpt(HttpServletResponse response) { |
| | | List<UmsDepartDto> umsDepartDtos = departService.departExp(); |
| | | String sheetName = "部门导出"; |
| | | EasyExcelUtils.export(response, sheetName, UmsDepartDto.class, umsDepartDtos); |
| | | } |
| | | |
| | | @ApiOperation("部门导入") |
| | | @PostMapping("/import") |
| | | public CommonResult importDpt(MultipartFile file) throws IOException { |
| | | EasyExcelUtils.importDepartFile(file); |
| | | return CommonResult.success(true, "导入成功"); |
| | | } |
| | | |
| | | @ApiOperation("查询我的部门") |
| | | @GetMapping(value = "/belongDepart") |
| | | public CommonResult<BasePageDTO> belongDepart(BasePageVO params) { |
| | |
| | | @ApiOperation("用户修改角色") |
| | | @PutMapping(value = "/user_update_Role") |
| | | public CommonResult userUpdateRole(@RequestParam Long id, |
| | | @RequestParam List<Long> roles) { |
| | | @RequestParam List<Long> roles) { |
| | | umsAdminDepartService.userUpdateRoles(id, roles); |
| | | return CommonResult.success("update success"); |
| | | } |
| | | |
| | | @ApiOperation("用户修改部门") |
| | | @PutMapping(value = "/user_update_depart") |
| | | public CommonResult userUpdateDepart(@RequestParam Long id, |
| | | @RequestParam List<UmsDepartManage> departmentIds) { |
| | | umsAdminDepartService.userUpdateDepart(id, departmentIds); |
| | | public CommonResult userUpdateDepart(@RequestParam Long userId, |
| | | @RequestParam Long departId) { |
| | | umsAdminDepartService.userUpdateDepart(userId, departId); |
| | | return CommonResult.success("update success"); |
| | | } |
| | | |
| | | @ApiOperation("查询不在部门的剩余人员") |
| | | @GetMapping("/query_surplus_user") |
| | | public CommonResult searchSurplusUser() { |
| | | return CommonResult.success(departService.selectSurplusUser()); |
| | | } |
| | | |
| | | @ApiOperation("查询不在部门的剩余人员和已在部门的人") |
| | | @GetMapping("/query_surplus_exist_user") |
| | | public CommonResult searchSurplusUser(@RequestParam Long id) { |
| | | return CommonResult.success(departService.selectSurplusUserAndExistUser(id)); |
| | | } |
| | | |
| | | @ApiOperation("查询顶级部门") |
| | | @GetMapping(value = "/query_father") |
| | | public CommonResult search() { |