From 4c8992891ac92ace938ad81f38d7b9fb6e5cd78c Mon Sep 17 00:00:00 2001
From: rentaiming <806181062@qq.com>
Date: 星期六, 20 七月 2024 21:52:13 +0800
Subject: [PATCH] 森林防火 供应商管理

---
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java |   33 +++++----------------------------
 1 files changed, 5 insertions(+), 28 deletions(-)

diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java
index 875dd67..60e5287 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java
@@ -5,6 +5,7 @@
 
 import com.ruoyi.system.service.ISysDeptService;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -44,6 +45,7 @@
      */
     @RequiresPermissions("system:dept:list")
     @GetMapping("/list")
+    @ApiOperation("获取部门列表")
     public AjaxResult list(SysDept dept)
     {
         List<SysDept> depts = deptService.selectDeptList(dept);
@@ -53,20 +55,13 @@
     /**
      * 查询部门列表(排除节点)
      */
-    @RequiresPermissions("system:dept:list")
-    @GetMapping("/list/exclude/{deptId}")
-    public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
-    {
-        List<SysDept> depts = deptService.selectDeptList(new SysDept());
-        depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
-        return success(depts);
-    }
 
     /**
      * 根据部门编号获取详细信息
      */
     @RequiresPermissions("system:dept:query")
     @GetMapping(value = "/{deptId}")
+    @ApiOperation("根据部门编号获取详细信息")
     public AjaxResult getInfo(@PathVariable Long deptId)
     {
         deptService.checkDeptDataScope(deptId);
@@ -77,14 +72,11 @@
      * 新增部门
      */
     @RequiresPermissions("system:dept:add")
+    @ApiOperation("新增部门")
     @Log(title = "部门管理", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@Validated @RequestBody SysDept dept)
     {
-        if (!deptService.checkDeptNameUnique(dept))
-        {
-            return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
-        }
         dept.setCreateBy(SecurityUtils.getUsername());
         return toAjax(deptService.insertDept(dept));
     }
@@ -94,23 +86,12 @@
      */
     @RequiresPermissions("system:dept:edit")
     @Log(title = "部门管理", businessType = BusinessType.UPDATE)
+    @ApiOperation("修改部门")
     @PutMapping
     public AjaxResult edit(@Validated @RequestBody SysDept dept)
     {
         Long deptId = dept.getDeptId();
         deptService.checkDeptDataScope(deptId);
-        if (!deptService.checkDeptNameUnique(dept))
-        {
-            return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
-        }
-        else if (dept.getParentId().equals(deptId))
-        {
-            return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
-        }
-        else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
-        {
-            return error("该部门包含未停用的子部门!");
-        }
         dept.setUpdateBy(SecurityUtils.getUsername());
         return toAjax(deptService.updateDept(dept));
     }
@@ -123,10 +104,6 @@
     @DeleteMapping("/{deptId}")
     public AjaxResult remove(@PathVariable Long deptId)
     {
-        if (deptService.hasChildByDeptId(deptId))
-        {
-            return warn("存在下级部门,不允许删除");
-        }
         if (deptService.checkDeptExistUser(deptId))
         {
             return warn("部门存在用户,不允许删除");

--
Gitblit v1.7.1