@@ -18,4 +18,5 @@ import java.util.List;
*/
public interface CourseChapterMapper extends BaseMapper<CourseChapter> {
List<CourseChapterVo> selectList(CourseChapterQueryBo bo);
+ CourseChapterVo getInfo(Long chapterId);
}
@@ -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);
@@ -77,4 +77,5 @@ public class CourseChapterVo {
@ApiModelProperty("修改时间")
@Excel(name = "修改时间")
private Long updateTime;
+
@@ -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