From cc057177b2fb17aee9a173a6adbabdc578fd74c7 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Mon, 06 Dec 2021 10:30:44 +0800
Subject: [PATCH] 1.许可

---
 src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.xml |   78 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 77 insertions(+), 1 deletions(-)

diff --git a/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.xml b/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.xml
index 8160c0c..3d3a032 100644
--- a/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.xml
+++ b/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.xml
@@ -15,22 +15,39 @@
     <!--派遣记录分页数据-->
     <select id="selectDispatcherPage" resultType="org.springblade.modules.dispatcher.vo.DispatcherVO">
         select
-            sd.*,sdu.name dispatcherCompany
+            sd.*,bu.real_name securityName,sdu.name dispatcherCompany,bu.cardid idCardNo
         from
             sys_dispatcher sd
         left join
             sys_dispatcher_unit sdu
         on
             sdu.id = sd.dispatcher_unit_id
+        left join
+            blade_user bu
+        on
+            bu.id = sd.user_ids
+        left join
+            sys_information si
+        on
+            si.departmentid = bu.dept_id
         where 1=1
+        and bu.is_deleted = 0
+        and bu.status = 1
         <if test="dispatcher.dispatcherUnitId!=null">
             and sd.dispatcher_unit_id = #{dispatcher.dispatcherUnitId}
         </if>
         <if test="dispatcher.deptId!=null">
             and sd.dept_id = #{dispatcher.deptId}
         </if>
+        <if test="dispatcher.dispatch!=null and dispatcher.dispatch!=''">
+            and bu.dispatch = #{dispatcher.dispatch}
+            and sd.status = #{dispatcher.dispatch}
+        </if>
         <if test="dispatcher.userIds!=null and  dispatcher.userIds!=''">
             and sd.user_ids like concat('%', #{dispatcher.userIds},'%')
+        </if>
+        <if test="dispatcher.jurisdiction!=null and  dispatcher.jurisdiction!='' and  dispatcher.jurisdiction!='1372091709474910209' ">
+            and si.jurisdiction = #{dispatcher.jurisdiction}
         </if>
         <if test="dispatcher.name!=null and  dispatcher.name!=''">
             and sd.name like concat('%', #{dispatcher.name},'%')
@@ -40,6 +57,43 @@
         </if>
         <if test="dispatcher.dispatcherCompany!=null and  dispatcher.dispatcherCompany!=''">
             and sdu.name like concat('%', #{dispatcher.dispatcherCompany},'%')
+        </if>
+        <if test="dispatcher.beginTime!=null or dispatcher.overTime!=null">
+            <if test="dispatcher.beginTime!='' or dispatcher.overTime!=''">
+                and sd.end_time &lt;= #{dispatcher.overTime} and sd.end_time &gt;= #{dispatcher.beginTime}
+                or ( sd.dispatcherTime &lt;= #{dispatcher.overTime} and sd.dispatcherTime &gt;= #{dispatcher.beginTime})
+            </if>
+        </if>
+        order by sd.id desc
+    </select>
+    <!--  app从业单位查询  -->
+    <select id="queryDispatcher" resultType="org.springblade.modules.dispatcher.vo.DispatcherVO">
+        select
+        sd.*,bu.real_name securityName
+        ,sdu.name dispatcherCompany
+        ,sdu.address dispatcherAddress
+        ,sdu.linkman dispatcherPerson
+        ,sdu.phone dispatcherPhone
+        ,bu.cardid idCardNo
+        from
+        sys_dispatcher sd
+        left join
+        sys_dispatcher_unit sdu
+        on
+        sdu.id = sd.dispatcher_unit_id
+        left join
+        blade_user bu
+        on
+        bu.id = sd.user_ids
+        left join
+        sys_information si
+        on
+        si.departmentid = bu.dept_id
+        where 1=1
+        and bu.is_deleted = 0
+        and bu.status = 1
+        <if test="dispatcher.userIds!=null and  dispatcher.userIds!=''">
+            and sd.user_ids like concat('%', #{dispatcher.userIds},'%')
         </if>
     </select>
 
@@ -59,4 +113,26 @@
         </if>
     </select>
 
+    <!--派遣记录条数-->
+    <select id="getDispatcherCount" resultType="java.lang.Integer">
+        select ifnull(count(*),0) count from sys_dispatcher
+        where
+        1=1
+        and dispatcher_unit_id = #{dispatcherUnitVO1.id}
+    </select>
+
+    <!--查询用的派遣信息-->
+    <select id="getDispatcherInfoByUserId" resultType="org.springblade.modules.dispatcher.vo.DispatcherVO">
+        select
+            sd.*
+        from
+            sys_dispatcher sd
+        left join
+            sys_dispatcher_unit sdu
+        on
+            sdu.id = sd.dispatcher_unit_id
+        where sd.user_ids = #{userId}
+        and sd.status = 0
+    </select>
+
 </mapper>

--
Gitblit v1.9.3