From f0f00e9ba8a755e4317e029d73b69a92ad9f9df1 Mon Sep 17 00:00:00 2001
From: kongzy <kongzy>
Date: Sat, 14 Sep 2024 17:02:41 +0800
Subject: [PATCH] update
---
exam-system/src/main/resources/mapper/system/ExPaperStudentMapper.xml | 87 ++++++++++++++++++++++++++++++++++---------
1 files changed, 68 insertions(+), 19 deletions(-)
diff --git a/exam-system/src/main/resources/mapper/system/ExPaperStudentMapper.xml b/exam-system/src/main/resources/mapper/system/ExPaperStudentMapper.xml
index 7e000bd..f2c2602 100644
--- a/exam-system/src/main/resources/mapper/system/ExPaperStudentMapper.xml
+++ b/exam-system/src/main/resources/mapper/system/ExPaperStudentMapper.xml
@@ -8,7 +8,7 @@
<result property="score" column="score" />
<result property="passed" column="passed" />
<result property="useTime" column="use_time" />
- <result property="completed" column="completed" />
+ <result property="state" column="state" />
<result property="version" column="version" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
@@ -18,10 +18,8 @@
<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>
+ <collection property="questions" ofType="com.gkhy.exam.system.domain.ExQuestion" select="getQuestionByPaperId" column="{paperId=paper_id,studentId=student_id,state=state}"/>
+ </resultMap>
<resultMap type="com.gkhy.exam.system.domain.ExPaperStudent" id="SimplePaperStudentResult">
@@ -31,7 +29,8 @@
<result property="score" column="score" />
<result property="passed" column="passed" />
<result property="useTime" column="use_time" />
- <result property="completed" column="completed" />
+ <result property="startTime" column="start_time" />
+ <result property="state" column="state" />
<result property="version" column="version" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
@@ -39,12 +38,23 @@
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="createName" column="create_name" />
+ <result property="companyId" column="company_id" />
+ <result property="companyName" column="company_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">
<result property="id" column="id" />
+ <result property="questionType" column="question_type" />
+ <result property="bankId" column="bank_id" />
+ <result property="status" column="status" />
+ <result property="companyId" column="company_id" />
+ <result property="status" column="status" />
+ <result property="answer" column="answer" />
+ <result property="title" column="title" />
+ <result property="privatize" column="privatize" />
+ <result property="content" column="content" />
<association property="studentAnswer" javaType="com.gkhy.exam.system.domain.ExStudentAnswer" resultMap="studentAnswerResult" />
</resultMap>
@@ -55,6 +65,7 @@
<result property="questionId" column="answer_question_id" />
<result property="answer" column="answer_answer" />
<result property="passed" column="answer_passed" />
+ <result property="score" column="answer_score" />
</resultMap>
<resultMap id="exExamPaperResult" type="com.gkhy.exam.system.domain.ExExamPaper">
@@ -62,6 +73,17 @@
<result property="code" column="paper_code" />
<result property="name" column="paper_name" />
<result property="categoryName" column="category_name" />
+ <result property="limited" column="limited" />
+ <result property="limitTime" column="limit_time" />
+ <result property="deadline" column="deadline" />
+ <result property="singleNum" column="single_num" />
+ <result property="multiNum" column="multi_num" />
+ <result property="judgeNum" column="judge_num" />
+ <result property="easyNum" column="easy_num" />
+ <result property="singleScore" column="single_score" />
+ <result property="multiScore" column="multi_score" />
+ <result property="judgeScore" column="judge_score" />
+ <result property="easyScore" column="easy_score" />
</resultMap>
<resultMap id="exStudentResult" type="com.gkhy.exam.system.domain.ExStudent">
@@ -71,11 +93,19 @@
</resultMap>
<insert id="batchInsert">
- insert into ex_paper_student(paper_id,student_id) values
+ insert into ex_paper_student(paper_id,student_id,create_id) values
<foreach collection="list" item="item" index="index" separator=",">
- (#{item.paperId},#{item.studentId})
+ (#{item.paperId},#{item.studentId},#{item.createId})
</foreach>
</insert>
+
+ <update id="batchUpdateComplete">
+ update ex_paper_student set completed=#{completed}
+ where id in
+ <foreach collection="paperStudentIds" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ </update>
<select id="countByPaperId" resultType="java.lang.Integer">
select count(1) from ex_paper_student where paper_id=#{paperId}
@@ -86,7 +116,11 @@
</select>
<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
+ select a.*,e.name as create_name,b.phone as student_phone,b.name as student_name,c.name as paper_name,c.code as paper_code,c.limited,c.limit_time,c.deadline,d.name as category_name
+ <if test="studentId!=null">
+ ,(select question_id from ex_student_answer where paper_id=a.paper_id and student_id=#{studentId} order by id desc limit 1) as question_id
+ </if>
+ 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
@@ -105,12 +139,15 @@
<if test="studentId!=null">
and a.student_id = #{studentId}
</if>
+ <if test="state!=null">
+ and a.state = #{state}
+ </if>
</where>
- order by a.id desc
+ order by a.passed desc,a.id desc
</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 paper_name 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,c.single_num,c.multi_num,c.judge_num,c.easy_num,c.single_score,c.multi_score,c.judge_score,c.easy_score 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}
@@ -130,19 +167,31 @@
where a.paper_id=#{paperId} and a.student_id=#{studentId}
</select>
- <select id="getQuestionByPaperId" resultType="com.gkhy.exam.system.domain.ExQuestion">
+ <select id="getQuestionByPaperId" resultMap="ExQuestionResult">
select a.id,a.question_type,a.bank_id,a.company_id,a.status,
- <if test="completed!=null and completed=1">
- a.answer,
+ <if test="state!=null and state!=0">
+ a.answer,c.passed as answer_passed,c.score as answer_score,
</if>
a.title,a.privatize,a.content,
- c.id as answer_id,c.paper_id as answer_paper_id,c.student_id as answer_student_id,c.question_id as answer_question_id,c.answer as answer_answer,
- <if test="completed!=null and completed=1">
- c.passed as answer_passed
- </if>
+ c.id as answer_id,c.paper_id as answer_paper_id,c.student_id as answer_student_id,c.question_id as answer_question_id,c.answer as answer_answer
+
from ex_question a
inner join ex_paper_question b on a.id=b.question_id
left join ex_student_answer c on c.question_id=a.id and c.student_id=#{studentId} and c.paper_id=#{paperId}
- where b.paper_id=#{paperId} and a.question_type=#{questionType}
+ where b.paper_id=#{paperId}
+ order by a.question_type asc,a.id desc
+ </select>
+
+ <select id="selectByStudentId" resultMap="SimplePaperStudentResult">
+ select a.*,b.name as paper_name,c.id as company_id,c.name as company_name from ex_paper_student a
+ left join ex_exam_paper b on b.id=a.paper_id
+ left join sys_company c on c.id=b.company_id
+ </select>
+
+ <select id="selectNoCompleteStudent" resultMap="SimplePaperStudentResult">
+ select a.*, b.name as paper_name,b.limited,b.limit_time,b.deadline,b.single_num,b.multi_num,b.judge_num,b.easy_num
+ from ex_paper_student a
+ inner join ex_exam_paper b on b.id=a.paper_id
+ where a.state=0 limit #{startIndex},#{pageSize}
</select>
</mapper>
--
Gitblit v1.9.2