Ver Fonte

流业务层

he2802 há 4 anos atrás
pai
commit
d213188bd9

+ 1 - 1
zhongzheng-admin/src/main/java/com/zhongzheng/controller/course/CourseChapterSectionController.java

@@ -60,7 +60,7 @@ public class CourseChapterSectionController extends BaseController {
         result.put("code", HttpStatus.HTTP_OK);
         result.put("list",list);
         result.put("msg","查询成功");
-        result.put("sectionTotal",new PageInfo(list).getTotal());
+        result.put("sectionTotal",iCourseChapterSectionService.getListTotalTime(id));
         return result;
     }
 

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

@@ -15,4 +15,5 @@ import java.util.List;
  */
 public interface CourseChapterSectionMapper extends BaseMapper<CourseChapterSection> {
     List<CourseChapterSectionVo> getListById(Long id);
+    Long getListTotalTime(Long id);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseChapterSectionService.java

@@ -26,6 +26,8 @@ public interface ICourseChapterSectionService extends IService<CourseChapterSect
 
 	List<CourseChapterSectionVo> getListById(Long id);
 
+	Long getListTotalTime(Long id);
+
 	/**
 	 * 查询列表
 	 */

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseChapterService.java

@@ -23,6 +23,8 @@ public interface ICourseChapterService extends IService<CourseChapter> {
 	 */
 	CourseChapterVo queryById(Long chapterId);
 
+
+
 	/**
 	 * 查询列表
 	 */

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

@@ -47,6 +47,11 @@ public class CourseChapterSectionServiceImpl extends ServiceImpl<CourseChapterSe
         return courseChapterSectionMapper.getListById(id);
     }
 
+    @Override
+    public Long getListTotalTime(Long id) {
+        return courseChapterSectionMapper.getListTotalTime(id);
+    }
+
     @Override
     public List<CourseChapterSectionVo> queryList(CourseChapterSectionQueryBo bo) {
         LambdaQueryWrapper<CourseChapterSection> lqw = Wrappers.lambdaQuery();

+ 13 - 1
zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterSectionMapper.xml

@@ -25,17 +25,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="publishStatus" column="publish_status"/>
     </resultMap>
 
+
     <select id="getListById" parameterType="Long"  resultMap="CourseChapterSectionResultVo">
         SELECT
             cs.*,
             ccs.sort as c_sort,
             ccs.id,
             ccs.chapter_id
+        FROM
+            course_chapter_section ccs
+                LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
+            cs.`status` !=- 1
+	        AND ccs.chapter_id = =#{id}
+    </select>
+
+    <select id="getListTotalTime" parameterType="Long"  resultType="java.lang.Long">
+        SELECT
+            IFNULL(sum( cs.duration_time ),0) AS duration_time
         FROM
             course_chapter_section ccs
                 LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
         WHERE
-            ccs.chapter_id  =#{id}
+            cs.`status` !=- 1
+	    AND ccs.chapter_id  =#{id}
     </select>