From 54a6c048c97011cd2a99fbef2065afe0a167fcfc Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期一, 22 七月 2024 13:46:05 +0800
Subject: [PATCH] fix:成绩统计导出完善
---
src/main/resources/mapper/ExamPaperAnswerMapper.xml | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/main/resources/mapper/ExamPaperAnswerMapper.xml b/src/main/resources/mapper/ExamPaperAnswerMapper.xml
index a9cbdfd..d7ab516 100644
--- a/src/main/resources/mapper/ExamPaperAnswerMapper.xml
+++ b/src/main/resources/mapper/ExamPaperAnswerMapper.xml
@@ -209,6 +209,9 @@
<if test="taskExamId != null">
task_exam_id = #{taskExamId,jdbcType=INTEGER},
</if>
+ <if test="invalid != null">
+ invalid = #{invalid},
+ </if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
@@ -530,7 +533,7 @@
FROM
t_department a
LEFT JOIN t_user_department b ON a.id = b.department_id
- LEFT JOIN t_exam_templates_user d ON d.user_id = b.user_id AND d.templates_id = #{id}
+ INNER JOIN t_exam_templates_user d ON d.user_id = b.user_id AND d.templates_id = #{id}
LEFT JOIN t_exam_templates_user_count e ON d.templates_id = e.exam_templates_id
LEFT JOIN t_exam_paper_answer c ON d.user_id = c.create_user AND e.exam_paper_id = c.exam_paper_id AND (c.invalid = 0 OR c.invalid IS NULL)
WHERE a.deleted = 0
@@ -591,7 +594,7 @@
t_department a
LEFT JOIN t_user_department b ON a.id = b.department_id
LEFT JOIN t_exam_paper_answer c ON b.user_id = c.create_user AND (c.invalid = 0 OR c.invalid IS NULL) AND c.exam_paper_id = #{id}
- LEFT JOIN t_exam_paper_user d ON b.user_id = d.user_id AND d.exam_paper_id = #{id}
+ INNER JOIN t_exam_paper_user d ON b.user_id = d.user_id AND d.exam_paper_id = #{id}
WHERE a.deleted = 0
GROUP BY
a.id, a.name
@@ -659,14 +662,13 @@
<select id="getTemplateOtherExamAnswer" resultType="com.mindskip.xzs.domain.ExamPaperAnswer">
SELECT id, user_score FROM t_exam_paper_answer WHERE exam_paper_id IN
- (SELECT exam_paper_id FROM t_exam_templates_user_count WHERE user_id = #{createUser} AND exam_templates_id =
- (SELECT exam_templates_id FROM t_exam_templates_user_count WHERE exam_paper_id = #{examPaperId} LIMIT 1))
- HAVING MAX(user_score) ORDER BY create_time DESC LIMIT 1
+ (SELECT exam_paper_id FROM t_exam_templates_user_count WHERE user_id = #{examPaperAnswer.createUser} AND exam_templates_id = #{templateId})
+ ORDER BY user_score DESC LIMIT 1
</select>
<select id="getPaperOtherExamAnswer" resultType="com.mindskip.xzs.domain.ExamPaperAnswer">
SELECT id, user_score FROM t_exam_paper_answer WHERE exam_paper_id = #{examPaperId} AND create_user = #{createUser}
- HAVING MAX(user_score) ORDER BY create_time DESC LIMIT 1
+ ORDER BY user_score DESC LIMIT 1
</select>
</mapper>
--
Gitblit v1.8.0