feat:增加获取课程下一章节详情接口

This commit is contained in:
2026-08-06 15:47:26 +08:00
parent 5a4c0fb4fc
commit 3cfd76e6f1
3 changed files with 29 additions and 0 deletions

View File

@@ -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

View File

@@ -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);
} }

View File

@@ -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<>();