From daaf2caafd40f3657aa1f7e45bc1641d482baeb1 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Fri, 01 Dec 2023 16:54:10 +0800
Subject: [PATCH] 保安员详情信息新增,修改,删除调整
---
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml | 121 +++++++++++++++++++++++-----------------
1 files changed, 70 insertions(+), 51 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 80dfff4..0f1148c 100644
--- a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -127,8 +127,11 @@
<if test="user.roleAlias!=null and user.roleAlias != ''">
and br.role_alias = '保安'
</if>
- <if test="user.status!=null and user.status != '' and user.status != 6">
+ <if test="user.status!=null and user.status != 6">
and bu.status = #{user.status}
+ </if>
+ <if test="user.isFreeze!=null">
+ and bu.is_freeze = #{user.isFreeze}
</if>
<if test="user.education!=null and user.education != ''">
and bu.education = #{user.education}
@@ -244,6 +247,9 @@
<if test="user.account!=null and user.account != ''">
and bu.account like concat('%', #{user.account},'%')
</if>
+ <if test="user.isFreeze!=null">
+ and bu.is_freeze = #{user.isFreeze}
+ </if>
<if test="user.hold!=null and user.hold != ''">
and bu.hold = #{user.hold}
</if>
@@ -356,6 +362,9 @@
</if>
<if test="user.account!=null and user.account != ''">
and account like concat('%', #{user.account},'%')
+ </if>
+ <if test="user.isFreeze!=null">
+ and bu.is_freeze = #{user.isFreeze}
</if>
<if test="user.roleId!=null and user.roleId != ''">
and (br.role_alias = '公安管理员' or br.role_alias = '民警')
@@ -483,6 +492,9 @@
<if test="user.sex!=null and user.sex != ''">
and bu.sex = #{user.sex}
</if>
+ <if test="user.isFreeze!=null">
+ and bu.is_freeze = #{user.isFreeze}
+ </if>
<if test="user.dispatch!=null and user.dispatch != ''">
<if test="user.dispatch==1">
and (bu.dispatch = #{user.dispatch} or bu.dispatch is null)
@@ -537,6 +549,9 @@
<if test="user.roleId!=null and user.roleId != ''">
and bu.role_id = #{user.roleId}
</if>
+ <if test="user.isFreeze!=null">
+ and bu.is_freeze = #{user.isFreeze}
+ </if>
<if test="user.status!=null and user.status != ''">
and bu.status = #{user.status}
</if>
@@ -558,55 +573,40 @@
<!--保安员列表树 安员列表树,帅选无保安证,下拉tree-->
<select id="getSecurityApplyTree" resultType="org.springblade.modules.system.node.TreeNode">
- (
- select #{user.deptId} as id,
- '全部' as name,
- 0 as parentId
- from blade_user
- )
-
- union all
-
- (
+ select
+ a.id,
+ a.name,
+ a.type,
+ a.parentId
+ from (
select
- a.id,
- a.name,
- a.parentId
- from (
- select
- distinct
- bu.id,
- ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age,
- bu.is_apply isApply,
- bu.is_train isTrain,
- bu.real_name as name,
- #{user.deptId} parentId
- 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 bu.status = 1
- and (bu.examination_type != 1 or bu.examination_type is null)
- and (hold = 2 or hold = 3)
- and bd.id = #{user.deptId}
- and br.role_alias = '保安'
- ) a
- where 1 = 1
- <if test="user.examType==1">
- and a.isApply != 1
- </if>
- <if test="user.examType==2">
- and a.isTrain != 1
- </if>
- )
+ distinct
+ bu.id,
+ ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age,
+ bu.is_apply isApply,
+ bu.is_train isTrain,
+ bu.real_name as name,
+ if(es.user_id is not null,1,2) as type,
+ #{user.deptId} parentId
+ 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 (select user_id,max(id) from exam_score where (qualified =1 or qualified =3) GROUP BY user_id) es
+ on es.user_id = bu.id
+ where
+ bu.is_deleted = 0 and bu.status = 1 and bu.is_freeze = 0
+ and (bu.examination_type != 1 or bu.examination_type is null)
+ and (hold = 2 or hold = 3)
+ and bd.id = #{user.deptId}
+ and br.role_alias = '保安'
+ ) a
+ where 1 = 1
+ <if test="user.examType==1">
+ and a.isApply != 1
+ </if>
+ <if test="user.examType==2">
+ and a.isTrain != 1
+ </if>
</select>
@@ -673,6 +673,7 @@
</if>
and bu.status = 1
and bu.is_deleted = 0
+ and bu.is_freeze = 0
</select>
@@ -918,6 +919,9 @@
<if test="user.isAvatar==2">
and (bu.avatar is null or bu.avatar="")
</if>
+ <if test="user.isFreeze!=null">
+ and bu.is_freeze = #{user.isFreeze}
+ </if>
<if test="user.unitName!=null and user.unitName != ''">
and bu.unit_name like concat('%', #{user.unitName},'%')
</if>
@@ -1133,7 +1137,7 @@
<!--根据手机号获取用户信息-->
<select id="getUserByPhone" resultType="org.springblade.modules.system.entity.User">
select * from blade_user where is_deleted = 0 and status = 1
- and tenant_id = #{tenantId} and phone = #{phone}
+ and tenant_id = #{tenantId} and phone = #{phone} limit 1
</select>
<!--按天查询 day 天未登录的人员ids集合信息-->
@@ -1149,7 +1153,7 @@
<!--用户冻结操作-->
<update id="updateFreeze">
- update blade_user set is_deleted = 1
+ update blade_user set is_freeze = 1
<choose>
<when test="list!=null and list.size()>0">
where id in
@@ -1179,5 +1183,20 @@
</choose>
</update>
+ <!--判断是否报名-->
+ <select id="getUserIsApply" resultType="org.springblade.modules.system.entity.User">
+ select bu.* from blade_user bu
+ left join blade_role br on br.id = bu.role_id
+ where bu.is_deleted = 0 and bu.status = 1 and bu.id = #{id}
+ and br.role_alias = '保安'
+ </select>
+
+ <!--自定义查询详情信息-->
+ <select id="getUserDetailById" resultType="org.springblade.modules.system.vo.UserVO">
+ select bu.* from blade_user bu
+ where bu.is_deleted = 0
+ and bu.id = #{id}
+ </select>
+
</mapper>
--
Gitblit v1.9.3