From ccca8c65b3c76a9021a471a3667d61d965a4f2cb Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期六, 11 五月 2024 18:04:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/resources/mapper/ExamPaperAnswerMapper.xml |   31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/src/main/resources/mapper/ExamPaperAnswerMapper.xml b/src/main/resources/mapper/ExamPaperAnswerMapper.xml
index 2e9cba5..9f4e0bf 100644
--- a/src/main/resources/mapper/ExamPaperAnswerMapper.xml
+++ b/src/main/resources/mapper/ExamPaperAnswerMapper.xml
@@ -231,11 +231,19 @@
     where id = #{id,jdbcType=INTEGER}
   </update>
 
+  <update id="setMissExam">
+    update t_exam_paper_answer
+    set invalid = 1
+    where exam_paper_id = #{examPaperId}
+    and create_user in (
+    <foreach collection="userIds" item="item" index="index" separator=",">
+      #{item}
+    </foreach>
+    )
+  </update>
 
 
-
-
-  <select id="studentPage" resultMap="BaseResultMap" parameterType="com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageVM">
+    <select id="studentPage" resultMap="BaseResultMap" parameterType="com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageVM">
     SELECT
     <include refid="Base_Column_List"/>
     FROM t_exam_paper_answer
@@ -321,6 +329,7 @@
                   (#{item.examPaperId},#{item.userId})
         </foreach>
       </if>
+    and (invalid = 0 or invalid is null)
   </select>
   <select id="adminPageByGrade" resultMap="BaseResultMap" parameterType="com.mindskip.xzs.viewmodel.admin.paper.ExamPaperGradePageRequestVM">
     select
@@ -386,4 +395,20 @@
     where a.create_time
   </select>
 
+  <insert id="insertDefault">
+    INSERT INTO t_exam_paper_answer(exam_paper_id, paper_name, paper_type, system_score, user_score, paper_score, question_correct, question_count, do_time, status,
+    create_user, create_time, invalid)
+    SELECT
+    a.id, a.name, a.paper_type, 0, 0, a.score, 0,  a.question_count, 0, 2, b.user_id, NOW(), 0
+    FROM t_exam_paper a
+    left join t_exam_paper_user b on a.id = b.exam_paper_id and b.deleted = 0
+    left join t_exam_paper_answer c on a.id = c.exam_paper_id and c.create_user = b.user_id
+    WHERE a.id = #{examPaperId}
+    and c.id is null
+    and b.user_id not in
+    <foreach collection="userIds" item="item" open="(" close=")" separator=",">
+      #{item}
+    </foreach>
+  </insert>
+
 </mapper>

--
Gitblit v1.8.0