From 221b1500b889a4672af2232a20e2f325ce103a7f Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Wed, 3 Jul 2024 11:23:00 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=92=AD=E6=94=BE=E7=9A=84?= =?UTF-8?q?=E8=A7=86=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseCatalogueChapterServiceImpl.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/peanut/modules/sociology/service/impl/CourseCatalogueChapterServiceImpl.java b/src/main/java/com/peanut/modules/sociology/service/impl/CourseCatalogueChapterServiceImpl.java index cb2b380e..00a884b1 100644 --- a/src/main/java/com/peanut/modules/sociology/service/impl/CourseCatalogueChapterServiceImpl.java +++ b/src/main/java/com/peanut/modules/sociology/service/impl/CourseCatalogueChapterServiceImpl.java @@ -20,6 +20,7 @@ import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; @Slf4j @Service("sociologyCourseCatalogueChapterService") @@ -71,7 +72,10 @@ public class CourseCatalogueChapterServiceImpl extends ServiceImpl userCourseBuyEntities = userCourseBuyDao.selectList(new LambdaQueryWrapper().eq(UserCourseBuyEntity::getUserId, ShiroUtils.getUId()).eq(UserCourseBuyEntity::getCatalogueId, byId.getCatalogueId())); if (userCourseBuyEntities.size()==1){ flag.put("buy",userCourseBuyEntities.get(0)); @@ -81,4 +85,22 @@ public class CourseCatalogueChapterServiceImpl extends ServiceImpl wrapper = new MPJLambdaWrapper<>(); + wrapper.leftJoin(UserCourseVideoPositionEntity.class,UserCourseVideoPositionEntity::getVideoId,CourseCatalogueChapterVideoEntity::getId); + wrapper.selectAll(CourseCatalogueChapterVideoEntity.class); + wrapper.eq(CourseCatalogueChapterVideoEntity::getChapterId,chapterId); + wrapper.orderByDesc(UserCourseVideoPositionEntity::getUpdateTime); + List courseCatalogueChapterVideoEntities = courseCatalogueChapterVideoDao.selectJoinList(CourseCatalogueChapterVideoEntity.class, wrapper); + if(courseCatalogueChapterVideoEntities.size()>0){ + return courseCatalogueChapterVideoEntities.get(0).getId(); + }else { + List courseCatalogueChapterVideoEntities1 = courseCatalogueChapterVideoDao.selectList(new LambdaQueryWrapper() + .eq(CourseCatalogueChapterVideoEntity::getChapterId, chapterId).orderByAsc(CourseCatalogueChapterVideoEntity::getSort)); + return courseCatalogueChapterVideoEntities1.size()>0?courseCatalogueChapterVideoEntities1.get(0).getId():0; + } + + } + + }