From a4ff6ea9260c42293cb0d37b4e93ce45c9f61bf7 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Sat, 09 Dec 2023 10:09:34 +0800
Subject: [PATCH] 无用字段去除
---
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml | 164 +++++++++++++++++++-----------------------------------
1 files changed, 57 insertions(+), 107 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 0f1148c..ed51ff6 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!=""
@@ -1044,16 +984,17 @@
(id,
tenant_id,account,password,name,real_name,avatar,email,phone,sex,
role_id,dept_id,cardid,nativePlace,nation,fingerprint,education,
- politicaloutlook,healstats,height,address,registered,securitynumber,
- hold,jurisdiction,examination_type,status,is_deleted,dispatch,create_time,unit_name
+ politicaloutlook,healstats,height,securitynumber,
+ hold,jurisdiction,examination_type,status,is_deleted,dispatch,create_time
)
values
<foreach collection="list" item="user" separator=",">
- (#{user.id},
+ (
+ #{user.id},
#{user.tenantId},#{user.account},#{user.password},#{user.name},#{user.realName},#{user.avatar},#{user.email},#{user.phone},#{user.sex},
#{user.roleId},#{user.deptId},#{user.cardid},#{user.nativeplace},#{user.nation},#{user.fingerprint},#{user.education},
- #{user.politicaloutlook},#{user.healstats},#{user.height},#{user.address},#{user.registered},#{user.securitynumber},
- #{user.hold},#{user.jurisdiction},#{user.examinationType},#{user.status},#{user.isDeleted},#{user.dispatch},#{user.createTime},#{user.unitName}
+ #{user.politicaloutlook},#{user.healstats},#{user.height},#{user.securitynumber},
+ #{user.hold},#{user.jurisdiction},#{user.examinationType},#{user.status},#{user.isDeleted},#{user.dispatch},#{user.createTime}
)
</foreach>
</insert>
@@ -1198,5 +1139,14 @@
and bu.id = #{id}
</select>
+ <!--查询未关联的保安员-->
+ <select id="getNotGlList" resultType="org.springblade.modules.system.entity.User">
+ select bu.* from blade_user bu
+ left join blade_user_detail bud on bu.id = bud.user_id and bud.is_deleted = 0
+ where bu.is_deleted = 0
+ and bu.role_id = '1412226235153731586'
+ and bud.id is null
+ </select>
+
</mapper>
--
Gitblit v1.9.3