作者 wyk

更新 答题记录,顺序

@@ -4,22 +4,24 @@ @@ -4,22 +4,24 @@
4 <mapper namespace="com.chuanqi.reading.home.dao.CourseAnswerDao"> 4 <mapper namespace="com.chuanqi.reading.home.dao.CourseAnswerDao">
5 <!--查询答题记录--> 5 <!--查询答题记录-->
6 <select id="listCourseAnswer" parameterType="java.lang.Long" resultType="com.chuanqi.reading.home.vo.CourseAnswerVO"> 6 <select id="listCourseAnswer" parameterType="java.lang.Long" resultType="com.chuanqi.reading.home.vo.CourseAnswerVO">
7 - SELECT ca.id,ca.relation_type relationType,ca.answer inputAnswer,ca.answer_status answerStatus,  
8 - cc.choice_question title,cc.optionA,cc.optionB,cc.optionC,cc.optionD,cc.optionE, cc.optionF, cc.optionG, cc.optionH, cc.optionI,  
9 - cc.choice_answer titleAnswer,cc.support_answer supportAnswer  
10 - FROM course_answer ca LEFT JOIN course_choice cc ON ca.relation_id = cc.choice_id  
11 - WHERE ca.relation_type = 1 AND ca.progress_id = #{progressId}  
12 - UNION  
13 - SELECT ca.id,ca.relation_type relationType,ca.answer inputAnswer,ca.answer_status answerStatus,  
14 - cf.fill_question title,null optionA,null optionB,null optionC,null optionD,null optionE, null optionF, null optionG, null optionH, null optionI,  
15 - cf.fill_answer titleAnswer,cf.support_answer supportAnswer  
16 - FROM course_answer ca LEFT JOIN course_fill cf ON ca.relation_id = cf.fill_id  
17 - WHERE ca.relation_type = 2 AND ca.progress_id = #{progressId}  
18 - UNION  
19 - SELECT ca.id,ca.relation_type relationType,ca.answer inputAnswer,ca.answer_status answerStatus,  
20 - cj.judge_question title,null optionA,null optionB,null optionC,null optionD,null optionE, null optionF, null optionG, null optionH, null optionI,  
21 - cj.judge_answer titleAnswer,null supportAnswer  
22 - FROM course_answer ca LEFT JOIN course_judge cj ON ca.relation_id = cj.judge_id  
23 - WHERE ca.relation_type = 3 AND ca.progress_id = #{progressId} 7 + SELECT * FROM (
  8 + SELECT ca.id,ca.relation_type relationType,ca.answer inputAnswer,ca.answer_status answerStatus,
  9 + cc.choice_question title,cc.optionA,cc.optionB,cc.optionC,cc.optionD,cc.optionE, cc.optionF, cc.optionG, cc.optionH, cc.optionI,
  10 + cc.choice_answer titleAnswer,cc.support_answer supportAnswer
  11 + FROM course_answer ca LEFT JOIN course_choice cc ON ca.relation_id = cc.choice_id
  12 + WHERE ca.relation_type = 1 AND ca.progress_id = #{progressId}
  13 + UNION
  14 + SELECT ca.id,ca.relation_type relationType,ca.answer inputAnswer,ca.answer_status answerStatus,
  15 + cf.fill_question title,null optionA,null optionB,null optionC,null optionD,null optionE, null optionF, null optionG, null optionH, null optionI,
  16 + cf.fill_answer titleAnswer,cf.support_answer supportAnswer
  17 + FROM course_answer ca LEFT JOIN course_fill cf ON ca.relation_id = cf.fill_id
  18 + WHERE ca.relation_type = 2 AND ca.progress_id = #{progressId}
  19 + UNION
  20 + SELECT ca.id,ca.relation_type relationType,ca.answer inputAnswer,ca.answer_status answerStatus,
  21 + cj.judge_question title,null optionA,null optionB,null optionC,null optionD,null optionE, null optionF, null optionG, null optionH, null optionI,
  22 + cj.judge_answer titleAnswer,null supportAnswer
  23 + FROM course_answer ca LEFT JOIN course_judge cj ON ca.relation_id = cj.judge_id
  24 + WHERE ca.relation_type = 3 AND ca.progress_id = #{progressId}
  25 + ) tm ORDER BY tm.id
24 </select> 26 </select>
25 </mapper> 27 </mapper>