From 62eb499b0c969f246d3245d1429a97da4de1ce28 Mon Sep 17 00:00:00 2001
From: 钟日健 <arsn163@163.com>
Date: Mon, 01 Jun 2026 20:46:13 +0800
Subject: [PATCH] feat: 成绩查询增加年龄查询返回

---
 src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherUnitMapper.xml |  123 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 120 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..b66dee0 100644
--- a/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherUnitMapper.xml
+++ b/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherUnitMapper.xml
@@ -16,8 +16,16 @@
             sys_jurisdiction sj
         on
             sj.id = sdu.jurisdiction
+        LEFT JOIN blade_dict_biz bdb ON bdb.dict_key = sdu.profession and  bdb.is_deleted = 0
         WHERE
             1=1
+        and bdb.code = 'dispatchProfession'
+        <if test="dispatcherUnit.profession != null and dispatcherUnit.profession !=''">
+            and sdu.profession in
+            <foreach collection="dispatcherUnit.profession.split(',')" index="index" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
         <if test="dispatcherUnit.deptName!=null and  dispatcherUnit.deptName!=''">
             and bt.dept_name like concat('%', #{dispatcherUnit.deptName},'%')
         </if>
@@ -36,11 +44,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,8 +77,99 @@
                 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>
 
+    <select id="getAll" resultType="org.springblade.modules.dispatcher.vo.DispatcherUnitVO">
+        select
+        sdu.*,bt.dept_name deptName,sj.dept_name jurisdictionName,bdb.dict_value as professionName
+        from
+        sys_dispatcher_unit sdu
+        LEFT JOIN
+        blade_dept bt
+        ON
+        sdu.dept_id = bt.id
+        left join
+        sys_jurisdiction sj
+        on
+        sj.id = sdu.jurisdiction
+        LEFT JOIN blade_dict_biz bdb ON bdb.dict_key = sdu.profession and  bdb.is_deleted = 0
+        WHERE
+        1=1
+        and bdb.code = 'dispatchProfession'
+        <if test="dispatcherUnit.profession != null and dispatcherUnit.profession !=''">
+            and sdu.profession in
+            <foreach collection="dispatcherUnit.profession.split(',')" index="index" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="dispatcherUnit.deptName!=null and  dispatcherUnit.deptName!=''">
+            and bt.dept_name like concat('%', #{dispatcherUnit.deptName},'%')
+        </if>
+        <if test="dispatcherUnit.name!=null and  dispatcherUnit.name!=''">
+            and sdu.name like concat('%', #{dispatcherUnit.name},'%')
+        </if>
+        <if test="dispatcherUnit.linkman!=null and  dispatcherUnit.linkman!=''">
+            and sdu.linkman like concat('%', #{dispatcherUnit.linkman},'%')
+        </if>
+        <if test="dispatcherUnit.phone!=null and  dispatcherUnit.phone!=''">
+            and sdu.phone like concat('%', #{dispatcherUnit.phone},'%')
+        </if>
+        <if test="dispatcherUnit.province!=null">
+            and sdu.province = #{dispatcherUnit.province}
+        </if>
+        <if test="dispatcherUnit.city!=null">
+            and sdu.city = #{dispatcherUnit.city}
+        </if>
+        <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 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}
+        </if>
+        <if test="dispatcherUnit.beginTime!=null or dispatcherUnit.overTime!=null">
+            <if test="dispatcherUnit.beginTime!='' or dispatcherUnit.overTime!=''">
+                and sdu.end_time &lt;= #{dispatcherUnit.overTime} and sdu.end_time &gt;= #{dispatcherUnit.beginTime}
+                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>
+
+
     <!--自定义树-->
     <select id="selectDispatcherUnitPageTree" resultType="org.springblade.modules.dispatcher.vo.DispatcherUnitVO">
         select

--
Gitblit v1.9.3