首页标签树
This commit is contained in:
@@ -67,11 +67,11 @@ public class BuyOrder implements Serializable {
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 订单来源,0疯子读书1国学众妙之门2医学吴门医述3海外读书
|
||||
* 订单来源,0疯子读书1国学众妙之门2医学吴门医述3心灵空间
|
||||
*/
|
||||
private Integer come;
|
||||
/**
|
||||
* 支付方式 1微信,2支付宝,3ios内购 ,4虚拟币 5PayPal
|
||||
* 支付方式 1微信,2支付宝,3ios内购 ,4虚拟币
|
||||
*/
|
||||
private String paymentMethod;
|
||||
/**
|
||||
|
||||
@@ -3,11 +3,15 @@ package com.peanut.modules.common.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.CoursePsyche;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CoursePsycheService extends IService<CoursePsyche> {
|
||||
|
||||
List<CoursePsyche> getCoursePsycheTree();
|
||||
|
||||
List<CoursePsyche> getChildCoursePsycheTree(ParamTo param);
|
||||
|
||||
List<CoursePsyche> getCoursePsycheList();
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.peanut.modules.common.dao.CourseToPsycheDao;
|
||||
import com.peanut.modules.common.entity.CoursePsyche;
|
||||
import com.peanut.modules.common.entity.CourseToPsyche;
|
||||
import com.peanut.modules.common.service.CoursePsycheService;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -48,6 +49,31 @@ public class CoursePsycheServiceImpl extends ServiceImpl<CoursePsycheDao, Course
|
||||
return children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CoursePsyche> getChildCoursePsycheTree(ParamTo param) {
|
||||
List<CoursePsyche> psyches = this.list(new QueryWrapper<>());
|
||||
List<CoursePsyche> psychesTree = psyches.stream().filter((coursePsyche) ->
|
||||
coursePsyche.getPid() == param.getId()
|
||||
).map((psyche)->{
|
||||
psyche.setChildren(getChildPsycheChildrens(psyche,psyches));
|
||||
return psyche;
|
||||
}).sorted((sort1,sort2)->{
|
||||
return (sort1.getSort() == null? 0 : sort1.getSort()) - (sort2.getSort()==null?0:sort2.getSort());
|
||||
}).collect(Collectors.toList());
|
||||
return psychesTree;
|
||||
}
|
||||
private List<CoursePsyche> getChildPsycheChildrens(CoursePsyche root, List<CoursePsyche> all){
|
||||
List<CoursePsyche> children = all.stream().filter(coursePsyche -> {
|
||||
return root.getId().equals(coursePsyche.getPid());
|
||||
}).map(coursePsyche -> {
|
||||
coursePsyche.setChildren(getChildPsycheChildrens(coursePsyche, all));
|
||||
return coursePsyche;
|
||||
}).sorted((sort1,sort2)->{
|
||||
return (sort1.getSort()==null?0:sort1.getSort()) - (sort2.getSort()==null?0:sort2.getSort());
|
||||
}).collect(Collectors.toList());
|
||||
return children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CoursePsyche> getCoursePsycheList() {
|
||||
return this.Psyches(0);
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.service.CoursePsycheService;
|
||||
import com.peanut.modules.common.service.UserCourseStudyingService;
|
||||
import com.peanut.modules.common.service.UserVipService;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.master.service.CourseCatalogueService;
|
||||
import com.peanut.modules.master.service.CourseService;
|
||||
import com.peanut.modules.master.service.UserCourseBuyService;
|
||||
@@ -31,6 +32,8 @@ public class PsycheHomeController {
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
@Autowired
|
||||
private CourseCatalogueService courseCatalogueService;
|
||||
@Autowired
|
||||
private ShopProductService shopProductService;
|
||||
|
||||
//获取标签列表
|
||||
@@ -42,6 +45,13 @@ public class PsycheHomeController {
|
||||
return R.ok().put("labels",psycheLabels);
|
||||
}
|
||||
|
||||
//获取课程分类标签单节点的子分类标签树
|
||||
@RequestMapping("/getChildCoursePsycheTree")
|
||||
public R getChildCoursePsycheTree(@RequestBody ParamTo param){
|
||||
List<CoursePsyche> labelsTree = coursePsycheService.getChildCoursePsycheTree(param);
|
||||
return R.ok().put("labels",labelsTree);
|
||||
}
|
||||
|
||||
//获取标签下的课程列表
|
||||
@RequestMapping("/getPsycheCourseList")
|
||||
public R getPsycheCourseList(@RequestBody Map<String,Object> params){
|
||||
@@ -52,6 +62,11 @@ public class PsycheHomeController {
|
||||
wrapper.orderByAsc(CourseToPsyche::getSort);
|
||||
Page<CourseEntity> courseEntityPage = courseService.page(new Page<>(
|
||||
Long.parseLong(params.get("page").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||
for (CourseEntity c:courseEntityPage.getRecords()){
|
||||
c.setCourseCatalogueEntityList(courseCatalogueService.list(new LambdaQueryWrapper<CourseCatalogueEntity>()
|
||||
.eq(CourseCatalogueEntity::getCourseId,c.getId())
|
||||
.orderByAsc(CourseCatalogueEntity::getSort)));
|
||||
}
|
||||
return R.ok().put("courses",courseEntityPage);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user