From 14821e28286d773ad5ff2c13510e39c5eb117daf Mon Sep 17 00:00:00 2001
From: kongzy <kongzy>
Date: 星期五, 05 七月 2024 13:46:32 +0800
Subject: [PATCH] update

---
 exam-system/src/main/resources/mapper/system/ExPaperStudentMapper.xml |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/exam-system/src/main/resources/mapper/system/ExPaperStudentMapper.xml b/exam-system/src/main/resources/mapper/system/ExPaperStudentMapper.xml
index d87acb8..7e000bd 100644
--- a/exam-system/src/main/resources/mapper/system/ExPaperStudentMapper.xml
+++ b/exam-system/src/main/resources/mapper/system/ExPaperStudentMapper.xml
@@ -15,12 +15,32 @@
         <result property="updateBy"       column="update_by"       />
         <result property="updateTime"     column="update_time"     />
         <result property="remark"         column="remark"          />
-        <result property="studentName"     column="student_name"     />
-        <result property="studentPhone"     column="student_phone"     />
-        <result property="paperName"     column="paper_name"     />
+        <result property="createName"         column="create_name"          />
+        <association property="student" javaType="com.gkhy.exam.system.domain.ExStudent" resultMap="exStudentResult" />
+        <association property="examPaper" javaType="com.gkhy.exam.system.domain.ExExamPaper" resultMap="exExamPaperResult" />
         <collection property="singleQuestions" ofType="com.gkhy.exam.system.domain.ExQuestion" select="getQuestionByPaperId" column="{paperId=paper_id,studentId=student_id,completed=completed,questionType=1}"/>
         <collection property="multiQuestions" ofType="com.gkhy.exam.system.domain.ExQuestion" select="getQuestionByPaperId" column="{paperId=paper_id,studentId=student_id,completed=completed,questionType=2}"/>
         <collection property="judgeQuestions" ofType="com.gkhy.exam.system.domain.ExQuestion" select="getQuestionByPaperId" column="{paperId=paper_id,studentId=student_id,completed=completed,questionType=3}"/>
+    </resultMap>
+
+
+    <resultMap type="com.gkhy.exam.system.domain.ExPaperStudent" id="SimplePaperStudentResult">
+        <result property="id"       column="id"       />
+        <result property="paperId"    column="paper_id"    />
+        <result property="studentId"     column="student_id"     />
+        <result property="score"     column="score"     />
+        <result property="passed"     column="passed"     />
+        <result property="useTime"     column="use_time"     />
+        <result property="completed"     column="completed"     />
+        <result property="version"         column="version"          />
+        <result property="createBy"       column="create_by"       />
+        <result property="createTime"     column="create_time"     />
+        <result property="updateBy"       column="update_by"       />
+        <result property="updateTime"     column="update_time"     />
+        <result property="remark"         column="remark"          />
+        <result property="createName"         column="create_name"          />
+        <association property="student" javaType="com.gkhy.exam.system.domain.ExStudent" resultMap="exStudentResult" />
+        <association property="examPaper" javaType="com.gkhy.exam.system.domain.ExExamPaper" resultMap="exExamPaperResult" />
     </resultMap>
 
     <resultMap type="com.gkhy.exam.system.domain.ExQuestion" id="ExQuestionResult">
@@ -35,6 +55,19 @@
         <result property="questionId"       column="answer_question_id"       />
         <result property="answer"       column="answer_answer"       />
         <result property="passed"       column="answer_passed"       />
+    </resultMap>
+
+    <resultMap id="exExamPaperResult" type="com.gkhy.exam.system.domain.ExExamPaper">
+        <result property="id"       column="paper_id"       />
+        <result property="code"       column="paper_code"       />
+        <result property="name"       column="paper_name"       />
+        <result property="categoryName"       column="category_name"       />
+    </resultMap>
+
+    <resultMap id="exStudentResult" type="com.gkhy.exam.system.domain.ExStudent">
+        <result property="id"       column="student_id"       />
+        <result property="name"       column="student_name"       />
+        <result property="phone"       column="student_phone"       />
     </resultMap>
 
     <insert id="batchInsert">
@@ -52,20 +85,22 @@
         select count(1) from ex_paper_student where paper_id=#{paperId} and student_id=#{studentId}
     </select>
 
-    <select id="selectPaperStudentList" resultType="com.gkhy.exam.system.domain.ExPaperStudent">
-        select a.*,b.id as student_id,b.phone as student_phone,b.name as student_name,c.name as paperName from ex_paper_student a
+    <select id="selectPaperStudentList" resultMap="SimplePaperStudentResult">
+        select a.*,e.name as create_name,b.phone as student_phone,b.name as student_name,c.name as paper_name,c.id as paper_id,c.code as paper_code,d.name as category_name  from ex_paper_student a
         left join ex_student b on a.student_id=b.id
         left join ex_exam_paper c on c.id=a.paper_id
+        left join sys_category d on d.id=c.category_id
+        left join sys_user e on e.id =a.create_id
         <where>
             and c.del_flag=0
-            <if test="paperId!=null'">
+            <if test="paperId!=null">
                 and a.paper_id=#{paperId}
             </if>
             <if test="studentName!=null and studentName!=''">
                 and b.name like concat('%',#{studentName},'%')
             </if>
-            <if test="phone!=null and phone!=''">
-                and b.phone like concat('%',#{phone},'%')
+            <if test="studentPhone!=null and studentPhone!=''">
+                and b.phone like concat('%',#{studentPhone},'%')
             </if>
             <if test="studentId!=null">
                 and a.student_id = #{studentId}
@@ -75,7 +110,14 @@
     </select>
 
     <select id="selectPaperStudentById" resultMap="ExPaperStudentResult">
-        select a.*,b.id as student_id,b.phone as student_phone,b.name as student_name,c.name as paperName from ex_paper_student a
+        select a.*,b.id as student_id,b.phone as student_phone,b.name as student_name,c.name as paper_name from ex_paper_student a
+        left join ex_student b on a.student_id=b.id
+        left join ex_exam_paper c on c.id=a.paper_id
+        where a.id=#{paperStudentId}
+    </select>
+
+    <select id="selectSimplePaperStudentById" resultMap="SimplePaperStudentResult">
+        select a.*,b.id as student_id,b.phone as student_phone,b.name as student_name,c.name as paper_name from ex_paper_student a
         left join ex_student b on a.student_id=b.id
         left join ex_exam_paper c on c.id=a.paper_id
         where a.id=#{paperStudentId}

--
Gitblit v1.9.2