change 3 lat temu
rodzic
commit
8d4514c05c

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

@@ -6,6 +6,7 @@ import com.zhongzheng.modules.course.domain.CourseModuleChapter;
 import com.zhongzheng.modules.course.vo.CourseChapterSectionVo;
 import com.zhongzheng.modules.course.vo.CourseModuleChapterVo;
 import com.zhongzheng.modules.course.vo.CourseUserModuleChapterVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -19,4 +20,6 @@ public interface CourseModuleChapterMapper extends BaseMapper<CourseModuleChapte
     List<CourseModuleChapterVo> getListById(Long id);
 
     List<CourseUserModuleChapterVo> chapterList(CourseMenuQueryBo bo);
+
+    Integer rebuildChapterCheck(@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("gradeId") Long gradeId,@Param("userId") Long userId);
 }

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

@@ -141,7 +141,7 @@ public class CourseChapterSectionServiceImpl extends ServiceImpl<CourseChapterSe
                         courseMenuVo.setRebuild(1);
                     }
                 } else {
-                    Integer rebuild = baseMapper.rebuildCheck(0L, courseMenuVo.getGradeId(), bo.getUserId(), 0L, bo.getChapterId(), courseMenuVo.getTypeId());
+                    Integer rebuild = baseMapper.rebuildCheck(courseMenuVo.getTypeId(), courseMenuVo.getGradeId(), bo.getUserId(), 0L, bo.getChapterId(), courseMenuVo.getTypeId());
                     if (rebuild > 0) {
                         courseMenuVo.setRebuild(1);
                     }

+ 18 - 5
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseModuleChapterServiceImpl.java

@@ -8,10 +8,7 @@ import com.zhongzheng.modules.course.domain.CourseModuleChapter;
 import com.zhongzheng.modules.course.mapper.CourseChapterSectionMapper;
 import com.zhongzheng.modules.course.mapper.CourseModuleChapterMapper;
 import com.zhongzheng.modules.course.service.ICourseModuleChapterService;
-import com.zhongzheng.modules.course.vo.CourseChapterSectionVo;
-import com.zhongzheng.modules.course.vo.CourseModuleChapterVo;
-import com.zhongzheng.modules.course.vo.CourseSectionVo;
-import com.zhongzheng.modules.course.vo.CourseUserModuleChapterVo;
+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;
@@ -109,6 +106,22 @@ public class CourseModuleChapterServiceImpl extends ServiceImpl<CourseModuleChap
 
     @Override
     public List<CourseUserModuleChapterVo> chapterList(CourseMenuQueryBo bo) {
-        return baseMapper.chapterList(bo);
+        List<CourseUserModuleChapterVo> courseUserModuleChapterVos = baseMapper.chapterList(bo);
+        if (bo.getRebuild() != null && bo.getRebuild() == 1){
+            for (CourseUserModuleChapterVo courseUserModuleChapterVo : courseUserModuleChapterVos) {
+                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);
+                }
+            }
+            List<CourseUserModuleChapterVo> courseUserModuleChapterVoList = courseUserModuleChapterVos.stream().filter(s ->
+                    s.getRebuild() != null && s.getRebuild().equals(1)
+            ).collect(Collectors.toList());
+            return courseUserModuleChapterVoList;
+        }
+        return courseUserModuleChapterVos;
     }
 }

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

@@ -66,6 +66,11 @@ public class CourseUserModuleChapterVo {
 	@ApiModelProperty("$column.columnComment")
 	private Long sort;
 
+	/** 1模块卷 2章卷 3试卷 */
+	@Excel(name = "1 需重修")
+	@ApiModelProperty("1 需重修")
+	private Integer rebuild;
+
 	@Excel(name = "章下面的节")
 	@ApiModelProperty("章下面的节")
 	private List<CourseChapterSectionVo> courseChapterSectionList;

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

@@ -70,4 +70,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ORDER BY
             c_sort DESC
     </select>
+
+    <select id="rebuildChapterCheck" parameterType="map"  resultType="Integer">
+        SELECT
+            COUNT(up.id)
+        FROM
+            user_period up
+                LEFT JOIN user_period_status ups ON up.id = ups.period_id
+        WHERE
+            up.grade_id =#{gradeId}
+          AND up.user_id = #{userId}
+          AND up.module_id= #{moduleId}
+          and up.chapter_id=#{chapterId}
+          AND ups.period_status =1
+          and (ups.`status` = 0 or ups.`status` = 3)
+    </select>
+
 </mapper>