feat:增加获取课程下一章节详情接口
This commit is contained in:
@@ -148,6 +148,17 @@ public class CourseController {
|
|||||||
return R.ok().put("data",chapterDetail);
|
return R.ok().put("data",chapterDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取下一章节详情
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/getNextCourseCatalogueChapter")
|
||||||
|
public R getNextCourseCatalogueChapter(@RequestBody ParamTo param){
|
||||||
|
Map<String, Object> chapterDetail = courseCatalogueChapterService.getNextChapterDetail(param.getId());
|
||||||
|
return R.ok().put("data",chapterDetail);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开通免费课程
|
* 开通免费课程
|
||||||
* @param map
|
* @param map
|
||||||
|
|||||||
@@ -10,4 +10,5 @@ public interface CourseCatalogueChapterService extends IService<CourseCatalogueC
|
|||||||
List<CourseCatalogueChapterEntity> getCourseCatalogueChapterList(int id);
|
List<CourseCatalogueChapterEntity> getCourseCatalogueChapterList(int id);
|
||||||
|
|
||||||
Map<String,Object> getChapterDetail(Integer chapterId);
|
Map<String,Object> getChapterDetail(Integer chapterId);
|
||||||
|
Map<String, Object> getNextChapterDetail(Integer chapterId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,23 @@ public class CourseCatalogueChapterServiceImpl extends ServiceImpl<CourseCatalog
|
|||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getNextChapterDetail(Integer chapterId) {
|
||||||
|
CourseCatalogueChapterEntity currentChapter = this.getById(chapterId);
|
||||||
|
if (currentChapter==null) return null;
|
||||||
|
|
||||||
|
CourseCatalogueChapterEntity nextChapter = this.getOne(
|
||||||
|
new LambdaQueryWrapper<CourseCatalogueChapterEntity>()
|
||||||
|
.eq(CourseCatalogueChapterEntity::getCatalogueId, currentChapter.getCatalogueId())
|
||||||
|
.gt(CourseCatalogueChapterEntity::getSort, currentChapter.getSort() )
|
||||||
|
.orderByAsc(CourseCatalogueChapterEntity::getSort)
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
if (nextChapter==null) return null;
|
||||||
|
|
||||||
|
return getChapterDetail(nextChapter.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private int getCurrentVideo(Integer chapterId){
|
private int getCurrentVideo(Integer chapterId){
|
||||||
MPJLambdaWrapper<CourseCatalogueChapterVideoEntity> wrapper = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<CourseCatalogueChapterVideoEntity> wrapper = new MPJLambdaWrapper<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user