Przeglądaj źródła

add 题库数目

he2802 4 lat temu
rodzic
commit
c7cd8ea627

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

@@ -52,7 +52,7 @@ public class QuestionBankController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo<QuestionBankVo> list(QuestionBankQueryBo bo) {
         startPage();
-        List<QuestionBankVo> list = iQuestionBankService.queryList(bo);
+        List<QuestionBankVo> list = iQuestionBankService.selectBankList(bo);
         return getDataTable(list);
     }
 

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionBankAddBo.java

@@ -60,4 +60,6 @@ public class QuestionBankAddBo {
     /** 教师ID拼接,用,拼接 */
     @ApiModelProperty("教师ID拼接,用,拼接")
     private String teacherIds;
+    @ApiModelProperty("排序")
+    private Integer sort;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionBankEditBo.java

@@ -71,4 +71,6 @@ public class QuestionBankEditBo {
     /** 教师ID拼接,用,拼接 */
     @ApiModelProperty("教师ID拼接,用,拼接")
     private String teacherIds;
+    @ApiModelProperty("排序")
+    private Integer sort;
 }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/QuestionBank.java

@@ -66,4 +66,10 @@ private static final long serialVersionUID=1L;
     /** 教师ID拼接,用,拼接 */
     private String teacherIds;
 
+    @TableField(exist = false)
+    private String categoryName;
+
+    private Integer questionNum;
+
+    private Integer sort;
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionBankMapper.java

@@ -1,7 +1,11 @@
 package com.zhongzheng.modules.bank.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.bank.bo.QuestionBankQueryBo;
 import com.zhongzheng.modules.bank.domain.QuestionBank;
+import com.zhongzheng.modules.bank.vo.QuestionBankVo;
+
+import java.util.List;
 
 /**
  * 题库Mapper接口
@@ -11,4 +15,5 @@ import com.zhongzheng.modules.bank.domain.QuestionBank;
  */
 public interface QuestionBankMapper extends BaseMapper<QuestionBank> {
 
+    List<QuestionBankVo> selectBankList(QuestionBankQueryBo bo);
 }

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

@@ -29,6 +29,8 @@ public interface IQuestionBankService extends IService<QuestionBank> {
 	 */
 	List<QuestionBankVo> queryList(QuestionBankQueryBo bo);
 
+	List<QuestionBankVo> selectBankList(QuestionBankQueryBo bo);
+
 	/**
 	 * 根据新增业务对象插入题库
 	 * @param bo 题库新增业务对象

+ 12 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionBankServiceImpl.java

@@ -10,6 +10,10 @@ import com.zhongzheng.modules.bank.domain.QuestionBank;
 import com.zhongzheng.modules.bank.mapper.QuestionBankMapper;
 import com.zhongzheng.modules.bank.service.IQuestionBankService;
 import com.zhongzheng.modules.bank.vo.QuestionBankVo;
+import com.zhongzheng.modules.course.bo.CourseQueryBo;
+import com.zhongzheng.modules.course.mapper.CourseMapper;
+import com.zhongzheng.modules.course.vo.CourseVo;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -31,6 +35,9 @@ import java.util.stream.Collectors;
 @Service
 public class QuestionBankServiceImpl extends ServiceImpl<QuestionBankMapper, QuestionBank> implements IQuestionBankService {
 
+    @Autowired
+    private QuestionBankMapper questionBankMapper;
+
     @Override
     public QuestionBankVo queryById(Long bankId){
         QuestionBank db = this.baseMapper.selectById(bankId);
@@ -53,6 +60,11 @@ public class QuestionBankServiceImpl extends ServiceImpl<QuestionBankMapper, Que
         return entity2Vo(this.list(lqw));
     }
 
+    @Override
+    public List<QuestionBankVo> selectBankList(QuestionBankQueryBo bo) {
+        return questionBankMapper.selectBankList(bo);
+    }
+
     /**
     * 实体类转化成视图对象
     *

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/vo/QuestionBankVo.java

@@ -65,5 +65,11 @@ public class QuestionBankVo {
 	@Excel(name = "教师ID拼接,用,拼接")
 	@ApiModelProperty("教师ID拼接,用,拼接")
 	private String teacherIds;
+	@ApiModelProperty("分类名")
+	private String categoryName;
+	@ApiModelProperty("题目数量")
+	private Integer questionNum;
+	@ApiModelProperty("排序")
+	private Integer sort;
 
 }

+ 18 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionBankMapper.xml

@@ -18,7 +18,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="status" column="status"/>
         <result property="typeId" column="type_id"/>
         <result property="teacherIds" column="teacher_ids"/>
+        <result property="categoryName" column="category_name"/>
+        <result property="questionNum" column="question_num"/>
+        <result property="sort" column="sort"/>
     </resultMap>
 
+    <select id="selectBankList" parameterType="com.zhongzheng.modules.bank.bo.QuestionBankQueryBo"  resultMap="QuestionBankResult">
+        SELECT qb.*,mc.category_name FROM question_bank qb LEFT JOIN major_category mc on qb.category_id = mc.category_id
+        <if test="status != null and status.size()!=0 ">
+            WHERE qb.status in
+            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="bankName != null and bankName != ''">
+            AND qb.bank_name like concat('%', #{bankName}, '%')
+        </if>
+        <if test="categoryId != null and categoryId != ''">
+            AND qb.category_id = #{categoryId}
+        </if>
+    </select>
 
 </mapper>