优化我的课程
This commit is contained in:
@@ -162,29 +162,38 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
||||
@Override
|
||||
public Page<CourseEntity> getUserCourseBuy(Map<String, Object> param) {
|
||||
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.leftJoin(CourseToMedicine.class,CourseToMedicine::getCourseId,CourseEntity::getId);
|
||||
if (userVipService.isSociologyVip()){
|
||||
wrapper.leftJoin(CourseCatalogueEntity.class,CourseCatalogueEntity::getCourseId,CourseEntity::getId);
|
||||
wrapper.leftJoin(UserCourseBuyEntity.class,UserCourseBuyEntity::getCatalogueId,CourseCatalogueEntity::getId);
|
||||
wrapper.eq(UserCourseBuyEntity::getUserId,ShiroUtils.getUId());
|
||||
wrapper.rightJoin(CourseToMedicine.class,CourseToMedicine::getCourseId,CourseEntity::getId);
|
||||
//开通的会员下的课程
|
||||
List list = new ArrayList<>();//通过顶级标签获取最下层标签
|
||||
if (userVipService.isMedicalVip()){
|
||||
userVipService.bottomLabel(1,list);
|
||||
}
|
||||
if (userVipService.isChineseWesternVip()){
|
||||
userVipService.bottomLabel(74,list);
|
||||
}
|
||||
if (userVipService.isAcupunctureVip()){
|
||||
userVipService.bottomLabel(2,list);
|
||||
}
|
||||
if (userVipService.istumorVip()){
|
||||
userVipService.bottomLabel(5,list);
|
||||
}
|
||||
if (userVipService.isPsycheVip()){
|
||||
userVipService.bottomLabel(4,list);
|
||||
}
|
||||
//购买的课程
|
||||
List buyList = userCourseBuyDao.selectList(new LambdaQueryWrapper<UserCourseBuyEntity>()
|
||||
.eq(UserCourseBuyEntity::getUserId,ShiroUtils.getUId()))
|
||||
.stream().map(UserCourseBuyEntity::getCourseId).collect(Collectors.toList());
|
||||
if (list.size()>0&&buyList.size()>0){
|
||||
wrapper.and(t->t.in(CourseToMedicine::getMedicalId,list).or().in(CourseToMedicine::getCourseId,buyList));
|
||||
}else {
|
||||
List list = new ArrayList<>();//通过顶级标签获取最下层标签
|
||||
if (userVipService.isMedicalVip()){
|
||||
userVipService.bottomLabel(1,list);
|
||||
if (list.size()>0){
|
||||
wrapper.in(CourseToMedicine::getMedicalId,list);
|
||||
}else if (buyList.size()>0){
|
||||
wrapper.in(CourseToMedicine::getCourseId,buyList);
|
||||
}else {
|
||||
return new Page<>();
|
||||
}
|
||||
if (userVipService.isChineseWesternVip()){
|
||||
userVipService.bottomLabel(74,list);
|
||||
}
|
||||
if (userVipService.isAcupunctureVip()){
|
||||
userVipService.bottomLabel(2,list);
|
||||
}
|
||||
if (userVipService.istumorVip()){
|
||||
userVipService.bottomLabel(5,list);
|
||||
}
|
||||
if (userVipService.isPsycheVip()){
|
||||
userVipService.bottomLabel(4,list);
|
||||
}
|
||||
wrapper.in(CourseToMedicine::getMedicalId,list);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(param.get("medicalId").toString())){
|
||||
wrapper.eq(CourseToMedicine::getMedicalId,param.get("medicalId"));
|
||||
|
||||
Reference in New Issue
Block a user