瀏覽代碼

fix 模块卷

he2802 3 年之前
父節點
當前提交
4f6eb025be

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseChapterSectionMapper.java

@@ -40,6 +40,9 @@ public interface CourseChapterSectionMapper extends BaseMapper<CourseChapterSect
     Integer learningExamCheck(@Param("typeId") Long typeId,@Param("gradeId") Long gradeId,
                           @Param("userId") Long userId,@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("examId") Long examId,@Param("courseId") Long courseId);
 
+    Integer learningSectionExamCheck(@Param("typeId") Long typeId,@Param("gradeId") Long gradeId,
+                              @Param("userId") Long userId,@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("examId") Long examId,@Param("courseId") Long courseId,@Param("sectionId") Long sectionId);
+
     Long getStudyDuration(@Param("typeId") Long typeId,@Param("gradeId") Long gradeId,
                           @Param("userId") Long userId,@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("examId") Long examId,@Param("courseId") Long courseId);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseModuleChapterMapper.java

@@ -25,4 +25,7 @@ public interface CourseModuleChapterMapper extends BaseMapper<CourseModuleChapte
     Integer rebuildChapterCheck(@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("gradeId") Long gradeId,@Param("userId") Long userId);
 
     List<CourseUserModuleChapterVo> examList(CourseMenuQueryBo bo);
+
+    Integer learningExamCheck(@Param("typeId") Long typeId,@Param("gradeId") Long gradeId,
+                              @Param("userId") Long userId,@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("examId") Long examId,@Param("courseId") Long courseId);
 }

+ 9 - 5
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseChapterSectionServiceImpl.java

@@ -11,10 +11,7 @@ import com.zhongzheng.modules.course.domain.CourseStreamingBusiness;
 import com.zhongzheng.modules.course.mapper.CourseChapterMapper;
 import com.zhongzheng.modules.course.mapper.CourseChapterSectionMapper;
 import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
-import com.zhongzheng.modules.course.vo.CourseChapterSectionVo;
-import com.zhongzheng.modules.course.vo.CourseUserChapterSectionVo;
-import com.zhongzheng.modules.course.vo.CourseUserMenuVo;
-import com.zhongzheng.modules.course.vo.CourseUserVo;
+import com.zhongzheng.modules.course.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -192,6 +189,13 @@ public class CourseChapterSectionServiceImpl extends ServiceImpl<CourseChapterSe
 
     @Override
     public List<CourseUserChapterSectionVo> sectionExamList(CourseMenuQueryBo bo) {
-        return baseMapper.sectionExamList(bo);
+        List<CourseUserChapterSectionVo> examList = baseMapper.sectionExamList(bo);
+        for(CourseUserChapterSectionVo vo : examList){
+            Integer learning = baseMapper.learningSectionExamCheck(0L, vo.getGradeId(), bo.getUserId(), bo.getModuleId(), bo.getChapterId(), vo.getTypeId(),bo.getCourseId(),vo.getSectionId());
+            if(Validator.isNotEmpty(learning)){
+                vo.setLearning(new Long(learning));
+            }
+        }
+        return examList;
     }
 }

+ 9 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseModuleChapterServiceImpl.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.course.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.zhongzheng.common.utils.DateUtils;
@@ -109,7 +110,14 @@ public class CourseModuleChapterServiceImpl extends ServiceImpl<CourseModuleChap
     public List<CourseUserModuleChapterVo> chapterList(CourseMenuQueryBo bo) {
         List<CourseUserModuleChapterVo> courseUserModuleChapterVos = baseMapper.chapterList(bo);
         if (!CollectionUtils.isEmpty(courseUserModuleChapterVos)) {
-            courseUserModuleChapterVos.addAll(baseMapper.examList(bo));
+            List<CourseUserModuleChapterVo> examList = baseMapper.examList(bo);
+            for(CourseUserModuleChapterVo vo : examList){
+                Integer learning = baseMapper.learningExamCheck(0L, vo.getGradeId(), bo.getUserId(), bo.getModuleId(), bo.getChapterId(), vo.getTypeId(),bo.getCourseId());
+                if(Validator.isNotEmpty(learning)){
+                    vo.setLearning(new Long(learning));
+                }
+            }
+            courseUserModuleChapterVos.addAll(examList);
         }
 
         //获得重修目录

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseUserModuleChapterVo.java

@@ -99,4 +99,6 @@ public class CourseUserModuleChapterVo {
 	private Long answerNum;
 	@ApiModelProperty("做次数")
 	private Long doNum;
+	@ApiModelProperty("1已学习")
+	private Long learning;
 }

+ 21 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterSectionMapper.xml

@@ -279,6 +279,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND ubr.chapter_id = #{chapterId}
           AND ubr.exam_id = #{examId}
           AND ubr.current_status = 1
+          AND ubr.type = 1
+        ORDER BY
+            ubr.record_id DESC
+            LIMIT 1
+    </select>
+
+    <select id="learningSectionExamCheck" parameterType="map"  resultType="integer">
+        SELECT
+            IFNULL(MAX(ubr.report_status),-1)
+        FROM
+            user_bank_record ubr
+        WHERE
+            ubr.grade_id = #{gradeId}
+          AND ubr.user_id = #{userId}
+          AND ubr.module_id = #{moduleId}
+          AND ubr.course_id=#{courseId}
+          AND ubr.chapter_id = #{chapterId}
+          AND ubr.section_id = #{sectionId}
+          AND ubr.exam_id = #{examId}
+          AND ubr.current_status = 1
+          AND ubr.type = 2
         ORDER BY
             ubr.record_id DESC
             LIMIT 1

+ 18 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseModuleChapterMapper.xml

@@ -138,4 +138,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           and (ups.`status` = 0 or ups.`status` = 3)
     </select>
 
+    <select id="learningExamCheck" parameterType="map"  resultType="integer">
+        SELECT
+            IFNULL(MAX(ubr.report_status),-1)
+        FROM
+            user_bank_record ubr
+        WHERE
+            ubr.grade_id = #{gradeId}
+          AND ubr.user_id = #{userId}
+          AND ubr.module_id = #{moduleId}
+          AND ubr.course_id=#{courseId}
+          AND ubr.exam_id = #{examId}
+          AND ubr.current_status = 1
+          AND ubr.type = 3
+        ORDER BY
+            ubr.record_id DESC
+            LIMIT 1
+    </select>
+
 </mapper>