change 4 gadi atpakaļ
vecāks
revīzija
cc69ec58d0

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

@@ -6,7 +6,9 @@ import com.zhongzheng.modules.course.domain.CourseChapterBusiness;
 import com.zhongzheng.modules.course.domain.CourseChapterSection;
 import com.zhongzheng.modules.course.vo.CourseChapterSectionVo;
 import com.zhongzheng.modules.course.vo.CourseUserChapterSectionVo;
+import org.apache.ibatis.annotations.Param;
 
+import java.util.Collection;
 import java.util.List;
 
 /**
@@ -21,4 +23,9 @@ public interface CourseChapterSectionMapper extends BaseMapper<CourseChapterSect
     Long getListTotalTime(Long id);
 
     List<CourseUserChapterSectionVo> sectionList(CourseMenuQueryBo bo);
+
+    List<CourseUserChapterSectionVo> examList(CourseMenuQueryBo bo);
+
+    Integer rebuildCheck(@Param("typeId") Long typeId,@Param("gradeId") Long gradeId,
+                         @Param("userId") Long userId,@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("examId") Long examId);
 }

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

@@ -11,6 +11,7 @@ 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 org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -131,6 +132,20 @@ public class CourseChapterSectionServiceImpl extends ServiceImpl<CourseChapterSe
     @Override
     public List<CourseUserChapterSectionVo> sectionList(CourseMenuQueryBo bo) {
         List<CourseUserChapterSectionVo> courseUserChapterSectionVos = courseChapterSectionMapper.sectionList(bo);
-        return null;
+        courseUserChapterSectionVos.addAll(courseChapterSectionMapper.examList(bo));
+        for (CourseUserChapterSectionVo courseMenuVo : courseUserChapterSectionVos) {
+            if (courseMenuVo.getType().equals(1)){
+                Integer rebuild = baseMapper.rebuildCheck(courseMenuVo.getTypeId(),courseMenuVo.getGradeId(),bo.getUserId(),bo.getModuleId(),bo.getChapterId(),0L);
+                if (rebuild > 0){
+                    courseMenuVo.setRebuild(1);
+                }
+            }else {
+                Integer rebuild = baseMapper.rebuildCheck(0L,courseMenuVo.getGradeId(),bo.getUserId(),0L,bo.getChapterId(),courseMenuVo.getTypeId());
+                if (rebuild > 0){
+                    courseMenuVo.setRebuild(1);
+                }
+            }
+        }
+        return courseUserChapterSectionVos;
     }
 }

+ 16 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseUserChapterSectionVo.java

@@ -21,10 +21,15 @@ public class CourseUserChapterSectionVo {
 	@ApiModelProperty("$pkColumn.columnComment")
 	private Long id;
 
+	/** 节id */
+	@Excel(name = "节id")
+	@ApiModelProperty("节id 试卷ID")
+	private Long typeId;
 	/** 节id */
 	@Excel(name = "节id")
 	@ApiModelProperty("节id")
 	private Long sectionId;
+
 	/** 章ID */
 	@Excel(name = "章ID")
 	@ApiModelProperty("章ID")
