From 345d17cf82e1bbc1fbfbeec10193c2bed59cd674 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 27 Sep 2021 22:21:21 +0800
Subject: [PATCH] 注册登录,车辆,装备,枪支,招聘,培训考试修改

---
 src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 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..0278850 100644
--- a/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
@@ -618,4 +618,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