From f5379a7100a20f538092eb839b2f4c9f6d3a1b45 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期四, 04 七月 2024 17:06:10 +0800
Subject: [PATCH] 上课记录Bug修复

---
 src/main/resources/mapper/ExamPaperScoreMapper.xml |   66 ++++++++++++++++++++-------------
 1 files changed, 40 insertions(+), 26 deletions(-)

diff --git a/src/main/resources/mapper/ExamPaperScoreMapper.xml b/src/main/resources/mapper/ExamPaperScoreMapper.xml
index 0c4926f..0c24845 100644
--- a/src/main/resources/mapper/ExamPaperScoreMapper.xml
+++ b/src/main/resources/mapper/ExamPaperScoreMapper.xml
@@ -22,22 +22,39 @@
         <result column="navbar" property="navbar"/>
     </resultMap>
     <sql id="Base_Column_List">
-        id
-        , paper_id, paper_name, paper_type, score,total_score,
-        question_correct, question_count, do_time, status, user_id, exam_id,exam_name,
-        judge_user,submit_time,paper_content,judge_time,navbar
+        id,
+        exam_id,
+        exam_name,
+        paper_id,
+        paper_type,
+        score,
+        total_score,
+        question_correct,
+        question_count,
+        do_time,
+        status,
+        user_id,
+        judge_user,
+        submit_time,
+        paper_content,
+        navbar,
+        judge_time,
+        deleted
     </sql>
 
-    <select id="studentPage" resultMap="BaseResultMap"
-            parameterType="com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageVO">
+    <select id="studentPage" resultType="com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageResponseVO">
         SELECT
-        <include refid="Base_Column_List"/>
-        FROM t_exam_paper_answer
+        a.*,
+        ep.name AS paperName
+        FROM t_exam_paper_score a
+        INNER JOIN t_exam_paper ep ON ep.id = paper_id AND ep.deleted = 0
         <where>
-            and user_id = #{createUser}
+            AND user_id = #{createUser}
+            <if test="examName != null and examName != ''">
+                AND INSTR(exam_name, #{examName})
+            </if>
         </where>
     </select>
-
 
     <select id="getByExamIdUserId" resultType="com.ycl.jxkg.domain.entity.ExamPaperScore">
         SELECT
@@ -48,11 +65,11 @@
             and exam_id = #{examId}
         </where>
     </select>
-
     <select id="selectAllCount" resultType="java.lang.Integer">
         SELECT count(*)
         from t_exam_paper_score
     </select>
+
     <select id="selectAllQuestionCount" resultType="java.lang.Integer">
         SELECT sum(question_count)
         from t_exam_paper_score
@@ -80,14 +97,12 @@
 
     <select id="adminPage" resultType="com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageResponseVO">
         SELECT
-        a.id , exam_paper_id, paper_name, paper_type, system_score, user_score, paper_score,
-        question_correct, question_count, do_time, a.status, create_user, a.create_time, b.real_name AS userName
-        FROM t_exam_paper_answer a
-        LEFT JOIN t_user b ON a.create_user = b.id
+        a.id, a.exam_name, a.score, a.total_score, a.question_correct, a.question_count, a.do_time, a.status, a.submit_time, b.real_name AS userName, c.name as paperName
+        FROM t_exam_paper_score a
+        INNER JOIN t_user b ON a.user_id = b.id AND b.deleted = 0
+        INNER JOIN t_exam_paper c ON a.paper_id = c.id AND c.deleted = 0
         <where>
-            <if test="examPaperId != null">
-                AND paper_id = #{examPaperId}
-            </if>
+            exam_id = #{examId}
             <if test="userName != null and userName != ''">
                 AND INSTR(b.real_name, #{userName})
             </if>
@@ -96,9 +111,9 @@
 
     <select id="pageExamPaper" resultType="com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageResponseVO">
         SELECT
-        a.id,
+        t.id,
         a.name AS paperName,
-        a.score AS systemScore,
+        a.score AS totalScore,
         a.num as questionCount,
         a.subject_id,
         a.paper_type,
@@ -106,15 +121,14 @@
         b.name AS subjectName,
         c.real_name AS userName,
         IFNULL(COUNT(DISTINCT d.id), 0) AS personAnswerNum,
-        IFNULL(COUNT(DISTINCT f.id), 0) AS personTotalNum,
+        IFNULL(COUNT(DISTINCT e.id), 0) AS personTotalNum,
         t.exam_name
         FROM t_exam_paper a
         INNER JOIN t_exam t ON a.id = t.exam_paper_id AND t.deleted = 0
-        LEFT JOIN t_subject b ON a.subject_id = b.id
-        LEFT JOIN t_user c ON t.teacher_id = c.id
-        LEFT JOIN t_exam_paper_answer d ON a.id = d.exam_paper_id
-        LEFT JOIN t_exam_paper_classes e ON a.id = e.exam_paper_id
-        LEFT JOIN t_classes_user f ON e.classes_id = f.classes_id
+        LEFT JOIN t_subject b ON a.subject_id = b.id AND b.deleted = 0
+        LEFT JOIN t_user c ON t.teacher_id = c.id AND c.deleted = 0
+        LEFT JOIN t_exam_paper_score d ON t.id = d.exam_id
+        LEFT JOIN t_classes_user e ON t.classes_id = e.classes_id
         <where>
             a.deleted = 0
             <if test="subjectId != null and subjectId.size() > 0">

--
Gitblit v1.8.0