作者 wyk

更新 答题记录,顺序

... ... @@ -4,22 +4,24 @@
<mapper namespace="com.chuanqi.reading.home.dao.CourseAnswerDao">
<!--查询答题记录-->
<select id="listCourseAnswer" parameterType="java.lang.Long" resultType="com.chuanqi.reading.home.vo.CourseAnswerVO">
SELECT ca.id,ca.relation_type relationType,ca.answer inputAnswer,ca.answer_status answerStatus,
cc.choice_question title,cc.optionA,cc.optionB,cc.optionC,cc.optionD,cc.optionE, cc.optionF, cc.optionG, cc.optionH, cc.optionI,
cc.choice_answer titleAnswer,cc.support_answer supportAnswer
FROM course_answer ca LEFT JOIN course_choice cc ON ca.relation_id = cc.choice_id
WHERE ca.relation_type = 1 AND ca.progress_id = #{progressId}
UNION
SELECT ca.id,ca.relation_type relationType,ca.answer inputAnswer,ca.answer_status answerStatus,
cf.fill_question title,null optionA,null optionB,null optionC,null optionD,null optionE, null optionF, null optionG, null optionH, null optionI,
cf.fill_answer titleAnswer,cf.support_answer supportAnswer
FROM course_answer ca LEFT JOIN course_fill cf ON ca.relation_id = cf.fill_id
WHERE ca.relation_type = 2 AND ca.progress_id = #{progressId}
UNION
SELECT ca.id,ca.relation_type relationType,ca.answer inputAnswer,ca.answer_status answerStatus,
cj.judge_question title,null optionA,null optionB,null optionC,null optionD,null optionE, null optionF, null optionG, null optionH, null optionI,
cj.judge_answer titleAnswer,null supportAnswer
FROM course_answer ca LEFT JOIN course_judge cj ON ca.relation_id = cj.judge_id
WHERE ca.relation_type = 3 AND ca.progress_id = #{progressId}
SELECT * FROM (
SELECT ca.id,ca.relation_type relationType,ca.answer inputAnswer,ca.answer_status answerStatus,
cc.choice_question title,cc.optionA,cc.optionB,cc.optionC,cc.optionD,cc.optionE, cc.optionF, cc.optionG, cc.optionH, cc.optionI,
cc.choice_answer titleAnswer,cc.support_answer supportAnswer
FROM course_answer ca LEFT JOIN course_choice cc ON ca.relation_id = cc.choice_id
WHERE ca.relation_type = 1 AND ca.progress_id = #{progressId}
UNION
SELECT ca.id,ca.relation_type relationType,ca.answer inputAnswer,ca.answer_status answerStatus,
cf.fill_question title,null optionA,null optionB,null optionC,null optionD,null optionE, null optionF, null optionG, null optionH, null optionI,
cf.fill_answer titleAnswer,cf.support_answer supportAnswer
FROM course_answer ca LEFT JOIN course_fill cf ON ca.relation_id = cf.fill_id
WHERE ca.relation_type = 2 AND ca.progress_id = #{progressId}
UNION
SELECT ca.id,ca.relation_type relationType,ca.answer inputAnswer,ca.answer_status answerStatus,
cj.judge_question title,null optionA,null optionB,null optionC,null optionD,null optionE, null optionF, null optionG, null optionH, null optionI,
cj.judge_answer titleAnswer,null supportAnswer
FROM course_answer ca LEFT JOIN course_judge cj ON ca.relation_id = cj.judge_id
WHERE ca.relation_type = 3 AND ca.progress_id = #{progressId}
) tm ORDER BY tm.id
</select>
</mapper>
\ No newline at end of file
... ...