修复一下bug

This commit is contained in:
wangjinlei
2024-04-23 16:36:04 +08:00
parent 3cbd29de4b
commit ba2fa6baf3
12 changed files with 174 additions and 2 deletions

View File

@@ -4,7 +4,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.CourseCatalogueChapterEntity;
import java.util.List;
import java.util.Map;
public interface CourseCatalogueChapterService extends IService<CourseCatalogueChapterEntity> {
List<CourseCatalogueChapterEntity> getCourseCatalogueChapterList(int id);
Map<String,Object> getChapterDetail(Integer chapterId);
}

View File

@@ -2,6 +2,7 @@ package com.peanut.modules.sociology.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.CourseCatalogueChapterEntity;
import com.peanut.modules.common.entity.CourseEntity;
import com.peanut.modules.common.to.ParamTo;
@@ -21,4 +22,5 @@ public interface CourseService extends IService<CourseEntity> {
Map<String, Object> getCourseDetail(Integer id);
}

View File

@@ -3,17 +3,23 @@ package com.peanut.modules.sociology.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.CourseCatalogueChapterDao;
import com.peanut.modules.common.dao.CourseCatalogueChapterVideoDao;
import com.peanut.modules.common.entity.CourseCatalogueChapterEntity;
import com.peanut.modules.common.entity.CourseCatalogueChapterVideoEntity;
import com.peanut.modules.sociology.service.CourseCatalogueChapterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Service("sociologyCourseCatalogueChapterService")
public class CourseCatalogueChapterServiceImpl extends ServiceImpl<CourseCatalogueChapterDao, CourseCatalogueChapterEntity> implements CourseCatalogueChapterService {
@Autowired
private CourseCatalogueChapterVideoDao courseCatalogueChapterVideoDao;
@Override
public List<CourseCatalogueChapterEntity> getCourseCatalogueChapterList(int id) {
LambdaQueryWrapper<CourseCatalogueChapterEntity> wrapper = new LambdaQueryWrapper<>();
@@ -22,4 +28,14 @@ public class CourseCatalogueChapterServiceImpl extends ServiceImpl<CourseCatalog
List<CourseCatalogueChapterEntity> list = this.list(wrapper);
return list;
}
@Override
public Map<String, Object> getChapterDetail(Integer chapterId) {
CourseCatalogueChapterEntity byId = this.getById(chapterId);
HashMap<String, Object> flag = new HashMap<>();
flag.put("detail",byId);
List<CourseCatalogueChapterVideoEntity> courseCatalogueChapterVideoEntities = courseCatalogueChapterVideoDao.selectList(new LambdaQueryWrapper<CourseCatalogueChapterVideoEntity>().eq(CourseCatalogueChapterVideoEntity::getChapterId, chapterId));
flag.put("videos",courseCatalogueChapterVideoEntities);
return flag;
}
}

View File

@@ -47,6 +47,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(CourseToSociologyEntity.class,CourseToSociologyEntity::getCourseId,CourseEntity::getId);
wrapper.eq(CourseToSociologyEntity::getSociologyId,param.getId());
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()),CourseEntity.class, wrapper);
return courseEntityPage;
}