<!--查询试卷试题试卷详情开始-->
<resultMap id="getStudentExamObjectMap" type="PageData">
<id property="id" column="id"/>
<result property="ExamName" column="ExamName"/>
<result property="startTime" column="startTime"/>
<result property="endTime" column="endTime"/>
<result property="totalTime" column="totalTime"/>
<result property="description" column="description"/>
<result property="totalScore" column="totalScore"/>
<result property="passScore" column="passScore"/>
<result property="tips" column="tips"/>
<result property="frequency" column="frequency"/>
<result property="interval" column="interval"/>
<result property="leastTime" column="leastTime"/>
<result property="leastTimeIs" column="leastTimeIs"/>
<result property="updateTime" column="updateTime"/>
<collection property="list" column="{examId=id}"
ofType="PageData" javaType="java.util.ArrayList" select="getQuestionList">
<id column="id" property="id"/>
<result column="question" property="question"/>
<result column="answerA" property="answerA"/>
<result column="answerB" property="answerB"/>
<result column="answerC" property="answerC"/>
<result column="answerD" property="answerD"/>
<result column="rightAnswer" property="rightAnswer"/>
<result column="analysis" property="analysis"/>
<result column="score" property="score"/>
<result column="type" property="type"/>
</collection>
</resultMap>
<!--查询试卷-->
<select id="getStudentExamObject" parameterType="PageData" resultMap="getStudentExamObjectMap">
select em.id,em.exam_name as ExamName,
DATE_FORMAT(em.start_time, '%Y-%m-%d %H:%i:%s') as startTime, DATE_FORMAT(em.end_time, '%Y-%m-%d %H:%i:%s') as endTime,
em.total_time as totalTime,em.description as description,
em.total_score as totalScore, em.pass_score as passScore, em.tips, em.frequency, em.`interval`,
em.least_time as leastTime, em.least_time_is as leastTimeIs, DATE_FORMAT(em.update_time, '%Y-%m-%d') as updateTime from exam_manage as em
WHERE 1=1
<if test="examType != null">
AND em.exam_type = #{examType}
</if>
<if test="examId != null">
AND em.id = #{examId}
</if>
and em.is_delete = 0 and em.release=0
</select>
<!--查询试卷中试题-->
<select id="getQuestionList" parameterType="PageData" resultType="PageData">
SELECT
q.id, q.question,
q.answer_a AS answerA, q.answer_b AS answerB, q.answer_c AS answerC, q.answer_d AS answerD,
q.right_answer AS rightAnswer, q.analysis, q.score, q.type
FROM
question q
RIGHT JOIN paper_manage pm ON q.id = pm.question_id
WHERE 1=1
and pm.exam_id = #{examId}
and pm.is_delete = 0 and q.is_delete = 0
order by q.update_time desc
</select>
<!--查询试卷试题试卷详情结束-->
mybatis中使用返回pageData对象,中嵌入一个list
最新推荐文章于 2024-09-13 22:54:21 发布