瀏覽代碼

通知列表

change 3 年之前
父節點
當前提交
4a393653ae

+ 16 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/inform/InformController.java

@@ -6,8 +6,10 @@ import java.util.Arrays;
 import com.zhongzheng.modules.course.bo.CourseQueryBo;
 import com.zhongzheng.modules.course.vo.CourseUserEducationTypeVo;
 import com.zhongzheng.modules.course.vo.CourseVo;
+import com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo;
 import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
 import com.zhongzheng.modules.goods.domain.Goods;
+import com.zhongzheng.modules.goods.vo.GoodsAttachedVo;
 import com.zhongzheng.modules.grade.bo.ClassGradeQueryBo;
 import com.zhongzheng.modules.grade.service.IClassGradeService;
 import com.zhongzheng.modules.grade.vo.ClassGradeStudentVo;
@@ -16,6 +18,7 @@ import com.zhongzheng.modules.grade.vo.ClassGradeVo;
 import com.zhongzheng.modules.inform.bo.InformUserQueryBo;
 import com.zhongzheng.modules.inform.service.IInformUserService;
 import com.zhongzheng.modules.inform.vo.CourseInformVo;
+import com.zhongzheng.modules.inform.vo.GoodsInformAttachedVo;
 import com.zhongzheng.modules.inform.vo.InformUserVo;
 import lombok.RequiredArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -155,6 +158,19 @@ public class InformController extends BaseController {
     }
 
 
+
+    /**
+     * 查询题目业务层次关系列表
+     */
+    @ApiOperation("查询商品题库列表")
+    @PreAuthorize("@ss.hasPermi('system:business:list')")
+    @GetMapping("/bank/list")
+    public AjaxResult<List<GoodsInformAttachedVo>> bankList(GoodsAttachedQueryBo bo) {
+        List<GoodsInformAttachedVo> list = iInformService.bankList(bo);
+        return AjaxResult.success(list);
+    }
+
+
     /**
      * 有多少学员无该课程或题库
      */

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

