From cc3a57f2a466a76a808b8171fdcfa5d10263e4eb Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Tue, 18 Jan 2022 14:42:50 +0800
Subject: [PATCH] 1.考试查询修改 2.新增登录情况导出 3.题库查询修改
---
src/main/java/org/springblade/modules/loginrecord/mapper/LoginRecordMapper.xml | 66 ++++++++++++++++++++++++++++++++-
1 files changed, 64 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/springblade/modules/loginrecord/mapper/LoginRecordMapper.xml b/src/main/java/org/springblade/modules/loginrecord/mapper/LoginRecordMapper.xml
index 3a8bf07..7fdfabb 100644
--- a/src/main/java/org/springblade/modules/loginrecord/mapper/LoginRecordMapper.xml
+++ b/src/main/java/org/springblade/modules/loginrecord/mapper/LoginRecordMapper.xml
@@ -46,7 +46,7 @@
LEFT JOIN
(
SELECT count( * ) c, dept_id FROM `sys_login_record`
- where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(create_time)
+ where DATE_SUB(CURDATE(), INTERVAL 14 DAY) <= date(create_time)
GROUP BY dept_id
) b ON a.departmentid = b.dept_id
) c
@@ -78,7 +78,7 @@
LEFT JOIN
(
SELECT count( * ) c, dept_id FROM `sys_login_record`
- where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(create_time)
+ where DATE_SUB(CURDATE(), INTERVAL 14 DAY) <= date(create_time)
GROUP BY dept_id
) b ON a.departmentid = b.dept_id
) c
@@ -139,4 +139,66 @@
and r.num > 0
</if>
</select>
+
+
+ <!--企业登录记录导出-->
+ <select id="exportLoginRecord" resultType="org.springblade.modules.loginrecord.excel.LoginRecordExcel">
+ select * from (
+ SELECT
+ a.enterpriseName deptName,
+ case when a.stats=0 then '自招保安单位'
+ when a.stats=2 then '本市保安公司'
+ when a.stats=4 then '分公司'
+ when a.stats=1 then '保安培训学校'
+ else "其他" end as stats,
+ sj.dept_name jurisdictionName,
+ ifnull( b.c, 0 ) num,
+ c.create_time createTime
+ FROM
+ (
+ SELECT
+ si.*
+ FROM
+ sys_information si
+ LEFT JOIN blade_dept bd ON si.departmentid = bd.id
+ WHERE
+ bd.is_deleted = 0
+ AND bd.dept_category = 1
+ ) a
+ left join
+ (
+ SELECT count( * ) c, dept_id FROM `sys_login_record`
+ where 1=1
+ and type = 1
+ <if test="loginRecord.startTime!=null and loginRecord.startTime!='' and loginRecord.startTime!='undefined'">
+ and date(create_time) >= #{loginRecord.startTime}
+ </if>
+ <if test="loginRecord.endTime!=null and loginRecord.endTime!='' and loginRecord.endTime!='undefined'">
+ and date(create_time) <= #{loginRecord.endTime}
+ </if>
+ GROUP BY dept_id
+ ) b ON a.departmentid = b.dept_id
+ left join
+ (
+ select dept_id,max(create_time) create_time from sys_login_record GROUP BY dept_id
+ ) c on a.departmentid = c.dept_id
+ left join sys_jurisdiction sj on a.jurisdiction = sj.id
+ where 1=1
+ <if test="loginRecord.jurisdiction!=null and loginRecord.jurisdiction!='' and loginRecord.jurisdiction!='1372091709474910209'">
+ and (sj.id = #{loginRecord.jurisdiction} or sj.parent_id = #{loginRecord.jurisdiction})
+ </if>
+ <if test="loginRecord.deptName!=null and loginRecord.deptName!=''">
+ and a.enterpriseName like concat('%',#{loginRecord.deptName},'%')
+ </if>
+ <if test="loginRecord.stats!=null and loginRecord.stats!=''">
+ and a.stats = #{loginRecord.stats}
+ </if>
+ ) r where 1=1
+ <if test="loginRecord.types ==1">
+ and r.num = 0
+ </if>
+ <if test="loginRecord.types ==2">
+ and r.num > 0
+ </if>
+ </select>
</mapper>
--
Gitblit v1.9.3