@@ -34,6 +39,10 @@ public class CourseUserChapterSectionVo {
 	@ApiModelProperty("班级ID")
 	private Long gradeId;
 
+	@Excel(name = "模块Id")
+	@ApiModelProperty("模块Id")
+	private Long moduleId;
+
 	/** 编码 */
 	@Excel(name = "编码")
 	@ApiModelProperty("编码")
@@ -68,7 +77,12 @@ public class CourseUserChapterSectionVo {
 	private Long durationTime;
 
 	/** 1模块卷 2章卷 3试卷 */
-	@Excel(name = "1模块卷 2章卷 3试卷")
-	@ApiModelProperty("1模块卷 2章卷 3试卷")
+	@Excel(name = "1 节 2试卷")
+	@ApiModelProperty("1 节 2试卷")
 	private Integer type;
+
+	/** 1模块卷 2章卷 3试卷 */
+	@Excel(name = "1 需重修")
+	@ApiModelProperty("1 需重修")
+	private Integer rebuild;
 }

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

@@ -31,6 +31,10 @@ public class CourseUserModuleChapterVo {
 	@Excel(name = "章ID")
 	@ApiModelProperty("章ID")
 	private Long chapterId;
+	/** 章ID */
+	@Excel(name = "课程ID")
+	@ApiModelProperty("课程ID")
+	private Long courseId;
 
 	/** 班级ID */
 	@Excel(name = "班级ID")

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

@@ -27,6 +27,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="durationTime" column="duration_time"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.course.vo.CourseUserChapterSectionVo" id="CourseUserChapterSectionVo">
+        <result property="typeId" column="type_id"/>
+        <result property="chapterId" column="chapter_id"/>
+        <result property="sort" column="c_sort"/>
+        <result property="id" column="id"/>
+        <result property="type" column="type"/>
+
+        <result property="code" column="code"/>
+        <result property="name" column="name"/>
+        <result property="prefixName" column="prefix_name"/>
+        <result property="status" column="status"/>
+        <result property="sectionType" column="section_type"/>
+        <result property="publishStatus" column="publish_status"/>
+        <result property="durationTime" column="duration_time"/>
+    </resultMap>
+
 
     <select id="getListById" parameterType="Long"  resultMap="CourseChapterSectionResultVo">
         SELECT
@@ -61,6 +77,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             c_sort DESC
     </select>
 
+    <select id="sectionList" parameterType="com.zhongzheng.modules.course.bo.CourseMenuQueryBo"  resultMap="CourseUserChapterSectionVo">
+        SELECT
+            cs.section_id as type_id,
+            #{gradeId} as grade_id,
+        <if test="moduleId != null ">
+            #{moduleId} as module_id,
+        </if>
+        <if test="moduleId == null ">
+            0 as module_id,
+        </if>
+
+            cs.*,
+            ccs.sort as c_sort,
+            ccs.id,
+            ccs.chapter_id,
+            1 as type,
+            cmc.module_id
+        FROM
+            course_chapter_section ccs
+                LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
+                LEFT JOIN course_module_chapter cmc ON cmc.chapter_id = ccs.chapter_id
+        WHERE
+            cs.`status` = 1
+          AND ccs.chapter_id = #{chapterId}
+        ORDER BY
+            c_sort DESC
+    </select>
+
+    <select id="examList" parameterType="com.zhongzheng.modules.course.bo.CourseMenuQueryBo"  resultMap="CourseUserChapterSectionVo">
+        SELECT
+            e.*,
+            cme.course_id,
+            cme.module_id,
+            cme.chapter_id,
+            cme.section_id,
+            e.exam_name as name,
+            e.exam_id as type_id,
+            #{gradeId} as grade_id,
+            2 as type
+        FROM
+            exam e
+                LEFT JOIN course_menu_exam cme ON cme.exam_id = e.exam_id
+        where 1=1
+          and cme.chapter_id = #{chapterId}
+        and cme.course_id = #{courseId}
+    </select>
+
     <select id="getListTotalTime" parameterType="Long"  resultType="java.lang.Long">
         SELECT
             IFNULL(sum( cs.duration_time ),0) AS duration_time
@@ -73,4 +136,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
 
+    <select id="rebuildCheck" 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 up.section_id=#{typeId}
+          and up.exam_id=#{examId}
+          AND ups.period_status =1
+          and (ups.`status` = 0 or ups.`status` = 3)
+    </select>
 </mapper>

+ 4 - 4
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMenuMapper.xml

@@ -100,17 +100,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM
             course_menu m
                 LEFT JOIN course_module cm ON m.menu_id = cm.module_id
-                AND m.type = 1
+                AND m.type = 1 and cm.status=1
                 LEFT JOIN course_chapter cc ON m.menu_id = cc.chapter_id
-                AND m.type = 2
+                AND m.type = 2 and cc.status=1
                 LEFT JOIN course_section cs ON m.menu_id = cs.section_id
-                AND m.type = 3
+                AND m.type = 3 and cs.status=1
         WHERE
             m.course_id = #{courseId}
         ORDER BY m.sort
     </select>
 
-    <select id="rebuildCheck" parameterType="com.zhongzheng.modules.course.bo.CourseMenuQueryBo"  resultMap="CourseUserMenuVo">
+    <select id="rebuildCheck" parameterType="map"  resultType="long">
         SELECT
             COUNT(up.id)
         FROM

+ 4 - 2
zhongzheng-system/src/main/resources/mapper/modules/course/CourseModuleChapterMapper.xml

@@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="prefixName" column="prefix_name"/>
         <result property="status" column="status"/>
         <result property="publishStatus" column="publish_status"/>
+        <result property="courseId" column="course_id"/>
     </resultMap>
 
     <select id="getListById" parameterType="Long"  resultMap="CourseModuleChapterResultVo">
@@ -58,12 +59,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             cmc.sort AS c_sort,
             cmc.id,
             cmc.module_id,
-            #{gradeId} as grade_id
+            #{gradeId} as grade_id,
+            #{courseId} as course_id
         FROM
             course_module_chapter cmc
                 LEFT JOIN course_chapter cc ON cmc.chapter_id = cc.chapter_id
         WHERE
-            cc.`status` !=- 1
+            cc.`status` =1
 	AND cmc.module_id = #{moduleId}
         ORDER BY
             c_sort DESC