心灵空间

This commit is contained in:
wuchunlei
2025-02-24 17:31:57 +08:00
parent 6908c092a5
commit 91f4ccc2b1
5 changed files with 152 additions and 4 deletions

View File

@@ -39,8 +39,10 @@ public class PsycheCourseController {
public R getUserCourseBuy(){
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.leftJoin(CourseCatalogueEntity.class,CourseCatalogueEntity::getCourseId,CourseEntity::getId);
wrapper.leftJoin(CourseToPsyche.class,CourseToPsyche::getCourseId,CourseEntity::getId);
wrapper.leftJoin(UserCourseBuyEntity.class,UserCourseBuyEntity::getCourseId,CourseEntity::getId);
wrapper.rightJoin(CourseToPsyche.class,CourseToPsyche::getCourseId,CourseEntity::getId);
if (!userVipService.isPsycheVip()){
wrapper.leftJoin(UserCourseBuyEntity.class,UserCourseBuyEntity::getCourseId,CourseEntity::getId);
}
wrapper.eq(UserCourseBuyEntity::getUserId,ShiroUtils.getUId());
wrapper.selectAll(CourseEntity.class);
wrapper.selectAs(CourseCatalogueEntity::getId,"catalogueId");
@@ -48,6 +50,12 @@ public class PsycheCourseController {
wrapper.orderByAsc(CourseEntity::getSort);
wrapper.orderByAsc(CourseCatalogueEntity::getSort);
List<Map<String,Object>> courseList = courseService.listMaps(wrapper);
for (Map<String,Object> map:courseList){
int i = userCourseStudyingService.count(new LambdaQueryWrapper<UserCourseStudying>()
.eq(UserCourseStudying::getCourseId,map.get("id"))
.eq(UserCourseStudying::getUserId,ShiroUtils.getUId()));
map.put("isStudying",i>0?1:0);
}
return R.ok().put("courseList",courseList);
}