From 9c10d5e9ce87f3aa5144e4dc314a7a95fef64691 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 22 Sep 2021 17:55:52 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/zhba_management

---
 src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml |  133 ++++++++++++++++++++++++++++++++------------
 1 files changed, 97 insertions(+), 36 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 6e41400..c227a9a 100644
--- a/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
+++ b/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -1030,53 +1030,114 @@
 
     <!--资格审查异常数量-->
     <select id="selectExtype" resultType="java.util.HashMap">
-        SELECT COUNT
-        (*) as num,
-        d.dept_name,
-        u.real_name,
-        j.dept_name AS jurname
-        FROM blade_user u
-        LEFT JOIN blade_dept d ON d.id = u.dept_id
-        LEFT JOIN sys_jurisdiction j ON j.id = u.jurisdiction
-        WHERE u.examination_type = 1 and u.is_deleted=0 and u.status = 1
-        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
-            and u.jurisdiction in (${jurisdiction})
-        </if>
-        <if test="deptid!=null and deptid!=''">
-            and u.dept_id =#{deptid}
-        </if>
+        SELECT
+        IFNULL( J.num, 0 ) AS num
+        FROM
+        ( SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction ) H
+        LEFT JOIN (
+        SELECT
+        COUNT( * ) AS num,
+        dept_id
+        FROM
+        blade_user
+        WHERE
+        examination_type = 1
+        AND is_deleted = 0
+        AND STATUS = 1
         <if test="type!=null and type=='1'.toString()">
-            and to_days(u.update_time) = to_days(now())
+            and to_days(audit_time) = to_days(now())
         </if>
         <if test="type!=null and type=='2'.toString()">
-            and DATE_FORMAT(u.update_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
+            and DATE_FORMAT(audit_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
         </if>
-        GROUP BY d.dept_name,u.real_name,
-        j.dept_name
+        GROUP BY
+        dept_id
+        ) J ON J.dept_id = H.departmentid
+        WHERE 1 = 1
+        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
+            AND H.jurisdiction in(${jurisdiction})
+        </if>
+        <if test="deptid!=null and deptid!=''">
+            AND H.departmentid = #{deptid}
+        </if>
     </select>
+<!--    <select id="selectExtype" resultType="java.util.HashMap">-->
+<!--        SELECT COUNT-->
+<!--        (*) as num,-->
+<!--        d.dept_name,-->
+<!--        u.real_name,-->
+<!--        j.dept_name AS jurname-->
+<!--        FROM blade_user u-->
+<!--        LEFT JOIN blade_dept d ON d.id = u.dept_id-->
+<!--        LEFT JOIN sys_jurisdiction j ON j.id = u.jurisdiction-->
+<!--        WHERE u.examination_type = 1 and u.is_deleted=0 and u.status = 1-->
+<!--        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">-->
+<!--            and u.jurisdiction in (${jurisdiction})-->
+<!--        </if>-->
+<!--        <if test="deptid!=null and deptid!=''">-->
+<!--            and u.dept_id =#{deptid}-->
+<!--        </if>-->
+<!--        <if test="type!=null and type=='1'.toString()">-->
+<!--            and to_days(u.update_time) = to_days(now())-->
+<!--        </if>-->
+<!--        <if test="type!=null and type=='2'.toString()">-->
+<!--            and DATE_FORMAT(u.update_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )-->
+<!--        </if>-->
+<!--        GROUP BY d.dept_name,u.real_name,-->
+<!--        j.dept_name-->
+<!--    </select>-->
     <!--表现差的数量-->
+<!--    <select id="selectBx" resultType="java.util.HashMap">-->
+<!--        SELECT IFNULL(COUNT( * ),0) AS num,-->
+<!--        d.dept_name,-->
+<!--        j.dept_name AS jurname-->
+<!--        FROM sys_performance u-->
+<!--        LEFT JOIN blade_dept d ON d.id = u.departmentid-->
+<!--        LEFT JOIN sys_jurisdiction j ON j.id = u.jurisdiction-->
+<!--        WHERE score = 3-->
+<!--        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">-->
+<!--            and u.jurisdiction in(${jurisdiction})-->
+<!--        </if>-->
+<!--        <if test="deptid!=null and deptid!=''">-->
+<!--            and u.departmentid =#{deptid}-->
+<!--        </if>-->
+<!--        <if test="type!=null and type=='1'.toString()">-->
+<!--            and to_days(u.time) = to_days(now())-->
+<!--        </if>-->
+<!--        <if test="type!=null and type=='2'.toString()">-->
+<!--            and DATE_FORMAT(u.time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )-->
+<!--        </if>-->
+<!--        GROUP BY d.dept_name,-->
+<!--        j.dept_name-->
+<!--    </select>-->
     <select id="selectBx" resultType="java.util.HashMap">
-        SELECT IFNULL(COUNT( * ),0) AS num,
-        d.dept_name,
-        j.dept_name AS jurname
-        FROM sys_performance u
-        LEFT JOIN blade_dept d ON d.id = u.departmentid
-        LEFT JOIN sys_jurisdiction j ON j.id = u.jurisdiction
-        WHERE score = 3
-        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
-            and u.jurisdiction in(${jurisdiction})
-        </if>
-        <if test="deptid!=null and deptid!=''">
-            and u.departmentid =#{deptid}
-        </if>
+        SELECT
+        IFNULL( J.num, 0 ) AS num
+        FROM
+        ( SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction ) H
+        LEFT JOIN (
+        SELECT
+        IFNULL( COUNT( * ), 0 ) AS num,
+        u.dept_id
+        FROM
+        sys_performance p
+        INNER JOIN blade_user u ON p.securityId = u.id WHERE 1=1
         <if test="type!=null and type=='1'.toString()">
-            and to_days(u.time) = to_days(now())
+            and to_days(p.time) = to_days(now())
         </if>
         <if test="type!=null and type=='2'.toString()">
-            and DATE_FORMAT(u.time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
+            and DATE_FORMAT(p.time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
         </if>
-        GROUP BY d.dept_name,
-        j.dept_name
+        GROUP BY
+        dept_id
+        ) J ON J.dept_id = H.departmentid
+        WHERE 1 = 1
+        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
+            AND H.jurisdiction in(${jurisdiction})
+        </if>
+        <if test="deptid!=null and deptid!=''">
+            AND H.departmentid = #{deptid}
+        </if>
     </select>
 
 

--
Gitblit v1.9.3