From 269b7d3e853794aefb36fab0fe8390f325d57374 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Sat, 04 Dec 2021 16:29:59 +0800
Subject: [PATCH] 1.数据库连接
---
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml | 262 ++++++++++++++++++++++++++++-----------------------
1 files changed, 144 insertions(+), 118 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 726fd56..05e9fa5 100644
--- a/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
+++ b/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -777,7 +777,7 @@
IFNULL( C.fznum, 0 ) AS fznum,
H.departmentid,
H.jurisdiction
- FROM (SELECT departmentid, jurisdiction FROM sys_information WHERE stats!=1 GROUP BY departmentid, jurisdiction)
+ FROM (SELECT departmentid, jurisdiction FROM sys_information WHERE stats!=1 GROUP BY departmentid, jurisdiction)
H
LEFT JOIN (
SELECT COUNT(*) AS thisnum,
@@ -1405,7 +1405,7 @@
u.dept_id
FROM
sys_performance p
- INNER JOIN blade_user u ON p.securityId = u.id WHERE 1=1
+ INNER JOIN blade_user u ON p.securityId = u.id WHERE 1=1 AND score=3
<if test="type!=null and type=='1'.toString()">
and to_days(p.time) = to_days(now())
</if>
@@ -3053,39 +3053,39 @@
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
+ 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
- blade_user bu
+ (
+ 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
- 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
+ a.id = b.id
)
</select>
@@ -3122,34 +3122,34 @@
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
+ 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
- sys_information si
- on
- bu.dept_id = si.departmentid
- left join
- sys_jurisdiction sj
+ (
+ select sj.id,
+ sj.parent_id,
+ count(*) count
+ from
+ blade_user bu
+ left join
+ sys_information si
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
+ 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>
@@ -3218,66 +3218,66 @@
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
+ 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 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 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>
@@ -3476,4 +3476,30 @@
)
</select>
+ <select id="selectBxc" resultType="java.util.HashMap">
+ SELECT u.real_name as realName,
+ d.dept_name as deptName,
+ u.sex,
+ u.cardid,
+ ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING(u.cardid, 7, 4), 0) AS age,
+ u.securitynumber,
+ u.phone,
+ p.score
+ FROM sys_performance p
+ LEFT JOIN blade_user u ON p.securityId = u.id
+ LEFT JOIN blade_dept d ON d.id = p.departmentid
+ LEFT JOIN sys_jurisdiction j ON j.id = p.jurisdiction
+ WHERE 1 =1
+ <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
+ and (j.id = #{jurisdiction} or j.parent_id = #{jurisdiction})
+ </if>
+ <if test="type!=null and type=='1'.toString()">
+ and to_days(p.time) = to_days(now())
+ </if>
+ <if test="type!=null and type=='2'.toString()">
+ and DATE_FORMAT(p.time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
+ </if>
+ and p.score = 3
+ </select>
+
</mapper>
--
Gitblit v1.9.3