feat: 🎸 课程章节支持关键词模糊查询

This commit is contained in:
GoCo 2025-09-06 21:12:59 +08:00
parent 4ccef54e7e
commit 461bbaec56
3 changed files with 11 additions and 5 deletions

View File

@ -305,8 +305,8 @@ public class AiolCourseController extends JeecgController<AiolCourse, IAiolCours
@GetMapping("/{courseId}/section")
@Operation(summary = "查询课程章节列表", description = "根据课程id查询章节列表type表示章节类型0=视频、1=资料、2=考试、3=作业level表示章节层级0=一级章节、1=二级章节通过parentId记录父子关系前端需自行组织树形结构当前层级的顺序通过sortOrder排序")
@IgnoreAuth
public Result<List<AiolCourseSection>> querySectionList(@PathVariable(value = "courseId") String courseId) {
List<AiolCourseSection> list = aiolCourseService.getCourseSectionList(courseId);
public Result<List<AiolCourseSection>> querySectionList(@PathVariable(value = "courseId") String courseId, @RequestParam(value = "keyword", required = false) String keyword) {
List<AiolCourseSection> list = aiolCourseService.getCourseSectionList(courseId, keyword);
return Result.OK(list);
}

View File

@ -47,9 +47,10 @@ public interface IAiolCourseService extends IService<AiolCourse> {
/**
* 查询指定课程下的章节列表
* @param courseId
* @param keyword
* @return
*/
List<AiolCourseSection> getCourseSectionList(String courseId);
List<AiolCourseSection> getCourseSectionList(String courseId, String keyword);
/**
* 查询章节详情泛型

View File

@ -171,8 +171,13 @@ public class AiolCourseServiceImpl extends ServiceImpl<AiolCourseMapper, AiolCou
}
@Override
public List<AiolCourseSection> getCourseSectionList(String courseId) {
return courseSectionMapper.selectList(new QueryWrapper<AiolCourseSection>().eq("course_id", courseId));
public List<AiolCourseSection> getCourseSectionList(String courseId, String keyword) {
QueryWrapper<AiolCourseSection> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("course_id", courseId);
if (keyword != null && !keyword.trim().isEmpty()) {
queryWrapper.like("name", keyword);
}
return courseSectionMapper.selectList(queryWrapper);
}
@Override