From f122d0833830dcfdea4eac8f664ab2d96ee8ec13 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Fri, 03 Dec 2021 15:12:26 +0800
Subject: [PATCH] 1.首页押运人员

---
 src/main/java/org/springblade/modules/system/mapper/UserMapper.xml |   66 ++++++++++++++++++++++++++++++++
 1 files changed, 65 insertions(+), 1 deletions(-)

diff --git a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
index 9210673..85a88ef 100644
--- a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -257,8 +257,11 @@
         <if test="user.securitynumber!=null and user.securitynumber != ''">
             and bu.securitynumber like concat('%', #{user.securitynumber},'%')
         </if>
-        <if test="user.deptId!=null and user.deptId!=''">
+        <if test="user.deptId!=null and user.deptId!='' and user.deptId!='1460129345988239362'">
             and bu.dept_id =#{user.deptId}
+        </if>
+        <if test="user.type!=null">
+            and bu.equipment_code is not null
         </if>
         <if test="user.useName==null or user.useName==''">
             order by bu.id
@@ -341,4 +344,65 @@
         and status = 1
     </select>
 
+
+
+    <select id="selectPeo" resultType="java.util.HashMap">
+        select
+        bu.*,
+        ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING( bu.cardid,7,4),0) age,
+        bd.dept_name as deptName
+        from
+        blade_user bu
+        left join
+        blade_dept bd
+        on
+        bu.dept_id = bd.id
+        left join
+        blade_role br
+        on
+        br.id = bu.role_id
+        left join
+        sys_information si
+        on
+        si.departmentid = bd.id
+        left join
+        sys_jurisdiction sj
+        on
+        sj.id = si.jurisdiction
+        where
+        bu.is_deleted = 0
+        and
+        br.role_alias = "安保人员"
+        and
+        bu.status = 1
+        and bd.parent_id!=1425365577303621633
+        and bd.id != 1425365577303621633
+        and bd.id != 1432625856013971457
+        <if test="user.deptId!=null and user.deptId!='' and user.deptId!='1460129345988239362'">
+            and bd.id in
+            (
+            select id from blade_dept where id = #{user.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 := #{user.deptId} ) t2
+            ) t3
+            WHERE
+            ischild != 0
+            )
+        </if>
+        <if test="user.type!=null">
+            and bu.equipment_code is not null
+        </if>
+
+    </select>
+
 </mapper>

--
Gitblit v1.9.3