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/system/mapper/DeptMapper.xml |   56 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 48 insertions(+), 8 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 4f2f16f..2f1b47f 100644
--- a/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
@@ -117,7 +117,11 @@
             blade_dept
             where is_deleted = 0
             and
-            (id = 1413470343230877697 or id = 1425366663452196865 or id = 1418458374477549569 or id = 1420222768149966850)
+            (id = 1413470343230877697
+            or id = 1425366663452196865
+            or id = 1418458374477549569
+            or id = 1420222768149966850
+            or id = 1426354978959691778)
         )
            union
         (
@@ -142,17 +146,16 @@
             sys_information si
             on
             si.departmentid = dept.id
+            left join
+            sys_jurisdiction sj
+            on
+            sj.id = si.jurisdiction
             WHERE
             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 test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
+                and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
             </if>
         )
     </select>
@@ -618,4 +621,41 @@
     <select id="selDeptList" resultType="org.springblade.common.vo.DeptVo">
         select id ,dept_name deptName from blade_dept where is_deleted=0
     </select>
+
+    <!--懒加载获取部门树形结构,根据辖区查询-->
+    <select id="lazyTreeJurisdiction" resultMap="treeNodeResultMap" >
+        SELECT
+        DISTINCT
+        dept.id,
+        dept.parent_id,
+        dept.dept_name AS title,
+        dept.id AS "value",
+        dept.id AS "key",
+        (
+        SELECT
+        CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
+        FROM
+        blade_dept
+        WHERE
+        parent_id = dept.id and is_deleted = 0
+        ) AS "has_children"
+        FROM
+        blade_dept dept
+        left join
+        sys_information si
+        on
+        si.departmentid = dept.id
+        left join
+        sys_jurisdiction sj
+        on
+        sj.id = si.jurisdiction
+        WHERE
+        dept.is_deleted = 0
+        <if test="param2!=null and param2!=0">
+            and dept.parent_id = #{param2}
+        </if>
+        <if test="param1!=null and param1!='' and param1!='1372091709474910209'">
+            and (sj.id = #{param1} or sj.parent_id = #{param1})
+        </if>
+    </select>
 </mapper>

--
Gitblit v1.9.3