From 41d8611f58087cf58254c9d2b9bf8e22c1f55169 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Thu, 07 Dec 2023 12:06:03 +0800
Subject: [PATCH] 保安员字段修改

---
 src/main/java/org/springblade/modules/system/mapper/UserMapper.xml |  144 ++++++++++++++----------------------------------
 1 files changed, 42 insertions(+), 102 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 c3aeaa3..64daf61 100644
--- a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -33,9 +33,6 @@
         <result column="height" property="height"/>
         <result column="cell" property="cell"/>
         <result column="emails" property="emails"/>
-        <result column="address" property="address"/>
-        <result column="registered" property="registered"/>
-        <result column="rtime" property="rtime"/>
         <result column="hold" property="hold"/>
         <result column="jurisdiction" property="jurisdiction"/>
         <result column="securitynumber" property="securitynumber"/>
@@ -57,35 +54,18 @@
         bu.*,IF(mod(SUBSTR(bu.cardid,17,1),2),1,2) sexs,
         ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age,
         sll.longitude,sll.latitude,
+        bud.unit_name,
         bd.dept_name
         from
         blade_user bu
-        left join
-        blade_dept bd
-        on
-        bu.dept_id = bd.id
-        left join
-        sys_information si
-        on
-        si.departmentid = bd.id
-        left join
-        sys_jurisdiction sj
-        on
-        sj.id = si.jurisdiction
-        left join
-        sys_live_location sll
-        on
-        sll.worker_id = bu.id
-        left join
-        blade_role br
-        on
-        br.id = bu.role_id
-        left join
-        sys_training_registration str
-        on
-        bu.id = str.user_id
-        where
-        bu.is_deleted = 0
+        left join blade_user_detail bud on bud.user_id = bu.id
+        left join blade_dept bd on bu.dept_id = bd.id
+        left join sys_information si on si.departmentid = bd.id
+        left join sys_jurisdiction sj on sj.id = si.jurisdiction
+        left join sys_live_location sll on sll.worker_id = bu.id
+        left join blade_role br on br.id = bu.role_id
+        left join sys_training_registration str on bu.id = str.user_id
+        where bu.is_deleted = 0
         <if test="user.examinationType!=null and user.examinationType != ''">
             <if test="user.examinationType == 0">
                 and (bu.examination_type = #{user.examinationType} or bu.examination_type is null or bu.examination_type ='')
@@ -187,7 +167,7 @@
             and bu.cardid like concat('%', #{user.cardid},'%')
         </if>
         <if test="user.unitName!=null and user.unitName != ''">
-            and bu.unit_name like concat('%', #{user.unitName},'%')
+            and bud.unit_name like concat('%', #{user.unitName},'%')
         </if>
         <if test="user.sortName!=null and user.sortName!=''">
             ORDER BY bu.${user.sortName} ${user.sort},bu.id desc
@@ -207,35 +187,18 @@
             bu.*,IF(mod(SUBSTR(bu.cardid,17,1),2),1,2) sexs,
             ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age,
             sll.longitude,sll.latitude,
+            bud.unit_name,
             bd.dept_name
             from
             blade_user bu
-            left join
-            blade_dept bd
-            on
-            bu.dept_id = bd.id
-            left join
-            sys_information si
-            on
-            si.departmentid = bd.id
-            left join
-            sys_jurisdiction sj
-            on
-            sj.id = si.jurisdiction
-            left join
-            sys_live_location sll
-            on
-            sll.worker_id = bu.id
-            left join
-            blade_role br
-            on
-            br.id = bu.role_id
-            left join
-            sys_training_registration str
-            on
-            bu.id = str.user_id
-            where
-            bu.is_deleted = 0
+            left join blade_user_detail bud on bud.user_id = bu.id
+            left join blade_dept bd on bu.dept_id = bd.id
+            left join sys_information si on si.departmentid = bd.id
+            left join sys_jurisdiction sj on sj.id = si.jurisdiction
+            left join sys_live_location sll on sll.worker_id = bu.id
+            left join blade_role br on br.id = bu.role_id
+            left join sys_training_registration str on bu.id = str.user_id
+            where bu.is_deleted = 0
             <if test="user.examinationType!=null and user.examinationType != ''">
                 <if test="user.examinationType == 0">
                     and (bu.examination_type = #{user.examinationType} or bu.examination_type is null or bu.examination_type ='')
@@ -299,7 +262,7 @@
                 and bu.real_name like concat('%', #{user.realName},'%')
             </if>
             <if test="user.unitName!=null and user.unitName != ''">
-                and bu.unit_name like concat('%', #{user.unitName},'%')
+                and bud.unit_name like concat('%', #{user.unitName},'%')
             </if>
             <if test="user.dispatch!=null and user.dispatch != ''">
                 <if test="user.dispatch == 0">
@@ -399,9 +362,6 @@
         <if test="user.nativeplace!=null and user.nativeplace != ''">
             and nativeplace = #{user.nativeplace}
         </if>
-        <if test="user.unitName!=null and user.unitName != ''">
-            and bu.unit_name like concat('%', #{user.unitName},'%')
-        </if>
         <if test="user.sex!=null and user.sex != ''">
             and sex = #{user.sex}
         </if>
@@ -466,16 +426,10 @@
         bu.*,IF(mod(SUBSTR(bu.cardid,17,1),2),1,2) sexs
         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
-        where
-        bu.is_deleted = 0
+        left join blade_user_detail bud on bud.user_id = bu.id
+        left join blade_dept bd on bu.dept_id = bd.id
+        left join blade_role br on br.id = bu.role_id
+        where bu.is_deleted = 0
         and role_alias = '保安'
         <if test="user.realName!=null and user.realName != ''">
             and bu.real_name like concat(concat('%', #{user.realName}),'%')
@@ -513,7 +467,7 @@
             and bu.jurisdiction = #{user.jurisdiction}
         </if>
         <if test="user.unitName!=null and user.unitName != ''">
-            and bu.unit_name like concat('%', #{user.unitName},'%')
+            and bud.unit_name like concat('%', #{user.unitName},'%')
         </if>
         <if test="user.securitynumber!=null and user.securitynumber != ''">
             and bu.securitynumber = #{user.securitynumber}
@@ -527,18 +481,11 @@
         bd.dept_name
         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
-        where
-        bu.is_deleted = 0
-        and
-        (hold = 2 or hold = 3)
+        left join blade_user_detail bud on bud.user_id = bu.id
+        left join blade_dept bd on bu.dept_id = bd.id
+        left join blade_role br on br.id = bu.role_id
+        where bu.is_deleted = 0
+        and (hold = 2 or hold = 3)
         and br.role_alias = "保安"
         <if test="user.deptId!=null and user.deptId != ''">
             and bu.dept_id = #{user.deptId}
@@ -559,7 +506,7 @@
             and bu.real_name like concat('%', #{user.realName},'%')
         </if>
         <if test="user.unitName!=null and user.unitName != ''">
-            and bu.unit_name like concat('%', #{user.unitName},'%')
+            and bud.unit_name like concat('%', #{user.unitName},'%')
         </if>
         <if test="user.userType!=null and user.userType != ''">
             and bu.user_type = #{user.userType}
@@ -883,23 +830,16 @@
         select
         distinct bu.id,
         bd.dept_name deptId,
-        bu.real_name realName,
-        bu.phone,
-        if(IF(mod(SUBSTR(bu.cardid,17,1),2),1,2)=1,"男","女") sex,
-        bu.cardid,
-        bu.nation,
-        bu.registered,
-        bu.unit_name unitName,
-        case when bu.education=1 then '初中及以下'
-        when bu.education=2 then '高中/中技/中专'
-        when bu.education=3 then '大专'
-        when bu.education=4 then '本科'
-        when bu.education=5 then '博士'
-        when bu.education=6 then '硕士'
-        else '' end as education,
-        bu.politicaloutlook,
-        bu.address
-        from blade_user bu left join blade_dept bd on bu.dept_id = bd.id
+        bu.real_name realName,if(IF(mod(SUBSTR(bu.cardid,17,1),2),1,2)=1,"男","女") sex,
+        bu.phone,bu.cardid,bu.nation,bu.education,bu.politicaloutlook,
+        bud.unit_name unitName,bud.marriage_status marriageStatus,bud.sign_level signLevel,
+        bud.permanent_residence_address permanentResidenceAddress,bud.dwell_address dwellAddress,
+        bud.member_of_family memberOfFamily,bud.work_experience workExperience,
+        bud.education_experience educationExperience,bud.acceptance_police_unit acceptancePoliceUnit,
+        bud.acceptance_person acceptancePerson,bud.acceptance_time acceptanceTime
+        from blade_user bu
+        left join blade_user_detail bud on bud.user_id = bu.id and bud.is_deleted = 0
+        left join blade_dept bd on bu.dept_id = bd.id and bd.is_deleted = 0
         left join sys_information si on si.departmentid = bd.id
         left join sys_jurisdiction sj on sj.id = si.jurisdiction
         left join blade_role br on br.id = bu.role_id
@@ -923,7 +863,7 @@
             and bu.is_freeze = #{user.isFreeze}
         </if>
         <if test="user.unitName!=null and user.unitName != ''">
-            and bu.unit_name like concat('%', #{user.unitName},'%')
+            and bud.unit_name like concat('%', #{user.unitName},'%')
         </if>
         <if test="user.isFingerprint==1">
             and bu.fingerprint is not null and bu.fingerprint!=""

--
Gitblit v1.9.3