he2802 2 лет назад
Родитель
Сommit
cdfeae4b47

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionBusinessAddBo.java

@@ -33,4 +33,12 @@ public class QuestionBusinessAddBo {
     /** $column.columnComment */
     @ApiModelProperty("业务类型 1为题目业务 2试卷业务 3章业务 4模块业务")
     private Integer type;
+
+    private String educationName;
+
+    private String projectName;
+
+    private String businessName;
+
+    private String subjectName;
 }

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

@@ -3,6 +3,7 @@ package com.zhongzheng.modules.bank.vo;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.zhongzheng.common.annotation.Excel;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.zhongzheng.modules.bank.bo.QuestionBusinessAddBo;
 import com.zhongzheng.modules.course.vo.CourseGoodsVo;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import io.swagger.annotations.ApiModel;
@@ -158,4 +159,6 @@ public class ExamVo {
 	@Excel(name = "商品试卷限制终端学习,多个,拼接  1公众号 2小程序")
 	@ApiModelProperty("商品试卷限制终端学习,多个,拼接  1公众号 2小程序")
 	private String examLimitClient;
+	@ApiModelProperty("业务层级列表")
+	private List<QuestionBusinessAddBo> businessList;
 }

+ 30 - 18
zhongzheng-system/src/main/resources/mapper/modules/bank/ExamMapper.xml

@@ -62,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="paperName" column="paper_name"/>
         <result property="examLimitClient" column="exam_limit_client"/>
         <collection property="goodsList" column="exam_id" select="findGoodsList"/>
+        <collection property="businessList" column="exam_id" select="findBusinessList"/>
     </resultMap>
 
     <select id="findGoodsList" resultMap="GoodsListResult">
@@ -75,6 +76,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             ga.major_id =#{exam_id} AND ga.type = 3
     </select>
 
+    <select id="findBusinessList" resultType="com.zhongzheng.modules.bank.bo.QuestionBusinessAddBo">
+        SELECT
+            qb.education_type_id,
+            qb.business_id,
+            qb.project_id,
+            qb.subject_id,
+            cet.education_name,
+            cpt.project_name,
+            cb.business_name,
+            cs.subject_name
+        FROM
+            question_business qb
+                LEFT JOIN course_education_type cet ON qb.education_type_id = cet.id
+            LEFT JOIN course_project_type cpt ON qb.project_id = cpt.id
+            LEFT JOIN course_business cb ON qb.business_id = cb.id
+            LEFT JOIN course_subject cs ON cs.id = qb.subject_id
+        WHERE
+            qb.major_id =#{exam_id} AND qb.type = 2
+    </select>
+
     <resultMap type="com.zhongzheng.modules.bank.vo.ExamGoodsVo" id="GoodsListResult">
         <result property="goodsName" column="goods_name"/>
         <result property="goodsId" column="goods_id"/>
@@ -83,25 +104,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="getList" parameterType="com.zhongzheng.modules.bank.bo.ExamQueryBo" resultMap="ExamVoResult">
         SELECT
             e.*,
-        qb.education_type_id,
-        qb.business_id,
-        qb.project_id,
-        qb.subject_id,
-        cet.education_name,
-        cpt.project_name,
-        cb.business_name,
-        cs.subject_name,
         (SELECT count(*) FROM exam_question WHERE exam_id = e.exam_id)as question_num,
         ep.paper_name
         FROM
             exam e
                 LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id
-                LEFT JOIN question_business qb ON e.exam_id = qb.major_id
-                AND qb.type = 2
-                LEFT JOIN course_education_type cet ON qb.education_type_id = cet.id
-                LEFT JOIN course_project_type cpt ON qb.project_id = cpt.id
-                LEFT JOIN course_business cb ON qb.business_id = cb.id
-                LEFT JOIN course_subject cs ON cs.id = qb.subject_id
+
         where 1=1
         <if test="status != null and status.size()!=0 ">
             AND e.status in
@@ -119,19 +127,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             AND ep.paper_name like concat('%', #{paperName}, '%')
         </if>
         <if test="educationTypeId != null and educationTypeId != ''">
-            AND cet.id = #{educationTypeId}
+            AND (select count(*) from question_business qb
+             where qb.major_id =e.exam_id AND qb.type = 2 and qb.education_type_id = #{educationTypeId})>0
         </if>
         <if test="examId != null and examId != ''">
             AND e.exam_id = #{examId}
         </if>
         <if test="subjectId != null and subjectId != ''">
-            AND cs.id = #{subjectId}
+            AND (select count(*) from question_business qb
+            where qb.major_id =e.exam_id AND qb.type = 2 and qb.subject_id = #{subjectId})>0
         </if>
         <if test="businessId != null and businessId != ''">
-            AND cb.id = #{businessId}
+            AND (select count(*) from question_business qb
+            where qb.major_id =e.exam_id AND qb.type = 2 and qb.business_id  = #{businessId})>0
         </if>
         <if test="projectId != null and projectId != ''">
-            AND cpt.id = #{projectId}
+            AND (select count(*) from question_business qb
+            where qb.major_id =e.exam_id AND qb.type = 2 and qb.project_id = #{projectId})>0
         </if>
         <if test="examPaperId != null and examPaperId != ''">
             AND e.exam_paper_id = #{examPaperId}