This commit is contained in:
wangjinlei
2024-04-30 09:17:58 +08:00
parent 97e9aecd68
commit 871fc79cca
8 changed files with 34 additions and 8 deletions

View File

@@ -22,5 +22,5 @@ public interface CourseService extends IService<CourseEntity> {
Map<String, Object> getCourseDetail(Integer id);
List<CourseEntity> getMyCourse(int type);
}

View File

@@ -7,22 +7,24 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.ShiroUtils;
import com.peanut.modules.common.dao.*;
import com.peanut.modules.common.entity.*;
import com.peanut.modules.common.service.MyUserService;
import com.peanut.modules.common.to.ParamTo;
import com.peanut.modules.sociology.service.CourseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@Slf4j
@Service("sociologyCourseService")
public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> implements CourseService {
@Autowired
private MyUserService userService;
@Autowired
private UserToCourseDao userToCourseDao;
@Autowired
@@ -99,6 +101,23 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
return flag;
}
@Override
public List getMyCourse(int type) {
Integer uId = ShiroUtils.getUId();
MyUserEntity userEntity = userService.getById(uId);
if(userEntity.getVip()!="0"){
}
MPJLambdaWrapper<UserCourseBuyEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.select(UserCourseBuyEntity::getEndTime);
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,UserCourseBuyEntity::getCourseId);
wrapper.eq(UserCourseBuyEntity::getUserId,uId);
wrapper.gt(UserCourseBuyEntity::getEndTime,new Date());
List<CourseEntity> courseEntities = userCourseBuyDao.selectJoinList(CourseEntity.class, wrapper);
return courseEntities;
}
private Integer catalogueCompletion(CourseCatalogueEntity c){
List<CourseCatalogueChapterEntity> courseCatalogueChapterEntities = courseCatalogueChapterDao.selectList(new LambdaQueryWrapper<CourseCatalogueChapterEntity>().eq(CourseCatalogueChapterEntity::getCatalogueId, c.getId()));
Integer act = 0;