吴门医述首页获取课程分类标签单节点的子分类标签树
This commit is contained in:
@@ -43,6 +43,13 @@ public class HomeController {
|
||||
return R.ok().put("labels",labelsTree);
|
||||
}
|
||||
|
||||
//获取医学标签树
|
||||
@RequestMapping("/getChildCourseMedicalTree")
|
||||
public R getChildCourseMedicalTree(@RequestBody ParamTo param){
|
||||
List<CourseMedicine> labelsTree = medicalService.getChildCourseMedicalTree(param);
|
||||
return R.ok().put("labels",labelsTree);
|
||||
}
|
||||
|
||||
//获取医学标签下的课程列表
|
||||
@RequestMapping("/getMedicalCourseList")
|
||||
public R getMedicalCourseList(@RequestBody ParamTo param){
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.peanut.modules.medical.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.CourseMedicine;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -10,4 +11,6 @@ public interface CourseMedicalService extends IService<CourseMedicine> {
|
||||
List<CourseMedicine> getMedicalLabels(Integer id);
|
||||
|
||||
List<CourseMedicine> getCourseMedicalTree();
|
||||
|
||||
List<CourseMedicine> getChildCourseMedicalTree(ParamTo param);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.CourseMedicineDao;
|
||||
import com.peanut.modules.common.entity.CourseMedicine;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.medical.service.CourseMedicalService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -27,8 +28,22 @@ public class CourseMedicalServiceImpl extends ServiceImpl<CourseMedicineDao, Cou
|
||||
@Override
|
||||
public List<CourseMedicine> getCourseMedicalTree() {
|
||||
List<CourseMedicine> medicines = this.list(new QueryWrapper<>());
|
||||
List<CourseMedicine> medicinesTree = medicines.stream().filter((courseMarketEntity) ->
|
||||
courseMarketEntity.getPid() == 0
|
||||
List<CourseMedicine> medicinesTree = medicines.stream().filter((courseMedicine) ->
|
||||
courseMedicine.getPid() == 0
|
||||
).map((medicine)->{
|
||||
medicine.setChildren(getMedicineChildrens(medicine,medicines));
|
||||
return medicine;
|
||||
}).sorted((sort1,sort2)->{
|
||||
return (sort1.getSort() == null? 0 : sort1.getSort()) - (sort2.getSort()==null?0:sort2.getSort());
|
||||
}).collect(Collectors.toList());
|
||||
return medicinesTree;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CourseMedicine> getChildCourseMedicalTree(ParamTo param) {
|
||||
List<CourseMedicine> medicines = this.list(new QueryWrapper<>());
|
||||
List<CourseMedicine> medicinesTree = medicines.stream().filter((courseMedicine) ->
|
||||
courseMedicine.getPid() == param.getId()
|
||||
).map((medicine)->{
|
||||
medicine.setChildren(getMedicineChildrens(medicine,medicines));
|
||||
return medicine;
|
||||
|
||||
Reference in New Issue
Block a user