feat: 🎸 课程章节支持关键词模糊查询
This commit is contained in:
parent
4ccef54e7e
commit
461bbaec56
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
/**
|
||||
* 查询章节详情(泛型)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user