Browse Source

fix 试卷题目

he2802 4 years ago
parent
commit
c695595ba2

+ 1 - 1
zhongzheng-admin/src/main/java/com/zhongzheng/controller/bank/QuestionController.java

@@ -50,7 +50,7 @@ public class QuestionController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo<QuestionVo> list(QuestionQueryBo bo) {
         startPage();
-        List<QuestionVo> list = iQuestionService.queryList(bo);
+        List<QuestionVo> list = iQuestionService.selectList(bo);
         return getDataTable(list);
     }
 

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionQueryBo.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
 
@@ -47,7 +48,7 @@ public class QuestionQueryBo extends BaseEntity {
 	private String answerQuestion;
 	/**  状态 1正常 0关闭 */
 	@ApiModelProperty(" 状态 1正常 0关闭")
-	private Integer status;
+	private List<Integer> status;
 	/** 解析文本 */
 	@ApiModelProperty("解析文本")
 	private String analysisContent;

+ 9 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/QuestionBusiness.java

@@ -36,4 +36,13 @@ private static final long serialVersionUID=1L;
     private Long subjectId;
     /** $column.columnComment */
     private Long questionId;
+
+    @TableField(exist = false)
+    private String educationName;
+    @TableField(exist = false)
+    private String projectName;
+    @TableField(exist = false)
+    private String businessName;
+    @TableField(exist = false)
+    private String subjectName;
 }

+ 7 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionMapper.java

@@ -1,7 +1,13 @@
 package com.zhongzheng.modules.bank.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.bank.bo.QuestionQueryBo;
 import com.zhongzheng.modules.bank.domain.Question;
+import com.zhongzheng.modules.bank.vo.QuestionVo;
+import com.zhongzheng.modules.course.bo.CourseQueryBo;
+import com.zhongzheng.modules.course.vo.CourseVo;
+
+import java.util.List;
 
 /**
  * 题库题目Mapper接口
@@ -10,5 +16,5 @@ import com.zhongzheng.modules.bank.domain.Question;
  * @date 2021-10-21
  */
 public interface QuestionMapper extends BaseMapper<Question> {
-
+    List<QuestionVo> selectList(QuestionQueryBo bo);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionService.java

@@ -23,6 +23,8 @@ public interface IQuestionService extends IService<Question> {
 	 * @return
 	 */
 	QuestionVo queryById(Long questionId);
+	List<QuestionVo> selectList(QuestionQueryBo bo);
+
 
 	/**
 	 * 查询列表

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -9,6 +9,7 @@ import com.zhongzheng.modules.bank.bo.*;
 import com.zhongzheng.modules.bank.domain.Question;
 import com.zhongzheng.modules.bank.domain.QuestionBusiness;
 import com.zhongzheng.modules.bank.mapper.QuestionMapper;
+import com.zhongzheng.modules.bank.service.IExamQuestionService;
 import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
 import com.zhongzheng.modules.bank.service.IQuestionService;
 import com.zhongzheng.modules.bank.vo.QuestionVo;
@@ -41,6 +42,8 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
     @Autowired
     private IQuestionBusinessService iQuestionBusinessService;
 
+    @Autowired
+    private QuestionMapper questionMapper;
 
     @Override
     public QuestionVo queryById(Long questionId){
@@ -48,6 +51,11 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
         return BeanUtil.toBean(db, QuestionVo.class);
     }
 
+    @Override
+    public List<QuestionVo> selectList(QuestionQueryBo bo) {
+        return questionMapper.selectList(bo);
+    }
+
     @Override
     public List<QuestionVo> queryList(QuestionQueryBo bo) {
         LambdaQueryWrapper<Question> lqw = Wrappers.lambdaQuery();

+ 7 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/vo/QuestionVo.java

@@ -2,11 +2,13 @@ package com.zhongzheng.modules.bank.vo;
 
 import com.zhongzheng.common.annotation.Excel;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.zhongzheng.modules.bank.domain.QuestionBusiness;
+import com.zhongzheng.modules.course.domain.CourseChapterBusiness;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import java.util.Date;
-
+import java.util.List;
 
 
 /**
@@ -84,4 +86,8 @@ public class QuestionVo {
 	@Excel(name = "编码")
 	@ApiModelProperty("编码")
 	private String code;
+
+	/** 业务层级列表 */
+	@ApiModelProperty("业务层级列表")
+	private List<QuestionBusiness> businessList;
 }

+ 64 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionMapper.xml

@@ -21,5 +21,69 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="code" column="code"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.bank.vo.QuestionVo" id="QuestionResultVo">
+        <result property="questionId" column="question_id"/>
+        <result property="content" column="content"/>
+        <result property="type" column="type"/>
+        <result property="answerQuestion" column="answer_question"/>
+        <result property="status" column="status"/>
+        <result property="analysisContent" column="analysis_content"/>
+        <result property="imgUrl" column="img_url"/>
+        <result property="jsonStr" column="json_str"/>
+        <result property="prefixName" column="prefix_name"/>
+        <result property="knowledgeIds" column="knowledge_ids"/>
+        <result property="publishStatus" column="publish_status"/>
+        <result property="code" column="code"/>
+        <collection property="businessList" javaType="java.util.List" resultMap="QuestionBusiness"/>
+    </resultMap>
+
+    <resultMap type="com.zhongzheng.modules.bank.domain.QuestionBusiness" id="QuestionBusiness">
+        <result property="id" column="id"/>
+        <result property="subjectId" column="subject_id"/>
+        <result property="educationTypeId" column="education_type_id"/>
+        <result property="businessId" column="business_id"/>
+        <result property="projectId" column="project_id"/>
+
+        <result property="educationName" column="education_name"/>
+        <result property="projectName" column="project_name"/>
+        <result property="businessName" column="business_name"/>
+        <result property="subjectName" column="subject_name"/>
+    </resultMap>
+
+    <select id="selectList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="QuestionResultVo">
+        SELECT
+        q.*,
+        cet.education_name,
+        cpt.project_name,
+        cb.business_name,
+        cs.subject_name
+        FROM
+        question q
+        LEFT JOIN question_business qb ON q.question_id = qb.question_id
+        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 q.status in
+            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
 
+        <if test="educationTypeId != null and educationTypeId != ''">
+            AND qb.education_type_id = #{educationTypeId}
+        </if>
+        <if test="subjectId != null and subjectId != ''">
+            AND qb.subject_id = #{subjectId}
+        </if>
+        <if test="businessId != null and businessId != ''">
+            AND qb.business_id = #{businessId}
+        </if>
+        <if test="prefixName != null and prefixName != ''">
+            AND q.prefix_name like concat('%', #{prefixName}, '%')
+        </if>
+    </select>
 </mapper>

+ 2 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml

@@ -56,6 +56,8 @@
         <result property="subjectName" column="subject_name"/>
     </resultMap>
 
+
+
     <select id="selectList" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo" resultMap="CourseResultVo">
         SELECT
         c.*,