ソースを参照

fix 考试重点

he2802 4 年 前
コミット
f2d7a87c22

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

@@ -51,7 +51,7 @@ public class ExamNoteController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo<ExamNoteVo> list(ExamNoteQueryBo bo) {
         startPage();
-        List<ExamNoteVo> list = iExamNoteService.queryList(bo);
+        List<ExamNoteVo> list = iExamNoteService.selectExamNoteList(bo);
         return getDataTable(list);
     }
 

+ 3 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/ExamNoteQueryBo.java

@@ -1,11 +1,13 @@
 package com.zhongzheng.modules.bank.bo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
 
@@ -57,7 +59,7 @@ public class ExamNoteQueryBo extends BaseEntity {
 	private String introduction;
 	/** 状态 1正常 0关闭 */
 	@ApiModelProperty("状态 1正常 0关闭")
-	private Integer status;
+	private List<Integer> status;
 	/** 文件url,用,拼接 */
 	@ApiModelProperty("文件url,用,拼接")
 	private String fileUrls;

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/ExamNote.java

@@ -62,5 +62,6 @@ private static final long serialVersionUID=1L;
 
     /** 排序 */
     private Long sort;
-
+    @TableField(exist = false)
+    private String categoryName;
 }

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

@@ -1,7 +1,13 @@
 package com.zhongzheng.modules.bank.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.bank.bo.ExamNoteQueryBo;
 import com.zhongzheng.modules.bank.domain.ExamNote;
+import com.zhongzheng.modules.bank.vo.ExamNoteVo;
+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.ExamNote;
  * @date 2021-05-21
  */
 public interface ExamNoteMapper extends BaseMapper<ExamNote> {
-
+    List<ExamNoteVo> selectExamNoteList(ExamNoteQueryBo bo);
 }

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

@@ -28,6 +28,8 @@ public interface IExamNoteService extends IService<ExamNote> {
 	 */
 	List<ExamNoteVo> queryList(ExamNoteQueryBo bo);
 
+	List<ExamNoteVo> selectExamNoteList(ExamNoteQueryBo bo);
+
 	/**
 	 * 根据新增业务对象插入考试重点
 	 * @param bo 考试重点新增业务对象

+ 11 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamNoteServiceImpl.java

@@ -10,6 +10,8 @@ import com.zhongzheng.modules.bank.domain.ExamNote;
 import com.zhongzheng.modules.bank.mapper.ExamNoteMapper;
 import com.zhongzheng.modules.bank.service.IExamNoteService;
 import com.zhongzheng.modules.bank.vo.ExamNoteVo;
+import com.zhongzheng.modules.course.mapper.CourseMapper;
+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;
@@ -30,6 +32,9 @@ import java.util.stream.Collectors;
 @Service
 public class ExamNoteServiceImpl extends ServiceImpl<ExamNoteMapper, ExamNote> implements IExamNoteService {
 
+    @Autowired
+    private ExamNoteMapper examNoteMapper;
+
     @Override
     public ExamNoteVo queryById(Long fileId){
         ExamNote db = this.baseMapper.selectById(fileId);
@@ -45,12 +50,17 @@ public class ExamNoteServiceImpl extends ServiceImpl<ExamNoteMapper, ExamNote> i
         lqw.eq(bo.getPrice() != null, ExamNote::getPrice, bo.getPrice());
         lqw.eq(StrUtil.isNotBlank(bo.getCoverUrl()), ExamNote::getCoverUrl, bo.getCoverUrl());
         lqw.eq(StrUtil.isNotBlank(bo.getIntroduction()), ExamNote::getIntroduction, bo.getIntroduction());
-        lqw.eq(bo.getStatus() != null, ExamNote::getStatus, bo.getStatus());
+        lqw.in(bo.getStatus() != null, ExamNote::getStatus, bo.getStatus());
         lqw.eq(StrUtil.isNotBlank(bo.getFileUrls()), ExamNote::getFileUrls, bo.getFileUrls());
         lqw.eq(bo.getSort() != null, ExamNote::getSort, bo.getSort());
         return entity2Vo(this.list(lqw));
     }
 
+    @Override
+    public List<ExamNoteVo> selectExamNoteList(ExamNoteQueryBo bo) {
+        return examNoteMapper.selectExamNoteList(bo);
+    }
+
     /**
     * 实体类转化成视图对象
     *

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/vo/ExamNoteVo.java

@@ -61,5 +61,7 @@ public class ExamNoteVo {
 	@Excel(name = "排序")
 	@ApiModelProperty("排序")
 	private Long sort;
+	@ApiModelProperty("分类名")
+	private String categoryName;
 
 }

+ 16 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/ExamNoteMapper.xml

@@ -17,7 +17,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="status" column="status"/>
         <result property="fileUrls" column="file_urls"/>
         <result property="sort" column="sort"/>
+        <result property="categoryName" column="category_name"/>
     </resultMap>
 
+    <select id="selectExamNoteList" parameterType="com.zhongzheng.modules.bank.bo.ExamNoteQueryBo"  resultMap="ExamNoteResult">
+        SELECT en.*,mc.category_name from exam_note en LEFT JOIN major_category mc on en.category_id = mc.category_id
+        <if test="status != null and status.size()!=0 ">
+            WHERE en.status in
+            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="name != null and name != ''">
+            AND en.name like concat('%', #{name}, '%')
+        </if>
+        <if test="categoryId != null and categoryId != ''">
+            AND en.category_id = #{categoryId}
+        </if>
+    </select>
 
 </mapper>