From 8b375fe00a241b3a769b82fe3dac8d1c9dce8a02 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Thu, 16 Jun 2022 14:36:07 +0800
Subject: [PATCH] 模拟考试修改
---
src/main/java/org/springblade/modules/exam/mapper/ExamScoreMapper.xml | 322 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 303 insertions(+), 19 deletions(-)
diff --git a/src/main/java/org/springblade/modules/exam/mapper/ExamScoreMapper.xml b/src/main/java/org/springblade/modules/exam/mapper/ExamScoreMapper.xml
index 35c0a04..37332dd 100644
--- a/src/main/java/org/springblade/modules/exam/mapper/ExamScoreMapper.xml
+++ b/src/main/java/org/springblade/modules/exam/mapper/ExamScoreMapper.xml
@@ -6,7 +6,7 @@
<select id="selectExamScorePage" resultType="org.springblade.modules.exam.vo.ExamScoreVO">
SELECT
es.id,es.theory_grade theoryGrade,ifnull(learn_grade,-1) learnGrade,es.user_id userId,es.exam_id examId,
- es.exam_time examTime,all_grade allGrade,exam_end_time examEndTime,qualified,
+ es.exam_time examTime,all_grade allGrade,exam_end_time examEndTime,qualified,es.candidate_no candidateNo,
ke.exam_name examName,
sa.is_exam isExam,
bu.real_name securityName,company,bu.account,
@@ -64,15 +64,16 @@
</select>
- <!--考试成绩分页信息-模拟考试-->
+ <!--考试成绩分页信息-培训考试-->
<select id="selectTrainExamScorePage" resultType="org.springblade.modules.exam.vo.ExamScoreVO">
SELECT
es.id,es.theory_grade theoryGrade,ifnull(learn_grade,-1) learnGrade,es.user_id userId,es.exam_id examId,
- es.exam_time examTime,all_grade allGrade,exam_end_time examEndTime,qualified,
- ke.exam_name examName,
+ es.exam_time examTime,all_grade allGrade,exam_end_time examEndTime,qualified,es.candidate_no candidateNo,
+ ke.exam_name examName,date_format(ke.start_time,'%Y-%m-%d') startTime,date_format(ke.end_time,'%Y-%m-%d %H:%i:%s') endTime,
str.is_exam isExam,
- bu.real_name securityName,company,bu.account,
- bd.dept_name companyName from
+ bu.real_name securityName,company,bu.cardid cardNo,bu.sex,bu.paper_time paperTime,bu.securitynumber securityNumber,bu.avatar,
+ bd.dept_name companyName,bu.user_type isPaper
+ from
exam_score es
left join
ksxt_exam ke
@@ -86,13 +87,15 @@
blade_dept bd
on
bd.id = bu.dept_id
+ left join sys_information si on si.departmentid = bd.id
+ left join sys_jurisdiction sj on sj.id = si.jurisdiction
left join
sys_training_registration str
on
str.id = es.apply_id
where
1=1
- and (str.is_exam = 2 or str.is_exam = 3)
+ and (str.is_exam = 2 or str.is_exam = 3 or str.is_exam = 4 or str.is_exam = 5)
<if test="examScore.examName!=null and examScore.examName!=''">
and ke.exam_name like concat('%', #{examScore.examName},'%')
</if>
@@ -111,6 +114,9 @@
<if test="examScore.userId!=null and examScore.userId!=''">
and es.user_id = #{examScore.userId}
</if>
+ <if test="examScore.jurisdiction!=null and examScore.jurisdiction!='' and examScore.jurisdiction!='1372091709474910209'">
+ and (sj.id=#{examScore.jurisdiction} or sj.parent_id = #{examScore.jurisdiction})
+ </if>
<if test="examScore.deptId!=null and examScore.deptId!=''">
and bd.id = #{examScore.deptId}
</if>
@@ -120,11 +126,38 @@
<if test="examScore.examType!=null and examScore.examType!=''">
and ke.exam_type = #{examScore.examType}
</if>
+ <if test="examScore.examId!=null">
+ and es.exam_id = #{examScore.examId}
+ </if>
+ <if test="examScore.isPaper==6">
+ and bu.user_type = #{examScore.isPaper}
+ </if>
+ <if test="examScore.isPaper==7">
+ and (bu.user_type = #{examScore.isPaper} or bu.user_type is null)
+ </if>
+ <if test="examScore.isAvatar==1">
+ and bu.avatar is not null and bu.avatar!=""
+ </if>
+ <if test="examScore.isAvatar==2">
+ and (bu.avatar is null or bu.avatar="")
+ </if>
<if test="examScore.candidateNo!=null and examScore.candidateNo!=''">
and es.candidate_no = #{examScore.candidateNo}
</if>
<if test="examScore.qualified!=null">
and es.qualified = #{examScore.qualified}
+ </if>
+ <if test="examScore.examDate!=null and examScore.examDate!=''">
+ and date_format(ke.start_time,'%Y-%m-%d') = #{examScore.examDate}
+ </if>
+ <if test="examScore.sortName!=null and examScore.sortName!='' and examScore.sortName!='companyName'">
+ ORDER BY es.${examScore.sortName} ${examScore.sort},es.id desc
+ </if>
+ <if test="examScore.sortName=='companyName'">
+ ORDER BY bd.dept_name ${examScore.sort},es.id desc
+ </if>
+ <if test="examScore.sortName==null or examScore.sortName==''">
+ order by es.id desc
</if>
</select>
@@ -187,10 +220,19 @@
COUNT( * ) AS count
FROM
exam_score exam
- LEFT JOIN blade_user user ON exam.user_id = user.id
+ LEFT JOIN blade_user user
+ ON exam.user_id = user.id
+ left join
+ sys_information si
+ on
+ si.departmentid = user.dept_id
+ left join
+ sys_jurisdiction sj
+ on
+ sj.id = si.jurisdiction
WHERE 1 = 1 AND theory_grade is not null
<if test="jurisdiction!=null and jurisdiction=='' and jurisdiction!='1372091709474910209'">
- AND user.jurisdiction = #{jurisdiction}
+ and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
</if>
<if test="deptid!=null and deptid!=''">
AND user.dept_id = #{deptid}
@@ -205,10 +247,20 @@
COUNT( * ) AS count
FROM
exam_score exam
- LEFT JOIN blade_user user ON exam.user_id = user.id
- WHERE 1 = 1 AND learn_grade is not null
+ LEFT JOIN blade_user user
+ ON exam.user_id = user.id
+ left join
+ sys_information si
+ on
+ si.departmentid = user.dept_id
+ left join
+ sys_jurisdiction sj
+ on
+ sj.id = si.jurisdiction
+ WHERE 1 = 1
+ AND learn_grade is not null
<if test="jurisdiction!=null and jurisdiction=='' and jurisdiction!='1372091709474910209'">
- AND user.jurisdiction = #{jurisdiction}
+ and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
</if>
<if test="deptid!=null and deptid!=''">
AND user.dept_id = #{deptid}
@@ -227,9 +279,13 @@
blade_user bu
on
bu.id = es.user_id
+ left join
+ ksxt_exam ke
+ on
+ ke.id = es.exam_id
where
bu.cardid = #{idCardNo}
- and es.exam_id = #{examId}
+ and DATE_FORMAT(ke.start_time,'%Y-%m-%d') = #{startTime}
</select>
<!--修改成绩信息-->
@@ -241,17 +297,245 @@
SELECT
exam.*,
user.jurisdiction,
- user.dept_id
+ user.real_name securityName,
+ ke.exam_name examName,sis.enterpriseName trainingUnitName,ke.start_time examStartTime
FROM
exam_score exam
- LEFT JOIN blade_user user ON exam.user_id = user.id
+ left join blade_user user on exam.user_id = user.id
+ left join sys_information si on si.departmentid = user.dept_id
+ left join sys_jurisdiction sj on sj.id = si.jurisdiction
+ left join ksxt_exam ke on exam.exam_id = ke.id
+ left join sys_training_registration str on str.id = exam.apply_id
+ left join sys_information sis on sis.departmentid = str.training_unit_id
WHERE
1 = 1
- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
- AND user.jurisdiction = #{jurisdiction}
+ and ke.exam_type = 2
+ <if test="examScore.jurisdiction!=null and examScore.jurisdiction!='' and examScore.jurisdiction!='1372091709474910209'">
+ and (sj.id = #{examScore.jurisdiction} or sj.parent_id = #{examScore.jurisdiction})
</if>
- <if test="deptid!=null and deptid!=''">
- AND user.dept_id = #{deptid}
+ <if test="examScore.securityName!=null and examScore.securityName!=''">
+ AND user.real_name like concat('%',#{examScore.securityName},'%')
+ </if>
+ <if test="examScore.trainingUnitName!=null and examScore.trainingUnitName!=''">
+ AND sis.enterpriseName like concat('%',#{examScore.trainingUnitName},'%')
+ </if>
+ <if test="examScore.deptId!=null and examScore.deptId!=''">
+ AND user.dept_id = #{examScore.deptId}
+ </if>
+ <if test="examScore.month!=null and examScore.month!=''">
+ AND date_format(ke.start_time,'%Y-%m') = #{examScore.month}
+ </if>
+ <if test="examScore.qualified!=null">
+ AND exam.qualified = #{examScore.qualified}
</if>
</select>
+
+ <!--查询所有考试不合格的数据(取准考证号)-->
+ <select id="getDisqualificationExamInfo" resultType="org.springblade.modules.exam.entity.ExamScore">
+ select * from exam_score where qualified = 1
+ </select>
+
+
+ <!--根据准考证号查询培训信息-->
+ <select id="getTrainInfo" resultType="org.springblade.modules.training.entity.TrainingRegistration">
+ select * from sys_training_registration where 1=1
+ <if test="trainingRegistration.candidateNo!=null and trainingRegistration.candidateNo!=''">
+ and is_exam = 2
+ and candidate_no = #{trainingRegistration.candidateNo}
+ </if>
+ <if test="trainingRegistration.id!=null">
+ and id = #{trainingRegistration.id}
+ </if>
+ </select>
+
+ <!--查询所有无成绩的数据-->
+ <select id="getNoScoreInfo" resultType="org.springblade.modules.exam.entity.ExamScore">
+ select * from exam_score where theory_grade is null
+ </select>
+
+ <!--查询所有无成绩的数据-->
+ <select id="getLheoryGradeLess60" resultType="org.springblade.modules.exam.entity.ExamScore">
+ select * from exam_score where all_grade < 30
+ </select>
+
+ <!--导出-按条件查询成绩数据-模拟考试-->
+ <select id="getExamScoreList" resultType="org.springblade.modules.exam.excel.ExportExamScoreExcel">
+ SELECT
+ ke.exam_name examName,bu.real_name securityName,bu.cardid idCardNo,
+ bd.dept_name companyName,
+ es.exam_time examTime,exam_end_time examEndTime,es.candidate_no candidateNo,
+ es.theory_grade theoryGrade,es.learn_grade learnGrade,
+ all_grade allGrade
+ from
+ exam_score es
+ left join
+ ksxt_exam ke
+ on
+ ke.id = es.exam_id
+ left join
+ blade_user bu
+ on
+ es.user_id = bu.id
+ left join
+ blade_dept bd
+ on
+ bd.id = bu.dept_id
+ left join
+ sys_training_registration str
+ on
+ str.id = es.apply_id
+ left join sys_information si on si.departmentid = bd.id
+ left join sys_jurisdiction sj on sj.id = si.jurisdiction
+ where
+ 1=1
+ and (str.is_exam = 2 or str.is_exam = 3 or str.is_exam = 4 or str.is_exam = 5)
+ <if test="examScore.examName!=null and examScore.examName!='' and examScore.examName!='undefined'">
+ and ke.exam_name like concat('%', #{examScore.examName},'%')
+ </if>
+ <if test="examScore.companyName!=null and examScore.companyName!=''">
+ and bd.dept_name like concat('%', #{examScore.companyName},'%')
+ </if>
+ <if test="examScore.securityName!=null and examScore.securityName!=''">
+ and bu.real_name like concat('%', #{examScore.securityName},'%')
+ </if>
+ <if test="examScore.isPaper==6">
+ and bu.user_type = #{examScore.isPaper}
+ </if>
+ <if test="examScore.isPaper==7">
+ and (bu.user_type = #{examScore.isPaper} or bu.user_type is null)
+ </if>
+ <if test="examScore.account!=null and examScore.account!=''">
+ and bu.account like concat('%', #{examScore.account},'%')
+ </if>
+ <if test="examScore.trainUnitId!=null">
+ and str.training_unit_id = #{examScore.trainUnitId}
+ </if>
+ <if test="examScore.userId!=null and examScore.userId!=''">
+ and es.user_id = #{examScore.userId}
+ </if>
+ <if test="examScore.examId!=null and examScore.examId!='undefined'">
+ and es.exam_id = #{examScore.examId}
+ </if>
+ <if test="examScore.deptId!=null and examScore.deptId!=''">
+ and bd.id = #{examScore.deptId}
+ </if>
+ <if test="examScore.isExam!=null and examScore.isExam!=''">
+ and str.is_exam = #{examScore.isExam}
+ </if>
+ <if test="examScore.isAvatar==1">
+ and bu.avatar is not null and bu.avatar!=""
+ </if>
+ <if test="examScore.isAvatar==2">
+ and (bu.avatar is null or bu.avatar="")
+ </if>
+ <if test="examScore.examType!=null and examScore.examType!=''">
+ and ke.exam_type = #{examScore.examType}
+ </if>
+ <if test="examScore.candidateNo!=null and examScore.candidateNo!=''">
+ and es.candidate_no = #{examScore.candidateNo}
+ </if>
+ <if test="examScore.qualified!=null">
+ and es.qualified = #{examScore.qualified}
+ </if>
+ <if test="examScore.examDate!=null and examScore.examDate!=''">
+ and date_format(ke.start_time,'%Y-%m-%d') = #{examScore.examDate}
+ </if>
+ <if test="examScore.jurisdiction!=null and examScore.jurisdiction!='' and examScore.jurisdiction!='1372091709474910209'">
+ and (sj.id=#{examScore.jurisdiction} or sj.parent_id = #{examScore.jurisdiction})
+ </if>
+ <if test="examScore.sortName!=null and examScore.sortName!='' and examScore.sortName!='companyName'">
+ ORDER BY es.${examScore.sortName} ${examScore.sort},es.id desc
+ </if>
+ <if test="examScore.sortName=='companyName'">
+ ORDER BY bd.dept_name ${examScore.sort},es.id desc
+ </if>
+ <if test="examScore.sortName==null or examScore.sortName==''">
+ order by es.id desc
+ </if>
+ </select>
+
+ <!--导出-按条件查询成绩数据-模拟考试-->
+ <select id="getExamStatisInfo" resultType="org.springblade.modules.exam.vo.ExamSocreStatis">
+ select m.id name, IFNULL(b,0) hgnum,IFNULL(c,0) bhgnum from
+ (
+ select 1 as id union
+ select 2 union
+ select 3 union
+ select 4 union
+ select 5 union
+ select 6 union
+ select 7 union
+ select 8 union
+ select 9 union
+ select 10 union
+ select 11 union
+ select 12
+ ) m
+ left join
+ (
+ SELECT MONTH
+ ( ke.start_time ) a,
+ count(*) b
+ FROM
+ exam_score es
+ left join sys_training_registration str on str.id = es.apply_id
+ left join ksxt_exam ke on ke.id = es.exam_id
+ left join blade_user bu on bu.id = es.user_id
+ left join blade_dept bd on bd.id = bu.dept_id
+ left join sys_information si on bd.id = si.departmentid
+ left join sys_jurisdiction sj on si.jurisdiction = sj.id
+ WHERE
+ qualified = 0
+ and training_unit_id = #{information.departmentid}
+ and YEAR ( ke.start_time ) = YEAR ( now() )
+ <if test="information.deptid!=null and information.deptid!=''">
+ and bu.dept_id = #{information.deptid}
+ </if>
+ <if test="information.jurisdiction!=null and information.jurisdiction!='' and information.jurisdiction!='1372091709474910209'">
+ and (sj.id = #{information.jurisdiction} or sj.parent_id = #{information.jurisdiction})
+ </if>
+ GROUP BY
+ MONTH ( ke.start_time )
+ ) n ON m.id = n.a
+ left join
+ (
+ SELECT MONTH
+ ( ke.start_time ) a,
+ count(*) c
+ FROM
+ exam_score es
+ left join sys_training_registration str on str.id = es.apply_id
+ left join ksxt_exam ke on ke.id = es.exam_id
+ left join blade_user bu on bu.id = es.user_id
+ left join blade_dept bd on bd.id = bu.dept_id
+ left join sys_information si on bd.id = si.departmentid
+ left join sys_jurisdiction sj on si.jurisdiction = sj.id
+ WHERE
+ qualified = 1
+ and training_unit_id = #{information.departmentid}
+ and YEAR ( ke.start_time ) = YEAR ( now() )
+ <if test="information.deptid!=null and information.deptid!=''">
+ and bu.dept_id = #{information.deptid}
+ </if>
+ <if test="information.jurisdiction!=null and information.jurisdiction!='' and information.jurisdiction!='1372091709474910209'">
+ and (sj.id = #{information.jurisdiction} or sj.parent_id = #{information.jurisdiction})
+ </if>
+ GROUP BY
+ MONTH ( ke.start_time )
+ ) i ON m.id = i.a
+ ORDER BY
+ id
+ </select>
+
+ <!--查询考试成绩-->
+ <select id="getExamScoreLists" resultType="org.springblade.modules.exam.entity.ExamScore">
+ SELECT * from exam_score where date_format(exam_time,'%Y-%M-%d') = date_format(now(),'%Y-%M-%d')
+ </select>
+
+ <!--查询考试成绩按时间-->
+ <select id="getExamScoreListByTime" resultType="org.springblade.modules.exam.entity.ExamScore">
+ SELECT * from exam_score where date_format(exam_time,'%Y-%M-%d') = date_format(#{time},'%Y-%M-%d')
+ </select>
+
+
</mapper>
--
Gitblit v1.9.3