|
@@ -16,6 +16,10 @@ import cn.ezhizao.framework.web.page.TableDataInfo;
|
|
|
import cn.ezhizao.project.business.domain.*;
|
|
|
import cn.ezhizao.project.business.mapper.BizTurnoverMapper;
|
|
|
import cn.ezhizao.project.business.service.*;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -32,6 +36,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
* @author ezhizao
|
|
|
* @date 2025-04-08
|
|
|
*/
|
|
|
+//@Api("部门管理")
|
|
|
@RestController
|
|
|
@RequestMapping("/business/dept")
|
|
|
public class SysDeptController extends BaseController
|
|
@@ -52,48 +57,42 @@ public class SysDeptController extends BaseController
|
|
|
/**
|
|
|
* 查询部门列表
|
|
|
*/
|
|
|
+// @ApiOperation("获取部门详细")
|
|
|
+// @ApiImplicitParams({
|
|
|
+// @ApiImplicitParam(name = "deptName", value = "部门名称", required = false, dataType = "String", paramType = "path", dataTypeClass = String.class),
|
|
|
+// @ApiImplicitParam(name = "deptCode", value = "部门编码", required = false, dataType = "String", paramType = "path", dataTypeClass = String.class),
|
|
|
+// @ApiImplicitParam(name = "deptId", value = "部门ID", required = false, dataType = "Long", paramType = "path", dataTypeClass = Long.class),
|
|
|
+// @ApiImplicitParam(name = "tenantId", value = "厂别ID", required = false, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
|
|
+// })
|
|
|
@PreAuthorize("@ss.hasPermi('business:dept:list')")
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(SysDept sysDept) throws NoSuchFieldException, IllegalAccessException
|
|
|
{
|
|
|
- startPage();
|
|
|
List<SysDept> list = sysDeptService.getList(sysDept);
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 导出部门列表
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('business:dept:export')")
|
|
|
- @Log(title = "部门", businessType = BusinessType.EXPORT)
|
|
|
- @PostMapping("/export")
|
|
|
- public void export(HttpServletResponse response, SysDept sysDept) throws NoSuchFieldException, IllegalAccessException
|
|
|
- {
|
|
|
- List<SysDept> list = sysDeptService.getList(sysDept);
|
|
|
- ExcelUtil<SysDept> util = new ExcelUtil<SysDept>(SysDept.class);
|
|
|
- util.exportExcel(response, list, "部门数据");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取部门详细信息
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('business:dept:query')")
|
|
|
- @GetMapping(value = "/{deptId}")
|
|
|
- public AjaxResult getInfo(@PathVariable("deptId") Long deptId)
|
|
|
- {
|
|
|
- return success(sysDeptService.getById(deptId));
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 新增部门
|
|
|
*/
|
|
|
+// @ApiOperation("新增部门")
|
|
|
+// @ApiImplicitParams({
|
|
|
+// @ApiImplicitParam(name = "deptName", value = "部门名称", required = true, dataType = "String", paramType = "path", dataTypeClass = String.class),
|
|
|
+// @ApiImplicitParam(name = "deptCode", value = "部门编码", required = true, dataType = "String", paramType = "path", dataTypeClass = String.class),
|
|
|
+// @ApiImplicitParam(name = "tenantId", value = "厂别ID", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class),
|
|
|
+// @ApiImplicitParam(name = "isOutsourcing", value = "是否外协", dataType = "Integer", paramType = "path", dataTypeClass = Integer.class),
|
|
|
+// @ApiImplicitParam(name = "supplierId", value = "外协商ID", dataType = "Long", paramType = "path", dataTypeClass = Long.class),
|
|
|
+// @ApiImplicitParam(name = "isWorkSection", value = "是否为工段", dataType = "String", paramType = "path", dataTypeClass = String.class),
|
|
|
+// @ApiImplicitParam(name = "equimentFlag", value = "是否一机多批", dataType = "Integer", paramType = "path", dataTypeClass = Integer.class),
|
|
|
+// @ApiImplicitParam(name = "isSortPackaging", value = "是否分选", dataType = "Integer", paramType = "path", dataTypeClass = Integer.class),
|
|
|
+// @ApiImplicitParam(name = "parentId", value = "父类ID", dataType = "Integer", paramType = "path", dataTypeClass = Integer.class),
|
|
|
+// })
|
|
|
@PreAuthorize("@ss.hasPermi('business:dept:add')")
|
|
|
@Log(title = "部门", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
public AjaxResult add(@RequestBody SysDept sysDept) throws NoSuchFieldException, IllegalAccessException
|
|
|
{
|
|
|
//判断必填项
|
|
|
- if(sysDept.getTenantId() ==null ||sysDept.getDeptName() ==null||sysDept.getDeptCode() ==null) {
|
|
|
+ if(sysDept.getTenantId() ==null ||sysDept.getDeptName() ==null || sysDept.getDeptName() ==""||sysDept.getDeptCode() ==null || sysDept.getDeptCode() =="") {
|
|
|
return error("新增部门失败,请求必填项:厂别、部门名称、部门编码不能为空");
|
|
|
}
|
|
|
if((sysDept.getIsOutsourcing() !=null && sysDept.getIsOutsourcing() ==1) && sysDept.getSupplierId() ==null) {
|
|
@@ -106,7 +105,7 @@ public class SysDeptController extends BaseController
|
|
|
if(sysDept.getIsOutsourcing() !=null && !(sysDept.getIsOutsourcing() ==0 || sysDept.getIsOutsourcing() ==1)){
|
|
|
return error("新增部门失败,是否外协只能是0或1");
|
|
|
}
|
|
|
- if(sysDept.getIsWorkSection() !=null && !(sysDept.getIsWorkSection().equals("0") || sysDept.getIsWorkSection().equals("1"))){
|
|
|
+ if(sysDept.getIsWorkSection() !=null &&sysDept.getIsWorkSection() !="" && !(sysDept.getIsWorkSection().equals("0") || sysDept.getIsWorkSection().equals("1"))){
|
|
|
return error("新增部门失败,是否为工段只能是0或1");
|
|
|
}
|
|
|
if(sysDept.getEquimentFlag() !=null && !(sysDept.getEquimentFlag() ==0 || sysDept.getEquimentFlag() ==1)){
|
|
@@ -162,6 +161,19 @@ public class SysDeptController extends BaseController
|
|
|
/**
|
|
|
* 修改部门
|
|
|
*/
|
|
|
+// @ApiOperation("修改部门")
|
|
|
+// @ApiImplicitParams({
|
|
|
+// @ApiImplicitParam(name = "deptId", value = "部门ID", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class),
|
|
|
+// @ApiImplicitParam(name = "deptName", value = "部门名称", dataType = "String", paramType = "path", dataTypeClass = String.class),
|
|
|
+// @ApiImplicitParam(name = "deptCode", value = "部门编码", dataType = "String", paramType = "path", dataTypeClass = String.class),
|
|
|
+// @ApiImplicitParam(name = "tenantId", value = "厂别ID", dataType = "Long", paramType = "path", dataTypeClass = Long.class),
|
|
|
+// @ApiImplicitParam(name = "isOutsourcing", value = "是否外协", dataType = "Integer", paramType = "path", dataTypeClass = Integer.class),
|
|
|
+// @ApiImplicitParam(name = "supplierId", value = "外协商ID", dataType = "Long", paramType = "path", dataTypeClass = Long.class),
|
|
|
+// @ApiImplicitParam(name = "isWorkSection", value = "是否为工段", dataType = "String", paramType = "path", dataTypeClass = String.class),
|
|
|
+// @ApiImplicitParam(name = "equimentFlag", value = "是否一机多批", dataType = "Integer", paramType = "path", dataTypeClass = Integer.class),
|
|
|
+// @ApiImplicitParam(name = "isSortPackaging", value = "是否分选", dataType = "Integer", paramType = "path", dataTypeClass = Integer.class),
|
|
|
+// @ApiImplicitParam(name = "parentId", value = "父类ID", dataType = "Integer", paramType = "path", dataTypeClass = Integer.class),
|
|
|
+// })
|
|
|
@PreAuthorize("@ss.hasPermi('business:dept:edit')")
|
|
|
@Log(title = "部门", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
@@ -181,7 +193,7 @@ public class SysDeptController extends BaseController
|
|
|
if(sysDept.getIsOutsourcing() !=null && !(sysDept.getIsOutsourcing() ==0 || sysDept.getIsOutsourcing() ==1)){
|
|
|
return error("修改部门失败,是否外协只能是0或1");
|
|
|
}
|
|
|
- if(sysDept.getIsWorkSection() !=null && !(sysDept.getIsWorkSection().equals("0") || sysDept.getIsWorkSection().equals("1"))){
|
|
|
+ if(sysDept.getIsWorkSection() !=null && sysDept.getIsWorkSection() !="" && !(sysDept.getIsWorkSection().equals("0") || sysDept.getIsWorkSection().equals("1"))){
|
|
|
return error("修改部门失败,是否为工段只能是0或1");
|
|
|
}
|
|
|
if(sysDept.getEquimentFlag() !=null && !(sysDept.getEquimentFlag() ==0 || sysDept.getEquimentFlag() ==1)){
|
|
@@ -230,6 +242,10 @@ public class SysDeptController extends BaseController
|
|
|
/**
|
|
|
* 删除部门
|
|
|
*/
|
|
|
+// @ApiOperation("删除部门")
|
|
|
+// @ApiImplicitParams({
|
|
|
+// @ApiImplicitParam(name = "deptId", value = "部门ID", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
|
|
+// })
|
|
|
@PreAuthorize("@ss.hasPermi('business:dept:remove')")
|
|
|
@Log(title = "部门", businessType = BusinessType.DELETE)
|
|
|
@DeleteMapping("/{deptId}")
|
|
@@ -248,11 +264,6 @@ public class SysDeptController extends BaseController
|
|
|
{
|
|
|
return warn("存在下级部门,不允许删除");
|
|
|
}
|
|
|
- if (sysDeptService.checkDeptExistUser(deptId))
|
|
|
- {
|
|
|
- return warn("部门存在用户,不允许删除");
|
|
|
- }
|
|
|
- sysDeptService.checkDeptDataScope(deptId);
|
|
|
return toAjax(sysDeptService.deleteDeptById(deptId));
|
|
|
}
|
|
|
}
|