From f63fff71fcd7a62ad73b0b9eda614f3b1fa3badf Mon Sep 17 00:00:00 2001
From: 钟日健 <5689795+arsn@user.noreply.gitee.com>
Date: Fri, 22 Oct 2021 22:51:09 +0800
Subject: [PATCH] 考试成绩修改状态重置

---
 src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml |  112 ++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 80 insertions(+), 32 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 224e874..cb3b390 100644
--- a/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
+++ b/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -177,16 +177,26 @@
         IFNULL( B.num, 0 ) AS bzc
         FROM
         (
-        SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction ) H
-        LEFT JOIN ( SELECT COUNT(*) AS num, u.dept_id FROM blade_user u WHERE (u.examination_type = 0 or
+        SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction
+        ) H
+        LEFT JOIN
+        ( SELECT COUNT(*) AS num, u.dept_id FROM blade_user u WHERE (u.examination_type = 0 or
         u.examination_type is null) and role_id =
         '1412226235153731586' AND `status` = 1 AND is_deleted = 0 GROUP BY u.dept_id
-        ) A ON H.departmentid = A.dept_id
-        LEFT JOIN ( SELECT COUNT(*) AS num, u.dept_id FROM blade_user u WHERE u.examination_type = 1  and role_id = '1412226235153731586' AND `status` = 1 AND is_deleted = 0 GROUP BY
+        ) A
+        ON H.departmentid = A.dept_id
+        LEFT JOIN
+        ( SELECT COUNT(*) AS num, u.dept_id FROM blade_user u WHERE u.examination_type = 1  and role_id = '1412226235153731586' AND `status` = 1 AND is_deleted = 0 GROUP BY
         u.dept_id
-        ) B ON H.departmentid = B.dept_id where 1=1
+        ) B
+        ON H.departmentid = B.dept_id
+        left join
+        sys_jurisdiction sj
+        on
+        sj.id = H.jurisdiction
+        where 1=1
         <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
-            and H.jurisdiction = #{jurisdiction}
+            and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
         </if>
         <if test="deptid!=null and deptid!=''">
             and H.departmentid = #{deptid}
@@ -203,7 +213,8 @@
         (
         SELECT departmentid,jurisdiction FROM sys_information GROUP BY departmentid,jurisdiction
         ) H
-        LEFT JOIN(
+        LEFT JOIN
+        (
         SELECT
         COUNT( * ) AS thisnum,
         dept_id
@@ -216,8 +227,10 @@
         AND hold = 1
         GROUP BY
         dept_id
-        ) A ON A.dept_id=H.departmentid
-        LEFT JOIN (
+        ) A
+        ON A.dept_id=H.departmentid
+        LEFT JOIN
+        (
         SELECT
         COUNT(*) AS lastnum,
         dept_id
@@ -230,13 +243,18 @@
         AND hold = 2
         GROUP BY
         dept_id
-        ) B ON B.dept_id=H.departmentid
+        ) B
+        ON B.dept_id=H.departmentid
+        left join
+        sys_jurisdiction sj
+        on
+        sj.id = H.jurisdiction
         where 1=1
+        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
+            and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
+        </if>
         <if test="deptid!=null and deptid!=''">
             and H.departmentid = #{deptid}
-        </if>
-        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
-            and H.jurisdiction = #{jurisdiction}
         </if>
     </select>
     <!--派遣服务单位统计-->
@@ -268,7 +286,8 @@
         AND dispatch = 0
         GROUP BY
         dept_id
-        ) A ON A.dept_id = H.departmentid
+        ) A
+        ON A.dept_id = H.departmentid
         LEFT JOIN (
         SELECT
         COUNT( * ) AS lastnum,
@@ -282,9 +301,15 @@
         AND dispatch = 1
         GROUP BY
         dept_id
-        ) B ON H.departmentid = B.dept_id where 1=1
+        ) B
+        ON H.departmentid = B.dept_id
+        left join
+        sys_jurisdiction sj
+        on
+        sj.id = H.jurisdiction
+        where 1=1
         <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
-            and H.jurisdiction = #{jurisdiction}
+            and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
         </if>
         <if test="deptid!=null and deptid!=''">
             and H.departmentid = #{deptid}
@@ -294,20 +319,38 @@
     <select id="selectSoil" resultType="java.util.HashMap">
         SELECT IFNULL(A.numj, 0) as numj,
         IFNULL(B.numwj, 0) as numz
-        FROM (SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction) H
-        LEFT JOIN (SELECT COUNT(*) AS numj, dept_id
+        FROM
+        (
+        SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction
+        ) H
+        LEFT JOIN
+        (
+        SELECT COUNT(*) AS numj, dept_id
         FROM blade_user
         WHERE soil = 0 AND `status` = 1 AND is_deleted = 0 AND role_id = '1412226235153731586'
-        GROUP BY dept_id) A ON A.dept_id = H.departmentid
-        LEFT JOIN (SELECT COUNT(*) AS numwj, dept_id FROM blade_user WHERE soil = 1 and `status` = 1 AND is_deleted = 0
-        AND role_id = '1412226235153731586' GROUP BY
-        dept_id) B
-        ON H.departmentid = B.dept_id where 1=1
+        GROUP BY dept_id
+        ) A
+        ON A.dept_id = H.departmentid
+        LEFT JOIN
+        (
+        SELECT COUNT(*) AS numwj, dept_id FROM blade_user
+        WHERE soil = 1
+        and `status` = 1
+        AND is_deleted = 0
+        AND role_id = '1412226235153731586'
+        GROUP BY dept_id
+        ) B
+        ON H.departmentid = B.dept_id
+        left join
+        sys_jurisdiction sj
+        on
+        sj.id = H.jurisdiction
+        where 1=1
+        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
+            and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
+        </if>
         <if test="deptid!=null and deptid!=''">
             and H.departmentid = #{deptid}
-        </if>
-        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
-            and H.jurisdiction = #{jurisdiction}
         </if>
     </select>
 
@@ -340,16 +383,21 @@
     <!--查询本年所有月份h合同开始时间的客户数量-->
     <select id="queryYearKh" resultType="java.util.HashMap">
         SELECT
-        start_time,
-        end_time
+        sdu.start_time,
+        sdu.end_time
         FROM
-        `sys_dispatcher_unit`
-        WHERE YEAR (end_time) >='2021'
+        sys_dispatcher_unit sdu
+        left join
+        sys_jurisdiction sj
+        on
+        sj.id = sdu.jurisdiction
+        where 1=1
+        and YEAR (end_time) >= #{year}
         <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
-            and jurisdiction =#{jurisdiction}
+            and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
         </if>
         <if test="deptid!=null and deptid!=''">
-            and dept_id =#{deptid}
+            and sdu.dept_id =#{deptid}
         </if>
     </select>
 </mapper>

--
Gitblit v1.9.3