From 3bb39d123ef72b627386301af48a349defda69bd Mon Sep 17 00:00:00 2001
From: fengjin <1435304038@qq.com>
Date: 星期一, 10 十月 2022 16:01:49 +0800
Subject: [PATCH] 小程序获取导半人员及自动分配部分代码

---
 flower_city/src/main/java/com/dg/core/controller/OrganizationController.java |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/flower_city/src/main/java/com/dg/core/controller/OrganizationController.java b/flower_city/src/main/java/com/dg/core/controller/OrganizationController.java
index 2cd8557..38e281d 100644
--- a/flower_city/src/main/java/com/dg/core/controller/OrganizationController.java
+++ b/flower_city/src/main/java/com/dg/core/controller/OrganizationController.java
@@ -88,6 +88,12 @@
     public ResultData deleteConfigById(@RequestParam(value = "Id",required = false)  String Id)
     {
         Assert.notNull(Id, "Id 不能为空");
+        List<OrganizationChartEntity> list=iOrganizationChartService.selectParentList(Id,"");
+
+        if(list!=null && list.size()>0)
+        {
+            return ResultData.error("该机构下存在其他部门!请先删除子部门");
+        }
         return toAjax(iOrganizationChartService.deleteConfigById(Id));
     }
 
@@ -133,27 +139,25 @@
      */
     @ApiOperation(value = "通过父级id查询对应机构下的全部部门",response = OrganizationChartEntity.class)
     @GetMapping("/getdepartment")
-    public TableDataInfo getIds(@RequestParam(value = "department",required = false) String departmentId)
+    public TableDataInfo getOrganizations(@RequestParam(value = "department",required = false) String departmentId)
     {
         List<OrganizationChartEntity> ids=new ArrayList<>();
-        List<OrganizationChartEntity> lists = iOrganizationChartService.selectConfigList(departmentId,"");
+        List<OrganizationChartEntity> lists = iOrganizationChartService.selectParentList(departmentId,"");
         if(lists.size()<1)
         {
             lists.add(iOrganizationChartService.selectConfigById(departmentId));
         }
-        ids=disposestreetId(lists);
+        ids=disposestreet(lists);
         if(ids.size()<1)
         {
             return null;
         }
-//        ids.add(streetId);
         ids.add(iOrganizationChartService.selectConfigById(departmentId));
         return getDataTable(ids);
     }
 
-
     //递归取id
-    private List<OrganizationChartEntity> disposestreetId(List<OrganizationChartEntity> lists)
+    private List<OrganizationChartEntity> disposestreet(List<OrganizationChartEntity> lists)
     {
         List<OrganizationChartEntity> ids=new ArrayList<>();
         for (OrganizationChartEntity sysStreet:lists)
@@ -161,7 +165,7 @@
             ids.add(sysStreet);
             if(sysStreet.getChild()!=null && sysStreet.getChild().size()>0)
             {
-                ids.addAll(disposestreetId(sysStreet.getChild()));
+                ids.addAll(disposestreet(sysStreet.getChild()));
             }
             else
             {
@@ -170,8 +174,5 @@
         }
         return ids;
     }
-
-
-
 
 }

--
Gitblit v1.7.1