Browse Source

fix 试做配置

he2802 4 years ago
parent
commit
ccd9f766b9

+ 29 - 3
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsAttachedMapper.xml

@@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="type" column="type"/>
         <result property="name" column="name"/>
         <result property="subjectName" column="subject_name"/>
+        <result property="questionNum" column="question_num"/>
     </resultMap>
 
     <select id="selectList" parameterType="com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo" resultMap="GoodsAttachedResultVo">
@@ -37,14 +38,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     e.exam_name
                 END name,
             CASE
-
                 WHEN ga.type = 1 THEN
                     cs.subject_name
                 WHEN ga.type = 2 THEN
                     cs1.subject_name
                 WHEN ga.type = 3 THEN
                     cs2.subject_name
-                END subject_name
+                END subject_name,
+            CASE
+                WHEN ga.type = 1 THEN
+                    0
+                WHEN ga.type = 2 THEN
+                    0
+                WHEN ga.type = 3 THEN
+                    e.question_num
+                END question_num,
+            CASE
+
+                WHEN ga.type = 1 THEN
+                    qm.publish_status
+                WHEN ga.type = 2 THEN
+                    qc.publish_status
+                WHEN ga.type = 3 THEN
+                    e.publish_status
+                END publish_status
         FROM
             goods_attached ga
                 LEFT JOIN question_module qm ON ga.major_id = qm.module_exam_id
@@ -57,7 +74,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 LEFT JOIN question_business qb1 ON qb1.major_id = qc.chapter_exam_id
                 AND qb1.type = 3
                 LEFT JOIN course_subject cs1 ON qb1.subject_id = cs1.id
-                LEFT JOIN exam e ON ga.major_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 ga.major_id = e.exam_id
                 AND ga.type = 3
                 LEFT JOIN question_business qb2 ON qb2.major_id = e.exam_id
                 AND qb2.type = 2