diff --git a/src/main/java/com/peanut/modules/psyche/controller/PsycheHomeController.java b/src/main/java/com/peanut/modules/psyche/controller/PsycheHomeController.java index 363c8c30..d961d75e 100644 --- a/src/main/java/com/peanut/modules/psyche/controller/PsycheHomeController.java +++ b/src/main/java/com/peanut/modules/psyche/controller/PsycheHomeController.java @@ -111,10 +111,10 @@ public class PsycheHomeController { MPJLambdaWrapper wrapper = new MPJLambdaWrapper<>(); wrapper.selectAll(CourseEntity.class); wrapper.distinct(); + wrapper.rightJoin(CourseToPsyche.class,CourseToPsyche::getCourseId,CourseEntity::getId); wrapper.leftJoin(UserToCourseEntity.class,UserToCourseEntity::getCourseId,CourseEntity::getId); wrapper.eq(UserToCourseEntity::getUserId, ShiroUtils.getUId()); wrapper.orderByDesc(UserToCourseEntity::getUpdateTime); - wrapper.exists("select * from course_to_psyche where course_id = t.id"); wrapper.last("Limit 4"); List courseList = courseService.list(wrapper); return R.ok().put("courseList",courseList); diff --git a/src/main/java/com/peanut/modules/sociology/service/impl/CourseServiceImpl.java b/src/main/java/com/peanut/modules/sociology/service/impl/CourseServiceImpl.java index d18b5166..50a5c302 100644 --- a/src/main/java/com/peanut/modules/sociology/service/impl/CourseServiceImpl.java +++ b/src/main/java/com/peanut/modules/sociology/service/impl/CourseServiceImpl.java @@ -95,10 +95,10 @@ public class CourseServiceImpl extends ServiceImpl impl MPJLambdaWrapper wrapper = new MPJLambdaWrapper<>(); wrapper.selectAll(CourseEntity.class); wrapper.distinct(); + wrapper.rightJoin(CourseToSociologyEntity.class,CourseToSociologyEntity::getCourseId,CourseEntity::getId); wrapper.leftJoin(UserToCourseEntity.class,UserToCourseEntity::getCourseId,CourseEntity::getId); wrapper.eq(UserToCourseEntity::getUserId,param.getId()); wrapper.orderByDesc(UserToCourseEntity::getUpdateTime); - wrapper.exists("select * from course_to_sociology where course_id = t.id"); wrapper.last("Limit 4"); List courseEntities = this.getBaseMapper().selectJoinList(CourseEntity.class, wrapper); return courseEntities;