|
|
|
|
@@ -4,10 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import com.peanut.modules.common.dao.CourseCatalogueDao;
|
|
|
|
|
import com.peanut.modules.common.dao.CourseDao;
|
|
|
|
|
import com.peanut.modules.common.dao.CourseToSociologyDao;
|
|
|
|
|
import com.peanut.modules.common.dao.UserToCourseDao;
|
|
|
|
|
import com.peanut.common.utils.ShiroUtils;
|
|
|
|
|
import com.peanut.modules.common.dao.*;
|
|
|
|
|
import com.peanut.modules.common.entity.*;
|
|
|
|
|
import com.peanut.modules.common.to.ParamTo;
|
|
|
|
|
import com.peanut.modules.sociology.service.CourseService;
|
|
|
|
|
@@ -30,18 +28,9 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|
|
|
|
private CourseToSociologyDao courseToSociologyDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private CourseCatalogueDao courseCatalogueDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private UserCourseBuyDao userCourseBuyDao;
|
|
|
|
|
|
|
|
|
|
//我的课程
|
|
|
|
|
@Override
|
|
|
|
|
public List<CourseEntity> getMyCourse(String userId) {
|
|
|
|
|
MPJLambdaWrapper<UserToCourseEntity> wrapper = new MPJLambdaWrapper();
|
|
|
|
|
wrapper.selectAll(CourseEntity.class);
|
|
|
|
|
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,UserToCourseEntity::getCourseId);
|
|
|
|
|
wrapper.groupBy(UserToCourseEntity::getCourseId);
|
|
|
|
|
wrapper.eq(UserToCourseEntity::getUserId,userId);
|
|
|
|
|
List courseList = userToCourseDao.selectMaps(wrapper);
|
|
|
|
|
return courseList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据标签获取课程列表
|
|
|
|
|
@Override
|
|
|
|
|
@@ -90,6 +79,11 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|
|
|
|
CourseEntity course = this.getById(id);
|
|
|
|
|
flag.put("course",course);
|
|
|
|
|
List<CourseCatalogueEntity> courseCatalogueEntities = courseCatalogueDao.selectList(new LambdaQueryWrapper<CourseCatalogueEntity>().eq(CourseCatalogueEntity::getCourseId, id));
|
|
|
|
|
Integer uId = ShiroUtils.getUId();
|
|
|
|
|
for (CourseCatalogueEntity c :courseCatalogueEntities){
|
|
|
|
|
Integer integer = userCourseBuyDao.selectCount(new LambdaQueryWrapper<UserCourseBuyEntity>().eq(UserCourseBuyEntity::getUserId, uId).eq(UserCourseBuyEntity::getCatalogueId, c.getId()));
|
|
|
|
|
c.setIsBuy(integer>0?1:0);
|
|
|
|
|
}
|
|
|
|
|
flag.put("catalogues",courseCatalogueEntities);
|
|
|
|
|
return flag;
|
|
|
|
|
}
|
|
|
|
|
|