瀏覽代碼

Merge branch 'pre' into dev

he2802 3 年之前
父節點
當前提交
0ddd691687

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

@@ -18,4 +18,5 @@ import java.util.List;
  */
 public interface CourseChapterMapper extends BaseMapper<CourseChapter> {
     List<CourseChapterVo> selectList(CourseChapterQueryBo bo);
+    CourseChapterVo getInfo(Long chapterId);
 }

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

@@ -52,8 +52,7 @@ public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, C
 
     @Override
     public CourseChapterVo queryById(Long chapterId){
-        CourseChapter db = this.baseMapper.selectById(chapterId);
-        return BeanUtil.toBean(db, CourseChapterVo.class);
+        return this.baseMapper.getInfo(chapterId);
     }
 
     @Override

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseChapterVo.java

@@ -77,4 +77,5 @@ public class CourseChapterVo {
 	@ApiModelProperty("修改时间")
 	@Excel(name = "修改时间")
 	private Long updateTime;
+
 }

+ 5 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterMapper.xml

@@ -160,6 +160,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ORDER BY c.chapter_id DESC
    </select>
 
+    <select id="getInfo" parameterType="Long" resultMap="CourseChapterResultVo">
+        select cc.*,(SELECT
+                         count(ccs.section_id) from course_chapter_section ccs where ccs.chapter_id = cc.chapter_id) as section_num from course_chapter cc where cc.chapter_id = #{chapterId}
+
+    </select>
 
     <select id="selectList_COUNT" resultType="Long">
         SELECT