From bcb742a2682e7e33621fc028cee9da033cf2ad80 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Fri, 17 Sep 2021 16:29:33 +0800
Subject: [PATCH] 1.用户

---
 src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml |   88 ++++++++++++++++++++++++-------------------
 1 files changed, 49 insertions(+), 39 deletions(-)

diff --git a/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml b/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
index f35fe24..054d807 100644
--- a/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
+++ b/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -136,44 +136,54 @@
         j.dept_name
     </select>
 
-    <!--通过辖区查询机构id,然后通过机构id查询当前机构交社保的人数(numj单位已交社保数量;numz单位人员总数)-->
     <select id="selectCs" resultType="java.util.HashMap">
-        SELECT A.numj,
-        B.numz,
-        d.dept_name as deptname
-        FROM (
-        SELECT COUNT
-        (*) AS numj,
-        deptid
-        FROM sys_socil
-        WHERE deptid IN (SELECT i.departmentid
-        FROM sys_information i
-        LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction where 1=1
-        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
-            and i.jurisdiction in(${jurisdiction})
-        </if>
-        GROUP BY i.departmentid)
-        GROUP BY deptid
-        ) A
-        left JOIN (
-        SELECT COUNT
-        (*) AS numz,
-        dept_id
+        SELECT COUNT(*) as numj,jurisdiction
         FROM blade_user
-        WHERE dept_id IN (SELECT i.departmentid
-        FROM sys_information i
-        LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction where 1=1
+        WHERE soil = 1
         <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
-            and i.jurisdiction in(${jurisdiction})
+            and jurisdiction in(${jurisdiction})
         </if>
-        GROUP BY i.departmentid)
-        GROUP BY dept_id
-        ) B ON A.deptid = B.dept_id
-        LEFT JOIN (SELECT id, dept_name FROM blade_dept) d ON d.id = A.deptid where 1=1
-        <if test="deptid!=null and deptid!=''">
-            and A.deptid =#{deptid}
-        </if>
+        group by jurisdiction
     </select>
+
+    <!--通过辖区查询机构id,然后通过机构id查询当前机构交社保的人数(numj单位已交社保数量;numz单位人员总数)-->
+<!--    <select id="selectCs" resultType="java.util.HashMap">-->
+<!--        SELECT A.numj,-->
+<!--        B.numz,-->
+<!--        d.dept_name as deptname-->
+<!--        FROM (-->
+<!--        SELECT COUNT-->
+<!--        (*) AS numj,-->
+<!--        deptid-->
+<!--        FROM sys_socil-->
+<!--        WHERE deptid IN (SELECT i.departmentid-->
+<!--        FROM sys_information i-->
+<!--        LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction where 1=1-->
+<!--        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">-->
+<!--            and i.jurisdiction in(${jurisdiction})-->
+<!--        </if>-->
+<!--        GROUP BY i.departmentid)-->
+<!--        GROUP BY deptid-->
+<!--        ) A-->
+<!--        left JOIN (-->
+<!--        SELECT COUNT-->
+<!--        (*) AS numz,-->
+<!--        dept_id-->
+<!--        FROM blade_user-->
+<!--        WHERE dept_id IN (SELECT i.departmentid-->
+<!--        FROM sys_information i-->
+<!--        LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction where 1=1-->
+<!--        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">-->
+<!--            and i.jurisdiction in(${jurisdiction})-->
+<!--        </if>-->
+<!--        GROUP BY i.departmentid)-->
+<!--        GROUP BY dept_id-->
+<!--        ) B ON A.deptid = B.dept_id-->
+<!--        LEFT JOIN (SELECT id, dept_name FROM blade_dept) d ON d.id = A.deptid where 1=1-->
+<!--        <if test="deptid!=null and deptid!=''">-->
+<!--            and A.deptid =#{deptid}-->
+<!--        </if>-->
+<!--    </select>-->
 
     <!--    &lt;!&ndash;统计上个月和这个月交社保的人数以及缴纳金额&ndash;&gt;-->
     <!--    <select id="selectTo" resultType="java.util.HashMap">-->
@@ -1856,9 +1866,9 @@
         on
         si.jurisdiction = sj.id
         where 1=1
-        and (stats = 2 or stats = 4)
+        and (stats = 0 or stats = 1 or stats = 2 or stats = 4)
         <if test="information.jurisdiction!=null and information.jurisdiction!=''">
-            and sj.id = #{information.jurisdiction}
+            and (sj.id = #{information.jurisdiction} or sj.parent_id =  #{information.jurisdiction})
         </if>
     </select>
 
@@ -1912,7 +1922,7 @@
         where 1=1
         and (si.stats = 2 or si.stats = 4)
         <if test="information.jurisdiction!=null and information.jurisdiction!=''">
-            and sj.id = #{information.jurisdiction}
+            and (sj.id = #{information.jurisdiction} or sj.parent_id =  #{information.jurisdiction})
         </if>
     </select>
 
@@ -1960,7 +1970,7 @@
         and (c.stats = 2 or c.stats = 4)
         and pnum &lt; #{information.proportion}
         <if test="information.jurisdiction!=null and information.jurisdiction!='' and information.jurisdiction!='1372091709474910209'">
-            and sj.id = #{information.jurisdiction}
+            and (sj.id = #{information.jurisdiction} or sj.parent_id =  #{information.jurisdiction})
         </if>
         <if test="information.departmentid!=null and information.departmentid!=''">
             and c.departmentid = #{information.departmentid}
@@ -2056,7 +2066,7 @@
         and (d.stats = 2 or d.stats = 4)
         and pnum &lt; #{information.proportion}
         <if test="information.jurisdiction!=null and information.jurisdiction!='' and information.jurisdiction!='1372091709474910209'">
-            and sj.id = #{information.jurisdiction}
+            and (sj.id = #{information.jurisdiction} or sj.parent_id =  #{information.jurisdiction})
         </if>
     </select>
 
@@ -2191,7 +2201,7 @@
             a.dept_id = si.departmentid
             where 1=1
             <if test="information.jurisdiction!=null and information.jurisdiction!='' and information.jurisdiction!='1372091709474910209'">
-                and sj.id = #{information.jurisdiction}
+                and (sj.id = #{information.jurisdiction} or sj.parent_id =  #{information.jurisdiction})
             </if>
         ) b
         where b.znum &lt; 2

--
Gitblit v1.9.3