From 6ad9c778d138d0806966ce044dd4ee2ee46d2ea2 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Sat, 18 Sep 2021 16:56:52 +0800
Subject: [PATCH] 分局预警接口修改

---
 src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml |   64 ++++++++++++++++++++++++++------
 1 files changed, 52 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml b/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
index 56918a8..6d2ae59 100644
--- a/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
@@ -382,21 +382,51 @@
     </select>
 
     <select id="selectHold" resultType="java.util.HashMap">
-        SELECT
-            IFNULL(B.cz,0) as cz,
-            IFNULL(C.wcz,0) as wcz
-        FROM (SELECT jurisdiction FROM blade_user ) A
-            LEFT JOIN (SELECT COUNT(hold) as cz,jurisdiction FROM blade_user WHERE hold=0 GROUP BY jurisdiction ) B ON A.jurisdiction=B.jurisdiction
-            LEFT JOIN (SELECT COUNT(hold) as wcz,jurisdiction FROM blade_user WHERE hold=1 GROUP BY jurisdiction ) C ON A.jurisdiction=C.jurisdiction
-        WHERE A.jurisdiction=#{deptid} GROUP BY cz,wcz
+        SELECT IFNULL(B.cz, 0)  as cz,
+               IFNULL(C.wcz, 0) as wcz
+        FROM (SELECT departmentid,jurisdiction FROM sys_information) A
+                 LEFT JOIN (SELECT COUNT(hold) as cz, dept_id
+                            FROM blade_user
+                            WHERE hold = 1
+                              AND role_id = '1412226235153731586'
+                              and status = 1
+                            GROUP BY dept_id) B ON A.departmentid = B.dept_id
+                 LEFT JOIN (SELECT COUNT(hold) as wcz, dept_id
+                            FROM blade_user
+                            WHERE hold = 2
+                              AND role_id = '1412226235153731586'
+                              and status = 1
+                            GROUP BY dept_id) C ON A.departmentid = C.dept_id
+        WHERE A.jurisdiction in(${deptid})
+        GROUP BY cz, wcz
     </select>
 
     <!--查询部门下面的所有单位-->
     <select id="selectId" resultType="java.util.HashMap">
         SELECT id FROM blade_dept WHERE parent_id =#{id} and is_deleted = 0
     </select>
+
+
+    <!--查询保安公司树数据-->
     <select id="securityLazyTree" resultMap="treeNodeResultMap">
+        (
         SELECT
+        id,
+        parent_id,
+        dept_name AS title,
+        id AS "value",
+        id AS "key",
+        0 AS "has_children"
+        FROM
+        blade_dept
+        where is_deleted = 0
+        and
+        (id = 1413470343230877697 or id = 1425366663452196865 or id = 1418458374477549569 or id = 1420222768149966850)
+        )
+        union
+        (
+        SELECT
+        DISTINCT
         dept.id,
         dept.parent_id,
         dept.dept_name AS title,
@@ -412,12 +442,22 @@
         ) AS "has_children"
         FROM
         blade_dept dept
+        left join
+        sys_information si
+        on
+        si.departmentid = dept.id
         WHERE
-        dept.parent_id = #{param2} AND dept.is_deleted = 0
-        and dept_category = 1
-        <if test="param1!=null and param1!=''">
-            and dept.tenant_id = #{param1}
+        1=1
+        and si.stats != 4
+        AND dept.is_deleted = 0
+        and dept.id !=1420222961377357825
+        and dept.parent_id!=1420222961377357825
+        and dept.parent_id!=1425365577303621633
+        and dept.id != 1425365577303621633
+        and dept.id != 1432625856013971457
+        <if test="param1!=null and param1!='' and param1!='1372091709474910209'">
+            and si.jurisdiction = #{param1}
         </if>
-        ORDER BY dept.sort
+        )
     </select>
 </mapper>

--
Gitblit v1.9.3