This commit is contained in:
wangjinlei
2024-06-17 10:07:09 +08:00
parent 63c0bb6eb2
commit 27fa78a2af

View File

@@ -56,6 +56,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
@Override
public Page getSociologyCourseList(ParamTo param) {
Integer uId = ShiroUtils.getUId();
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(CourseToSociologyEntity.class,CourseToSociologyEntity::getCourseId,CourseEntity::getId);
@@ -63,7 +64,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
wrapper.orderByAsc(CourseToSociologyEntity::getSort);
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()),CourseEntity.class, wrapper);
for (CourseEntity c:courseEntityPage.getRecords()){
Integer integer = userCourseBuyDao.selectCount(new LambdaQueryWrapper<UserCourseBuyEntity>().eq(UserCourseBuyEntity::getCourseId, c.getId()));
Integer integer = userCourseBuyDao.selectCount(new LambdaQueryWrapper<UserCourseBuyEntity>().eq(UserCourseBuyEntity::getCourseId, c.getId()).eq(UserCourseBuyEntity::getUserId,uId));
if(integer>0){
c.setBuy(true);
}else {