心灵空间
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package com.peanut.modules.psyche.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
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.master.service.CourseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController("psycheHome")
|
||||
@RequestMapping("psyche/home")
|
||||
public class PsycheHomeController {
|
||||
|
||||
@Autowired
|
||||
private CoursePsycheService coursePsycheService;
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
|
||||
//获取标签列表
|
||||
@RequestMapping("/getPsycheLabels")
|
||||
public R getPsycheLabels(@RequestBody Map<String,Object> params){
|
||||
List<CoursePsyche> psycheLabels = coursePsycheService.list(new LambdaQueryWrapper<CoursePsyche>()
|
||||
.eq(CoursePsyche::getPid,params.get("id"))
|
||||
.orderByAsc(CoursePsyche::getSort));
|
||||
return R.ok().put("labels",psycheLabels);
|
||||
}
|
||||
|
||||
//获取标签下的课程列表
|
||||
@RequestMapping("/getPsycheCourseList")
|
||||
public R getPsycheCourseList(@RequestBody Map<String,Object> params){
|
||||
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.selectAll(CourseEntity.class);
|
||||
wrapper.leftJoin(CourseToPsyche.class,CourseToPsyche::getCourseId,CourseEntity::getId);
|
||||
wrapper.eq(CourseToPsyche::getPsycheId,params.get("id"));
|
||||
wrapper.orderByAsc(CourseToPsyche::getSort);
|
||||
Page<CourseEntity> courseEntityPage = courseService.page(new Page<>(
|
||||
Long.parseLong(params.get("page").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||
return R.ok().put("courses",courseEntityPage);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user