Compare commits
No commits in common. "337ba0f42a2162089c1500a141439d5ade51a8f0" and "326e764f294cac7e97537208836c2360fbd2eb96" have entirely different histories.
337ba0f42a
...
326e764f29
@ -33,8 +33,8 @@ import org.jeecg.modules.gen.resource.entity.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.Comparator;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@ -55,27 +55,8 @@ public class CourseBizController {
|
||||
public Result<List<CourseWithTeacherInfo>> queryCourseList(
|
||||
@RequestParam(value = "categoryId", required = false) String categoryId,
|
||||
@RequestParam(value = "difficulty", required = false) String difficulty,
|
||||
@RequestParam(value = "subject", required = false) String topic,
|
||||
@RequestParam(value = "sort", required = false) String sort) {
|
||||
@RequestParam(value = "subject", required = false) String topic) {
|
||||
List<CourseWithTeacherInfo> list = courseBizService.getCourseList(categoryId, difficulty, topic);
|
||||
if (sort != null) {
|
||||
switch (sort) {
|
||||
case "hottest":
|
||||
list = list.stream()
|
||||
.sorted(Comparator.comparing(Course::getEnrollCount, Comparator.nullsLast(Integer::compareTo)).reversed())
|
||||
.collect(Collectors.toList());
|
||||
break;
|
||||
case "latest":
|
||||
list = list.stream()
|
||||
.sorted(Comparator.comparing(Course::getCreateTime, Comparator.nullsLast(java.util.Date::compareTo)).reversed())
|
||||
.collect(Collectors.toList());
|
||||
break;
|
||||
case "recommend":
|
||||
default:
|
||||
// 不处理,直接返回
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
@ -238,16 +219,6 @@ public class CourseBizController {
|
||||
return Result.OK(progress);
|
||||
}
|
||||
|
||||
@GetMapping("/count")
|
||||
@Operation(summary = "查询课程总数", description = "返回系统中所有课程的总数量")
|
||||
@IgnoreAuth
|
||||
public Result<Long> queryCourseCount() {
|
||||
long count = courseBizService.count();
|
||||
return Result.OK(count);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/test")
|
||||
@IgnoreAuth
|
||||
public Result<String> test() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user