From 8853292babb2ad94de4a3207966f1e83b767cd2d Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Sun, 17 Sep 2023 16:38:34 +0800
Subject: [PATCH] 新增流程节点进程查询接口

---
 src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherUnitMapper.xml |   31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherUnitMapper.xml b/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherUnitMapper.xml
index 04bcd38..d39ef92 100644
--- a/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherUnitMapper.xml
+++ b/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherUnitMapper.xml
@@ -36,11 +36,29 @@
         <if test="dispatcherUnit.city!=null">
             and sdu.city = #{dispatcherUnit.city}
         </if>
-        <if test="dispatcherUnit.jurisdiction!=null">
-            and sdu.jurisdiction = #{dispatcherUnit.jurisdiction}
+        <if test="dispatcherUnit.jurisdiction!=null and dispatcherUnit.jurisdiction!='' and dispatcherUnit.jurisdiction!='1372091709474910209'">
+            and (sj.id = #{dispatcherUnit.jurisdiction} or sj.parent_id = #{dispatcherUnit.jurisdiction})
         </if>
         <if test="dispatcherUnit.deptId!=null and dispatcherUnit.deptId!=''">
-            and sdu.dept_id = #{dispatcherUnit.deptId}
+            and sdu.dept_id in
+            (
+                select id from blade_dept where id = #{dispatcherUnit.deptId}
+                union
+                SELECT
+                id
+                FROM
+                (
+                SELECT
+                t1.id,t1.parent_id,t1.dept_name,
+                IF
+                ( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
+                FROM
+                ( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
+                ( SELECT @pids := #{dispatcherUnit.deptId} ) t2
+                ) t3
+                WHERE
+                ischild != 0
+            )
         </if>
         <if test="dispatcherUnit.district!=null">
             and sdu.district = #{dispatcherUnit.district}
@@ -51,6 +69,13 @@
                 or ( sdu.start_time &lt;= #{dispatcherUnit.overTime} and sdu.start_time &gt;= #{dispatcherUnit.beginTime})
             </if>
         </if>
+        <if test="dispatcherUnit.isExpire==1">
+            and sdu.start_time &lt;= now()
+            and sdu.end_time &gt; now()
+        </if>
+        <if test="dispatcherUnit.isExpire==2">
+            and sdu.end_time &lt;= now()
+        </if>
     </select>
 
     <!--自定义树-->

--
Gitblit v1.9.3