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