@@ -77,4 +77,7 @@ public class QuestionChapterVo {
 	@ApiModelProperty("试卷数量")
 	private Integer examNum;
 
+	@ApiModelProperty("章卷下的卷")
+	private List<ExamVo> examVos;
+
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/IInformService.java

@@ -1,8 +1,10 @@
 package com.zhongzheng.modules.inform.service;
 
+import com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo;
 import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
 import com.zhongzheng.modules.inform.domain.Inform;
 import com.zhongzheng.modules.inform.vo.CourseInformVo;
+import com.zhongzheng.modules.inform.vo.GoodsInformAttachedVo;
 import com.zhongzheng.modules.inform.vo.InformVo;
 import com.zhongzheng.modules.inform.bo.InformQueryBo;
 import com.zhongzheng.modules.inform.bo.InformAddBo;
@@ -57,4 +59,6 @@ public interface IInformService extends IService<Inform> {
 	Integer selectNum(InformAddBo bo);
 
     List<CourseInformVo> listGoodsCourse(GoodsQueryBo bo);
+
+	List<GoodsInformAttachedVo> bankList(GoodsAttachedQueryBo bo);
 }

+ 61 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/impl/InformServiceImpl.java

@@ -4,18 +4,28 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.SecurityUtils;
+import com.zhongzheng.modules.bank.bo.QuestionChapterExamQueryBo;
+import com.zhongzheng.modules.bank.bo.QuestionModuleChapterQueryBo;
+import com.zhongzheng.modules.bank.mapper.QuestionChapterExamMapper;
+import com.zhongzheng.modules.bank.mapper.QuestionModuleChapterMapper;
+import com.zhongzheng.modules.bank.vo.ExamVo;
+import com.zhongzheng.modules.bank.vo.QuestionChapterVo;
 import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
 import com.zhongzheng.modules.course.mapper.CourseChapterSectionMapper;
 import com.zhongzheng.modules.course.mapper.CourseModuleChapterMapper;
 import com.zhongzheng.modules.course.service.ICourseMenuService;
 import com.zhongzheng.modules.course.vo.CourseMenuVo;
 import com.zhongzheng.modules.course.vo.CourseModuleChapterVo;
+import com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo;
 import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
+import com.zhongzheng.modules.goods.mapper.GoodsAttachedMapper;
+import com.zhongzheng.modules.goods.vo.GoodsAttachedVo;
 import com.zhongzheng.modules.inform.bo.*;
 import com.zhongzheng.modules.inform.service.IInformCourseService;
 import com.zhongzheng.modules.inform.service.IInformExamService;
 import com.zhongzheng.modules.inform.service.IInformUserService;
 import com.zhongzheng.modules.inform.vo.CourseInformVo;
+import com.zhongzheng.modules.inform.vo.GoodsInformAttachedVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -60,6 +70,17 @@ public class InformServiceImpl extends ServiceImpl<InformMapper, Inform> impleme
     @Autowired
     private CourseModuleChapterMapper courseModuleChapterMapper;
 
+    @Autowired
+    private GoodsAttachedMapper goodsAttachedMapper;
+
+    @Autowired
+    private QuestionModuleChapterMapper questionModuleChapterMapper;
+
+    @Autowired
+    private QuestionChapterExamMapper questionChapterExamMapper;
+
+
+
     @Override
     public InformVo queryById(Long informId){
         Inform db = this.baseMapper.selectById(informId);
@@ -218,6 +239,46 @@ public class InformServiceImpl extends ServiceImpl<InformMapper, Inform> impleme
         return courseInformVos;
     }
 
+    @Override
+    public List<GoodsInformAttachedVo> bankList(GoodsAttachedQueryBo bo) {
+        List<GoodsInformAttachedVo> goodsInformAttachedVos = entity2BankVo(goodsAttachedMapper.selectList(bo));
+        for (GoodsInformAttachedVo goodsInformAttachedVo : goodsInformAttachedVos) {
+            if (goodsInformAttachedVo.getType().equals(1)){
+                QuestionModuleChapterQueryBo questionModuleChapterQueryBo = new QuestionModuleChapterQueryBo();
+                questionModuleChapterQueryBo.setModuleExamId(goodsInformAttachedVo.getMajorId());
+                List<QuestionChapterVo> list = questionModuleChapterMapper.getList(questionModuleChapterQueryBo);
+                for (QuestionChapterVo questionChapterVo : list) {
+                    QuestionChapterExamQueryBo questionChapterExamQueryBo = new QuestionChapterExamQueryBo();
+                    questionChapterExamQueryBo.setChapterExamId(questionChapterVo.getChapterExamId());
+                    List<ExamVo> list1 = questionChapterExamMapper.getList(questionChapterExamQueryBo);
+                    questionChapterVo.setExamVos(list1);
+                }
+                goodsInformAttachedVo.setQuestionChapterVos(list);
+            }
+            if (goodsInformAttachedVo.getType().equals(2)){
+                QuestionChapterExamQueryBo questionChapterExamQueryBo = new QuestionChapterExamQueryBo();
+                questionChapterExamQueryBo.setChapterExamId(goodsInformAttachedVo.getMajorId());
+                List<ExamVo> list1 = questionChapterExamMapper.getList(questionChapterExamQueryBo);
+                goodsInformAttachedVo.setExamVos(list1);
+            }
+        }
+        return goodsInformAttachedVos;
+    }
+
+
+    /**
+     * 实体类转化成视图对象
+     *
+     * @param collection 实体类集合
+     * @return
+     */
+    private List<GoodsInformAttachedVo> entity2BankVo(Collection<GoodsAttachedVo> collection) {
+        List<GoodsInformAttachedVo> voList = collection.stream()
+                .map(any -> BeanUtil.toBean(any, GoodsInformAttachedVo.class))
+                .collect(Collectors.toList());
+
+        return voList;
+    }
     public Integer selectNumList(Long userId, List<InformExamAddBo> informExamAddBos,List<InformCourseAddBo> informCourseAddBos) {
         Integer number = 0;
             for (InformExamAddBo informExamAddBo : informExamAddBos) {

+ 61 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/vo/GoodsInformAttachedVo.java

@@ -0,0 +1,61 @@
+package com.zhongzheng.modules.inform.vo;
+
+import com.zhongzheng.common.annotation.Excel;
+import com.zhongzheng.modules.bank.vo.ExamVo;
+import com.zhongzheng.modules.bank.vo.QuestionChapterVo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+
+/**
+ * 商品附加产品视图对象 mall_package
+ *
+ * @author  hjl
+ * @date 2021-10-28
+ */
+@Data
+@ApiModel("商品附加产品视图对象")
+public class GoodsInformAttachedVo {
+	private static final long serialVersionUID = 1L;
+
+	/** $pkColumn.columnComment */
+	@ApiModelProperty("$pkColumn.columnComment")
+	private Long id;
+
+	/** 商品id */
+	@Excel(name = "商品id")
+	@ApiModelProperty("商品id")
+	private Long goodsId;
+	/** 主ID */
+	@Excel(name = "主ID")
+	@ApiModelProperty("主ID")
+	private Long majorId;
+	/** 排序 */
+	@Excel(name = "排序")
+	@ApiModelProperty("排序")
+	private Integer sort;
+	/** 1模块卷 2章卷 3试卷 */
+	@Excel(name = "1模块卷 2章卷 3试卷")
+	@ApiModelProperty("1模块卷 2章卷 3试卷")
+	private Integer type;
+
+	@ApiModelProperty("卷名")
+	private String name;
+
+	@ApiModelProperty("科目名")
+	private String subjectName;
+
+	@ApiModelProperty("题目数")
+	private Integer questionNum;
+
+
+	@ApiModelProperty("模塊下的章卷")
+	private List<QuestionChapterVo> questionChapterVos;
+
+	@ApiModelProperty("章卷下的卷")
+	private List<ExamVo> examVos;
+
+}