mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-07-22 00:39:32 +08:00
修复/user/courses 接口category_id参数过滤报错
This commit is contained in:
parent
dbae07de95
commit
af913bf4e4
@ -37,11 +37,11 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class ExceptionController {
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public JsonResponse exceptionHandler(Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return JsonResponse.error("系统错误", 500);
|
||||
}
|
||||
// @ExceptionHandler(Exception.class)
|
||||
// public JsonResponse exceptionHandler(Exception e) {
|
||||
// log.error(e.getMessage());
|
||||
// return JsonResponse.error("系统错误", 500);
|
||||
// }
|
||||
|
||||
@ExceptionHandler(ServiceException.class)
|
||||
public JsonResponse serviceExceptionHandler(ServiceException e) {
|
||||
|
@ -237,11 +237,10 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
|
||||
if (tmpCourseIds == null || tmpCourseIds.size() == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 取交集
|
||||
courseIds.retainAll(tmpCourseIds);
|
||||
}
|
||||
if (courseIds.size() == 0) {
|
||||
return new ArrayList<>();
|
||||
courseIds = courseIds.stream().filter(tmpCourseIds::contains).toList();
|
||||
if (courseIds.size() == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
return list(query().getWrapper().in("id", courseIds).eq("is_show", 1));
|
||||
}
|
||||
|
@ -172,10 +172,13 @@
|
||||
SELECT `courses`.*
|
||||
FROM `courses`
|
||||
LEFT JOIN `course_department` ON `course_department`.`course_id` = `courses`.`id`
|
||||
<if test="categoryId != null and categoryId > 0">
|
||||
INNER JOIN `resource_course_category` ON `resource_course_category`.`course_id` = `courses`.`id`
|
||||
</if>
|
||||
WHERE `course_department`.`course_id` IS NULL
|
||||
AND `courses`.`is_show` = 1
|
||||
<if test="categoryId != null and categoryId > 0">
|
||||
AND `course_department`.`caetgory_id` = #{categoryId}
|
||||
AND `resource_course_category`.`category_id` = #{categoryId}
|
||||
</if>
|
||||
LIMIT #{limit}
|
||||
</select>
|
||||
|
Loading…
x
Reference in New Issue
Block a user