From 804764fa08951636d118377923c7fddfccc4f643 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Sat, 04 Dec 2021 16:28:41 +0800
Subject: [PATCH] 保安员查询修改
---
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml | 276 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 273 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml b/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
index 90047f3..1b32503 100644
--- a/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
+++ b/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -1354,9 +1354,13 @@
GROUP BY
dept_id
) J ON J.dept_id = H.departmentid
+ left join
+ sys_jurisdiction sj
+ on
+ sj.id = H.jurisdiction
WHERE 1 = 1
<if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
- AND H.jurisdiction in(${jurisdiction})
+ AND (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
</if>
<if test="deptid!=null and deptid!=''">
AND H.departmentid = #{deptid}
@@ -2513,7 +2517,7 @@
and (sj.id = #{information.jurisdiction} or sj.parent_id = #{information.jurisdiction})
</if>
<if test="information.departmentid!=null and information.departmentid!=''">
- and c.departmentid = #{information.departmentid}
+ and c.dept_id = #{information.departmentid}
</if>
</select>
@@ -3009,7 +3013,7 @@
and (sj.id = #{information.jurisdiction} or sj.parent_id = #{information.jurisdiction})
</if>
) b
- where b.znum < 2
+ where b.znum < #{information.proportion}
<if test="information.departmentid!=null and information.departmentid!=''">
and b.departmentid = #{information.departmentid}
</if>
@@ -3051,6 +3055,42 @@
) b
on
a.id = b.parent_id
+ union all
+ (
+ select a.id,
+ a.dept_name name,
+ ifnull(b.count, 0) num
+ from (select id, dept_name from sys_jurisdiction where parent_id = 1372091709474910209) a
+ left join
+ (
+ select sj.id,
+ sj.parent_id,
+ count(*) count
+ from sys_performance sp
+ left join
+ blade_user bu
+ on
+ bu.id = sp.securityId
+ left join
+ sys_information si
+ on
+ bu.dept_id = si.departmentid
+ left join
+ sys_jurisdiction sj
+ on
+ sj.id = si.jurisdiction
+ where
+ 1=1
+ and (si.stats = 2
+ or si.stats =4)
+ and bu.is_deleted = 0
+ and bu.`status` = 1
+ and sp.score = 3
+ group by si.jurisdiction
+ ) b
+ on
+ a.id = b.id
+ )
</select>
@@ -3084,6 +3124,37 @@
) b
on
a.id = b.parent_id
+ union all
+ (
+ select a.id, a.dept_name name, ifnull(b.count, 0) num
+ from (select id, dept_name from sys_jurisdiction where parent_id = 1372091709474910209) a
+ left join
+ (
+ select sj.id,
+ sj.parent_id,
+ count(*) count
+ from
+ blade_user bu
+ left join
+ sys_information si
+ on
+ bu.dept_id = si.departmentid
+ left join
+ sys_jurisdiction sj
+ on
+ sj.id = si.jurisdiction
+ where
+ 1=1
+ and (si.stats = 2
+ or si.stats =4)
+ and bu.is_deleted = 0
+ and bu.`status` = 1
+ and bu.examination_type = 1
+ group by si.jurisdiction
+ ) b
+ on
+ a.id = b.id
+ )
</select>
@@ -3149,6 +3220,69 @@
) f
on
g.id = f.parent_id
+ union all
+ (
+ select g.id, g.dept_name name, ifnull(f.count, 0) num
+ from (select id, dept_name from sys_jurisdiction where parent_id = 1372091709474910209) g
+ left join
+ (
+ select e.id, e.parent_id, count(*) count
+ from (
+ select d.*, ifnull(FORMAT((num2/num1)*100, 2), 0) num3, sj.* from (
+ select a.dept_id, ifnull(b.count, 0) num1, ifnull(c.count, 0) num2 from
+ (
+ select
+ bu.dept_id, ifnull(count (*), 0) count
+ from blade_user bu
+ left join blade_role br
+ on bu.role_id = br.id
+ where
+ role_alias = "安保人员"
+ and bu.is_deleted = 0
+ and bu.`status` = 1
+ group by dept_id
+ ) a
+ left join
+ (
+ select count (*) count, bu.dept_id from
+ exam_score es
+ left join
+ blade_user bu
+ on
+ bu.id = es.user_id
+ where 1=1 group by bu.dept_id
+ ) b
+ on
+ a.dept_id = b.dept_id
+ left join
+ (
+ select count (*) count, bu.dept_id from
+ exam_score es
+ left join
+ blade_user bu
+ on
+ bu.id = es.user_id
+ where qualified = 0 group by bu.dept_id
+ ) c
+ on a.dept_id = c.dept_id
+ ) d
+ left join
+ sys_information si
+ on
+ si.departmentid = d.dept_id
+ left join
+ sys_jurisdiction sj
+ on
+ sj.id = si.jurisdiction
+ where d.num1!=0
+ and (stats = 2 or stats=4)
+ ) e
+ where e.num3 < 50
+ group by e.id
+ ) f
+ on
+ g.id = f.id
+ )
</select>
<!--持证率低于50%,社保缴纳率低于50%,派遣率低于50%-->
@@ -3280,6 +3414,142 @@
) f
on
g.id = f.parent_id
+
+ union all
+ (
+ select g.id,g.dept_name name,ifnull(f.count,0) num
+ from
+ (select id,dept_name from sys_jurisdiction where parent_id = 1372091709474910209) g
+ left join
+ (
+ select c.id,c.parent_id,count(*) count from (
+ select si.enterpriseName,sj.id,sj.parent_id,a.dept_id,ifnull(a.count,0) num1,ifnull(b.count,0)
+ num2,ifnull(FORMAT((b.count/a.count)*100,2),0) num3 from
+ (
+ select
+ bu.dept_id,ifnull(count(*),0) count
+ from blade_user bu
+ left join blade_role br
+ on bu.role_id = br.id
+ where
+ role_alias = "安保人员"
+ and bu.is_deleted = 0
+ and bu.`status` = 1
+ group by dept_id
+ ) a
+ left join
+ (
+ select
+ bu.dept_id,ifnull(count(*),0) count
+ from blade_user bu
+ left join blade_role br
+ on bu.role_id = br.id
+ where
+ role_alias = "安保人员"
+ and bu.is_deleted = 0
+ and bu.`status` = 1
+ <if test="type==1">
+ and bu.hold = 1
+ </if>
+ <if test="type==2">
+ and bu.dispatch = 0
+ </if>
+ <if test="type==3">
+ and bu.soil = 0
+ </if>
+ group by dept_id
+ ) b
+ on
+ a.dept_id = b.dept_id
+ left join
+ sys_information si
+ on
+ a.dept_id = si.departmentid
+ left join
+ sys_jurisdiction sj
+ on
+ sj.id = si.jurisdiction
+ where 1=1
+ and (stats = 2 or stats=4)
+ )c
+ where c.num3 < 50
+ group by c.id
+ ) f
+ on
+ g.id = f.id
+ )
+ </select>
+
+ <!--保安员列表-->
+ <select id="selectUserPageSecurity" resultMap="userResultMaps">
+ 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
+ where
+ bu.is_deleted = 0
+ and
+ br.role_alias = '安保人员'
+ and
+ bu.status = 1
+ <if test="user.cardid!=null and user.cardid != ''">
+ and bu.cardid like concat(concat('%', #{user.cardid}),'%')
+ </if>
+ <if test="user.examinationType==0">
+ and (bu.examination_type = #{user.examinationType} or bu.examination_type is null or bu.examination_type="")
+ </if>
+ <if test="user.examinationType==1">
+ and bu.examination_type = #{user.examinationType}
+ </if>
+ <if test="user.realName!=null and user.realName != ''">
+ and bu.real_name like concat(concat('%', #{user.realName}),'%')
+ </if>
+ <if test="user.userType!=null and user.userType != ''">
+ and bu.user_type = #{user.userType}
+ </if>
+ <if test="user.nativeplace!=null and user.nativeplace != ''">
+ and bu.nativeplace = #{user.nativeplace}
+ </if>
+ <if test="user.sex!=null and user.sex != ''">
+ and bu.sex = #{user.sex}
+ </if>
+ <if test="user.status!=null and user.status != ''">
+ and bu.status = #{user.status}
+ </if>
+ <if test="user.hold!=null and user.hold != ''">
+ and bu.hold = #{user.hold}
+ </if>
+ <if test="user.jurisdiction!=null and user.jurisdiction != ''">
+ and bu.jurisdiction = #{user.jurisdiction}
+ </if>
+ <if test="user.securitynumber!=null and user.securitynumber != ''">
+ and bu.securitynumber like concat('%', #{user.securitynumber},'%')
+ </if>
+ <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
+ </if>
+ <if test="user.useName!=null and user.useName!='' and user.useName=='examinationType'">
+ order by bu.examination_type ${user.sort}
+ </if>
+ <if test="user.useName!=null and user.useName!='' and user.useName=='examinationMx'">
+ order by bu.examination_mx ${user.sort}
+ </if>
</select>
</mapper>
--
Gitblit v1.9.3