Kaynağa Gözat

fix 试做配置

he2802 4 yıl önce
ebeveyn
işleme
eab5764c96

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/vo/ExamVo.java

@@ -97,4 +97,6 @@ public class ExamVo {
 	private BigDecimal passScore;
 
 	private Integer sort;
+	@ApiModelProperty("题目数")
+	private Integer questionNum;
 }

+ 12 - 2
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionChapterExamMapper.xml

@@ -28,15 +28,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="examPaperId" column="exam_paper_id"/>
         <result property="answerNum" column="answer_num"/>
         <result property="sort" column="exam_sort"/>
+        <result property="questionNum" column="question_num"/>
     </resultMap>
 
     <select id="getList" parameterType="com.zhongzheng.modules.bank.bo.QuestionChapterExamQueryBo" resultMap="QuestionChapterExamResultVo">
         SELECT
             e.*,
-               qce.sort as exam_sort
+            qce.sort AS exam_sort
         FROM
             question_chapter_exam qce
-                LEFT JOIN exam e ON qce.exam_id = e.exam_id
+                LEFT JOIN (
+                SELECT
+                    e.*,
+                    count( eq.question_id ) question_num
+                FROM
+                    exam e
+                        LEFT JOIN exam_question eq ON e.exam_id = eq.exam_id
+                GROUP BY
+                    e.exam_id
+            ) e ON qce.exam_id = e.exam_id
         WHERE
             qce.chapter_exam_id =#{chapterExamId}