mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-25 20:35:35 +08:00
学员全部课程api增加分类过滤
This commit is contained in:
@@ -77,8 +77,12 @@ public interface CourseService extends IService<Course> {
|
||||
|
||||
List<Course> getOpenCoursesAndShow(Integer limit);
|
||||
|
||||
List<Course> getOpenCoursesAndShow(Integer limit, Integer categoryId);
|
||||
|
||||
List<Course> getDepCoursesAndShow(List<Integer> depIds);
|
||||
|
||||
List<Course> getDepCoursesAndShow(List<Integer> depIds, Integer categoryId);
|
||||
|
||||
Map<Integer, List<Integer>> getCategoryIdsGroup(List<Integer> courseIds);
|
||||
|
||||
Map<Integer, List<Integer>> getDepIdsGroup(List<Integer> courseIds);
|
||||
|
||||
@@ -209,7 +209,41 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
|
||||
|
||||
@Override
|
||||
public List<Course> getOpenCoursesAndShow(Integer limit) {
|
||||
return getBaseMapper().openCoursesAndShow(limit);
|
||||
return getBaseMapper().openCoursesAndShow(limit, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Course> getOpenCoursesAndShow(Integer limit, Integer categoryId) {
|
||||
return getBaseMapper().openCoursesAndShow(limit, categoryId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Course> getDepCoursesAndShow(List<Integer> depIds, Integer categoryId) {
|
||||
if (depIds == null || depIds.size() == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<Integer> courseIds = courseDepartmentService.getCourseIdsByDepIds(depIds);
|
||||
if (courseIds == null || courseIds.size() == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
if (categoryId != null && categoryId > 0) {
|
||||
List<Integer> tmpCourseIds =
|
||||
courseCategoryService.getCourseIdsByCategoryIds(
|
||||
new ArrayList<>() {
|
||||
{
|
||||
add(categoryId);
|
||||
}
|
||||
});
|
||||
if (tmpCourseIds == null || tmpCourseIds.size() == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 取交集
|
||||
courseIds.retainAll(tmpCourseIds);
|
||||
}
|
||||
if (courseIds.size() == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return list(query().getWrapper().in("id", courseIds).eq("is_show", 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user