he2802 2 년 전
부모
커밋
f8cc6995a1

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

@@ -22,7 +22,7 @@ public interface CourseModuleChapterMapper extends BaseMapper<CourseModuleChapte
 
     List<CourseUserModuleChapterVo> chapterList(CourseMenuQueryBo bo);
 
-    Integer rebuildChapterCheck(@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("gradeId") Long gradeId,@Param("userId") Long userId);
+    Integer rebuildChapterCheck(@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("gradeId") Long gradeId,@Param("userId") Long userId,@Param("examId") Long examId);
 
     List<CourseUserModuleChapterVo> examList(CourseMenuQueryBo bo);
 

+ 14 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseModuleChapterServiceImpl.java

@@ -130,11 +130,21 @@ public class CourseModuleChapterServiceImpl extends ServiceImpl<CourseModuleChap
                 if (courseUserModuleChapterVo.getModuleId() == null){
                     bo.setModuleId(0L);
                 }
-                //查询章是否重修章
-                Integer rebuild = baseMapper.rebuildChapterCheck(courseUserModuleChapterVo.getModuleId(),courseUserModuleChapterVo.getChapterId(), courseUserModuleChapterVo.getGradeId(), bo.getUserId());
-                if (rebuild > 0) {
-                    courseUserModuleChapterVo.setRebuild(1);
+                if(courseUserModuleChapterVo.getType()==1){
+                    //查询章是否重修章
+                    Integer rebuild = baseMapper.rebuildChapterCheck(courseUserModuleChapterVo.getModuleId(),courseUserModuleChapterVo.getChapterId(), courseUserModuleChapterVo.getGradeId(), bo.getUserId(),null);
+                    if (rebuild > 0) {
+                        courseUserModuleChapterVo.setRebuild(1);
+                    }
                 }
+                if(courseUserModuleChapterVo.getType()==2){
+                    //查询模块卷是否重修
+                    Integer rebuild = baseMapper.rebuildChapterCheck(courseUserModuleChapterVo.getModuleId(),null, courseUserModuleChapterVo.getGradeId(), bo.getUserId(),courseUserModuleChapterVo.getTypeId());
+                    if (rebuild > 0) {
+                        courseUserModuleChapterVo.setRebuild(1);
+                    }
+                }
+
             }
             List<CourseUserModuleChapterVo> courseUserModuleChapterVoList = courseUserModuleChapterVos.stream().filter(s ->
                     s.getRebuild() != null && s.getRebuild().equals(1)

+ 9 - 2
zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterSectionMapper.xml

@@ -228,7 +228,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           and up.chapter_id=#{chapterId}
           and up.section_id=#{typeId}
           and up.course_id=#{courseId}
-          and up.exam_id=#{examId}
+            <if test="examId != null ">
+                and up.exam_id=#{examId}
+                and up.`type` = 2
+            </if>
+
           AND ups.period_status =1
           and (ups.`status` = 0 or ups.`status` = 3)
     </select>
@@ -246,7 +250,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           and up.chapter_id=#{chapterId}
           and up.course_id=#{courseId}
           and up.section_id=#{typeId}
-          and up.exam_id=#{examId}
+            <if test="examId != null ">
+                and up.exam_id=#{examId}
+                and up.`type` = 2
+            </if>
           AND ups.period_status =1
           and ups.record_end_time is not null
     </select>

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

@@ -133,8 +133,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             up.grade_id =#{gradeId}
           AND up.user_id = #{userId}
           AND up.module_id= #{moduleId}
+        <if test="chapterId != null ">
           and up.chapter_id=#{chapterId}
+        </if>
           AND ups.period_status =1
+        <if test="examId != null ">
+            and up.exam_id=#{examId}
+            and up.`type` = 3
+        </if>
           and (ups.`status` = 0 or ups.`status` = 3)
     </select>