| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.entity.TDept; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.dto.AddDeptDTO; |
| | | import com.ruoyi.system.dto.SetDeptDTO; |
| | | import com.ruoyi.system.mapper.SysUserMapper; |
| | | import com.ruoyi.system.model.OaApproval; |
| | | import com.ruoyi.system.query.ApprovalListQuery; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.OaApprovalService; |
| | | import com.ruoyi.system.service.TDeptService; |
| | | import com.ruoyi.system.vo.system.ApprovalVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/oa-approval") |
| | | @Api("审批流程设计") |
| | | public class OaApprovalController { |
| | | @Resource |
| | | private OaApprovalService oaApprovalService; |
| | | |
| | | /** |
| | | * 获取部门树列表 |
| | | */ |
| | | @ApiOperation("流程设计分页列表") |
| | | @PostMapping("/pageList") |
| | | public R<PageInfo<ApprovalVO>> pageList(@RequestBody ApprovalListQuery query) { |
| | | return R.ok( oaApprovalService.pageList(query)); |
| | | } |
| | | @ApiOperation(value = "启用禁用") |
| | | @GetMapping(value = "/updateStatus") |
| | | public R updateStatus(Integer id ) { |
| | | OaApproval approval = oaApprovalService.getById(id); |
| | | approval.setStatus(!approval.getStatus()); |
| | | oaApprovalService.updateById(approval); |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation(value = "设置使用部门") |
| | | @PostMapping(value = "/setDept") |
| | | public R setDept(@RequestBody SetDeptDTO dto) { |
| | | OaApproval approval = oaApprovalService.getById(dto.getId()); |
| | | approval.setDeptIds(dto.getDeptIds()); |
| | | oaApprovalService.updateById(approval); |
| | | return R.ok(); |
| | | } |
| | | // @Log(title = "编辑部门", businessType = BusinessType.UPDATE) |
| | | // @ApiOperation(value = "编辑部门") |
| | | // @PostMapping(value = "/edit") |
| | | // public R edit(@RequestBody AddDeptDTO dto) { |
| | | // deptService.updateById(dto); |
| | | // return R.ok(); |
| | | // } |
| | | // @ApiOperation(value = "部门详情") |
| | | // @GetMapping(value = "/detail") |
| | | // public R<TDept> edit(@RequestParam String id) { |
| | | // return R.ok(deptService.getById(id)); |
| | | // } |
| | | // @ApiOperation(value = "部门删除") |
| | | // @DeleteMapping(value = "/delete") |
| | | // @Log(title = "删除部门", businessType = BusinessType.DELETE) |
| | | // public R<Boolean> delete(@RequestParam String id) { |
| | | // Long count = deptService.lambdaQuery().eq(TDept::getParentId, id).count(); |
| | | // if (count>0){ |
| | | // return R.fail("当前部门存在下级部门,不可删除!"); |
| | | // } |
| | | // List<SysUser> users = sysUserMapper.selectAllList().stream().filter(e -> e.getDelFlag().equals("0") && e.getDeptId().equals(id)).collect(Collectors.toList()); |
| | | // if (!users.isEmpty()){ |
| | | // return R.fail("当前部门存在用户,不可删除!"); |
| | | // } |
| | | // deptService.removeById(Integer.valueOf(id)); |
| | | // return R.ok(); |
| | | // } |
| | | } |
| | | |