From 62eb499b0c969f246d3245d1429a97da4de1ce28 Mon Sep 17 00:00:00 2001
From: 钟日健 <arsn163@163.com>
Date: Mon, 01 Jun 2026 20:46:13 +0800
Subject: [PATCH] feat: 成绩查询增加年龄查询返回
---
src/main/java/org/springblade/modules/exam/mapper/ExamScoreMapper.xml | 223 +++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 166 insertions(+), 57 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 a2cd388..916259e 100644
--- a/src/main/java/org/springblade/modules/exam/mapper/ExamScoreMapper.xml
+++ b/src/main/java/org/springblade/modules/exam/mapper/ExamScoreMapper.xml
@@ -9,7 +9,7 @@
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,
+ bu.real_name securityName,company,bu.account,bu.securitynumber as securityNumber,
bd.dept_name companyName from
exam_score es
left join
@@ -29,7 +29,7 @@
on
sa.id = es.apply_id
where
- 1=1
+ 1=1 and es.is_deleted = 0
and (sa.is_exam = 2 or sa.is_exam = 3)
<if test="examScore.examName!=null and examScore.examName!=''">
and ke.exam_name like concat('%', #{examScore.examName},'%')
@@ -69,36 +69,30 @@
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.candidate_no candidateNo,
- ke.exam_name examName,date_format(ke.start_time,'%Y-%m-%d') startTime,date_format(ke.end_time,'%Y-%m-%d') endTime,
+ 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,bu.sex,bu.paper_time paperTime,bu.securitynumber securityNumber,bu.avatar,
- bd.dept_name companyName,bu.user_type isPaper
+ ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age,
+ bd.dept_name companyName,bu.user_type isPaper,bud.unit_name unitName
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
- where
- 1=1
- and (str.is_exam = 2 or str.is_exam = 3 or str.is_exam = 4)
+ 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_user_detail bud on bud.user_id = bu.id
+ left join 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 es.is_deleted = 0
+ 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>
<if test="examScore.companyName!=null and examScore.companyName!=''">
and bd.dept_name like concat('%', #{examScore.companyName},'%')
+ </if>
+ <if test="examScore.unitName!=null and examScore.unitName!=''">
+ and bud.unit_name like concat('%', #{examScore.unitName},'%')
</if>
<if test="examScore.securityName!=null and examScore.securityName!=''">
and bu.real_name like concat('%', #{examScore.securityName},'%')
@@ -111,6 +105,9 @@
</if>
<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}
@@ -165,7 +162,7 @@
FROM
exam_score
WHERE
- 1=1
+ 1=1 and is_deleted = 0
<if test="examScore.id!=null">
and id = #{examScore.id}
</if>
@@ -225,7 +222,7 @@
sys_jurisdiction sj
on
sj.id = si.jurisdiction
- WHERE 1 = 1 AND theory_grade is not null
+ WHERE 1 = 1 and exam.is_deleted = 0 AND theory_grade is not null
<if test="jurisdiction!=null and jurisdiction=='' and jurisdiction!='1372091709474910209'">
and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
</if>
@@ -252,7 +249,7 @@
sys_jurisdiction sj
on
sj.id = si.jurisdiction
- WHERE 1 = 1
+ WHERE 1 = 1 and exam.is_deleted = 0
AND learn_grade is not null
<if test="jurisdiction!=null and jurisdiction=='' and jurisdiction!='1372091709474910209'">
and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
@@ -280,6 +277,7 @@
ke.id = es.exam_id
where
bu.cardid = #{idCardNo}
+ and es.is_deleted = 0
and DATE_FORMAT(ke.start_time,'%Y-%m-%d') = #{startTime}
</select>
@@ -291,22 +289,24 @@
<select id="scorePage" resultType="org.springblade.modules.exam.vo.ExamScoreVO">
SELECT
exam.*,
- user.jurisdiction,
- user.real_name securityName,
+ user.jurisdiction,user.real_name securityName,bud.unit_name unitName,
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_detail bud on bud.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
- and ke.exam_type = 2
+ WHERE 1 = 1
+ and ke.exam_type = 2 and exam.is_deleted = 0
<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.unitName!=null and examScore.unitName!=''">
+ and bud.unit_name like concat('%', #{examScore.unitName},'%')
</if>
<if test="examScore.securityName!=null and examScore.securityName!=''">
AND user.real_name like concat('%',#{examScore.securityName},'%')
@@ -327,7 +327,7 @@
<!--查询所有考试不合格的数据(取准考证号)-->
<select id="getDisqualificationExamInfo" resultType="org.springblade.modules.exam.entity.ExamScore">
- select * from exam_score where qualified = 1
+ select * from exam_score where qualified = 1 and is_deleted = 0
</select>
@@ -345,48 +345,52 @@
<!--查询所有无成绩的数据-->
<select id="getNoScoreInfo" resultType="org.springblade.modules.exam.entity.ExamScore">
- select * from exam_score where theory_grade is null
+ select * from exam_score where theory_grade is null and is_deleted = 0
</select>
<!--查询所有无成绩的数据-->
<select id="getLheoryGradeLess60" resultType="org.springblade.modules.exam.entity.ExamScore">
- select * from exam_score where all_grade < 30
+ select * from exam_score where all_grade < 30 and is_deleted = 0
</select>
<!--导出-按条件查询成绩数据-模拟考试-->
<select id="getExamScoreList" resultType="org.springblade.modules.exam.excel.ExportExamScoreExcel">
SELECT
- ke.exam_name examName,bu.real_name securityName,bu.cardid idCardNo,
+ ke.exam_name examName,
+ bu.real_name securityName,bu.cardid idCardNo,bu.securitynumber as securityNumber,
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
+ es.theory_grade theoryGrade,
+ case when es.learn_grade=0 then '合格'
+ when es.learn_grade=1 then '不合格'
+ end as learnGrade,
+ case when es.qualified=0 then '合格'
+ when es.qualified=1 then '不合格'
+ when es.qualified=2 then '暂未录入实操成绩'
+ end as qualified,
+ bud.marriage_status marriageStatus,bud.sign_level signLevel,bud.unit_name unitName,
+ bud.permanent_residence_address permanentResidenceAddress,bud.dwell_address dwellAddress,
+ bud.member_of_family memberOfFamily,bud.work_experience workExperience,bud.education_experience educationExperience,
+ bud.acceptance_police_unit acceptancePoliceUnit,bud.acceptance_person acceptancePerson,bud.acceptance_time acceptanceTime
+ 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 and bu.is_deleted = 0
+ left join blade_user_detail bud on bud.user_id = bu.id and bud.is_deleted = 0
+ 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)
+ 1=1 and es.is_deleted = 0
+ 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.unitName!=null and examScore.unitName!=''">
+ and bud.unit_name like concat('%', #{examScore.unitName},'%')
</if>
<if test="examScore.securityName!=null and examScore.securityName!=''">
and bu.real_name like concat('%', #{examScore.securityName},'%')
@@ -433,6 +437,9 @@
<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>
@@ -476,6 +483,7 @@
left join sys_jurisdiction sj on si.jurisdiction = sj.id
WHERE
qualified = 0
+ and es.is_deleted = 0
and training_unit_id = #{information.departmentid}
and YEAR ( ke.start_time ) = YEAR ( now() )
<if test="information.deptid!=null and information.deptid!=''">
@@ -502,6 +510,7 @@
left join sys_jurisdiction sj on si.jurisdiction = sj.id
WHERE
qualified = 1
+ and es.is_deleted = 0
and training_unit_id = #{information.departmentid}
and YEAR ( ke.start_time ) = YEAR ( now() )
<if test="information.deptid!=null and information.deptid!=''">
@@ -516,6 +525,106 @@
ORDER BY
id
</select>
+ <select id="getList" resultType="org.springblade.modules.exam.vo.ExamScoreVO">
+ SELECT * FROM (
+ 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.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,bu.sex,bu.paper_time paperTime,bu.securitynumber securityNumber,bu.avatar,
+ bd.dept_name companyName,bd.id as deptId,bu.user_type isPaper,bud.unit_name unitName,
+ CASE WHEN ssir.id IS NULL THEN
+ '未签到' ELSE '已签到'
+ END AS state
+ 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_user_detail bud on bud.user_id = bu.id
+ left join 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
+ LEFT JOIN sys_sign_in_records ssir ON ssir.candidate_no = str.candidate_no
+ where 1=1 and es.is_deleted = 0
+ 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>
+ <if test="examScore.companyName!=null and examScore.companyName!=''">
+ and bd.dept_name like concat('%', #{examScore.companyName},'%')
+ </if>
+ <if test="examScore.unitName!=null and examScore.unitName!=''">
+ and bud.unit_name like concat('%', #{examScore.unitName},'%')
+ </if>
+ <if test="examScore.securityName!=null and examScore.securityName!=''">
+ and bu.real_name like concat('%', #{examScore.securityName},'%')
+ </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.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>
+ <if test="examScore.isExam!=null and examScore.isExam!=''">
+ and str.is_exam = #{examScore.isExam}
+ </if>
+ <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>
+ ) result WHERE 1=1
+ <if test="examScore.state != null and examScore.state !='' ">
+ AND result.state = #{examScore.state}
+ </if>
+
+
+
+
+
+ </select>
</mapper>
--
Gitblit v1.9.3