Bläddra i källkod

fix 题目列表

he2802 3 år sedan
förälder
incheckning
e7a3312b1d

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

@@ -16,6 +16,7 @@ import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
 import com.zhongzheng.modules.bank.service.IQuestionService;
 import com.zhongzheng.modules.bank.vo.QuestionBusinessVo;
 import com.zhongzheng.modules.bank.vo.QuestionVo;
+import com.zhongzheng.modules.goods.vo.GoodsVo;
 import lombok.RequiredArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -57,19 +58,9 @@ public class QuestionController extends BaseController {
     @PreAuthorize("@ss.hasPermi('system:question:list')")
     @GetMapping("/list")
     public TableDataInfo<QuestionVo> list(QuestionQueryBo bo) {
-        if(bo.getPageNum()>0){
-            bo.setCurrIndex((bo.getPageNum()-1)*bo.getPageSize());
-            bo.setPageSizeSelf(bo.getPageSize());
-            bo.setPageNum(null);
-            bo.setPageSize(null);
-        }
+        startPage();
         List<QuestionVo> list = iQuestionService.selectList(bo);
-        TableDataInfo<QuestionVo> rspData = new TableDataInfo();
-        rspData.setCode(HttpStatus.HTTP_OK);
-        rspData.setMsg("查询成功");
-        rspData.setRows(list);
-        rspData.setTotal(iQuestionService.selectListCount(bo));
-        return rspData;
+        return getDataTable(list);
     }
 
     /**

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

@@ -17,5 +17,5 @@ import java.util.List;
  */
 public interface QuestionMapper extends BaseMapper<Question> {
     List<QuestionVo> selectList(QuestionQueryBo bo);
-    Long selectListCount(QuestionQueryBo bo);
+
 }

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

@@ -26,7 +26,7 @@ public interface IQuestionService extends IService<Question> {
 
 	List<QuestionVo> selectList(QuestionQueryBo bo);
 
-	Long selectListCount(QuestionQueryBo bo);
+
 
 
 	/**

+ 1 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -56,10 +56,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
         return questionMapper.selectList(bo);
     }
 
-    @Override
-    public Long selectListCount(QuestionQueryBo bo) {
-        return questionMapper.selectListCount(bo);
-    }
+
 
     @Override
     public List<QuestionVo> queryList(QuestionQueryBo bo) {

+ 35 - 36
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionMapper.xml

@@ -34,10 +34,40 @@
         <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"/>
-        <collection property="knowledgeList" javaType="java.util.List" resultMap="ExamKnowledge"/>
+        <collection property="businessList" column="question_id" select="findBusinessList" />
+        <collection property="knowledgeList" column="knowledge_ids" select="findKnowledge"/>
     </resultMap>
 
+    <select id="findKnowledge" resultMap="ExamKnowledge">
+        SELECT
+            ek.knowledge_name,
+            ek.knowledge_id
+        FROM
+            exam_knowledge ek
+        WHERE
+            FIND_IN_SET( ek.knowledge_id, #{knowledge_ids} )
+    </select>
+    <select id="findBusinessList" resultMap="QuestionBusiness">
+        SELECT
+            qb.education_type_id,
+            qb.business_id,
+            qb.project_id,
+            qb.subject_id,
+            qb.type as business_type,
+            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=#{question_id} and qb.type = 1
+    </select>
+
     <resultMap type="com.zhongzheng.modules.bank.domain.QuestionBusiness" id="QuestionBusiness">
         <result property="id" column="id"/>
         <result property="subjectId" column="subject_id"/>
@@ -58,21 +88,7 @@
     </resultMap>
 
     <select id="selectList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="QuestionResultVo">
-        SELECT
-        q.*,
-        qb.education_type_id,
-        qb.business_id,
-        qb.project_id,
-        qb.subject_id,
-        qb.type as business_type,
-        cet.education_name,
-        cpt.project_name,
-        cb.business_name,
-        cs.subject_name,
-        ek.knowledge_name,
-        ek.knowledge_id
-        FROM
-        (SELECT DISTINCT
+       SELECT DISTINCT
         q.*
         FROM
         question q
@@ -102,27 +118,10 @@
         <if test="pageSizeSelf != null and pageSizeSelf != ''">
             LIMIT #{currIndex} , #{pageSizeSelf}
         </if>
-       )q
-        LEFT JOIN question_business qb ON q.question_id = qb.major_id and qb.type = 1
-        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
-        LEFT JOIN exam_knowledge ek ON FIND_IN_SET( ek.knowledge_id, q.knowledge_ids )
-        WHERE
-        1 = 1
-        <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>
+
     </select>
 
-    <select id="selectListCount" resultType="Long">
+    <select id="selectList_COUNT" resultType="Long">
         SELECT
         count(distinct q.question_id)
         FROM