心灵空间

This commit is contained in:
wuchunlei
2025-02-07 17:10:49 +08:00
parent d8e7c90c01
commit 26d08a5f8b
28 changed files with 1027 additions and 3 deletions

View File

@@ -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);
}
}