课程太湖云医关联
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
package com.peanut.modules.taihumed.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.CourseToTalent;
|
||||
import com.peanut.modules.common.entity.TaihuTalent;
|
||||
import com.peanut.modules.common.service.CourseToTalentService;
|
||||
import com.peanut.modules.common.service.TaihuTalentService;
|
||||
import com.peanut.modules.master.service.CourseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
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.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController("taihumedCourse")
|
||||
@RequestMapping("taihumed/course")
|
||||
public class CourseController {
|
||||
|
||||
@Autowired
|
||||
private CourseToTalentService courseToTalentService;
|
||||
@Autowired
|
||||
private TaihuTalentService taihuTalentService;
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
|
||||
//名医精彩列表
|
||||
@RequestMapping("/getCourseToTalentList")
|
||||
public R getCourseToTalentList(@RequestBody Map<String,Object> params){
|
||||
List res = new ArrayList();
|
||||
MPJLambdaWrapper<CourseToTalent> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,CourseToTalent::getCourseId);
|
||||
wrapper.leftJoin(TaihuTalent.class,TaihuTalent::getId,CourseToTalent::getTalentId);
|
||||
wrapper.selectAll(CourseToTalent.class);
|
||||
wrapper.like(StringUtils.isNotEmpty(params.get("userName").toString()),TaihuTalent::getName,params.get("userName"));
|
||||
wrapper.like(StringUtils.isNotEmpty(params.get("courseName").toString()),CourseEntity::getTitle,params.get("courseName"));
|
||||
wrapper.orderByAsc(CourseToTalent::getSort);
|
||||
Page<CourseToTalent> pageRes = courseToTalentService.page(new Page<>(Long.parseLong(params.get("current").toString())
|
||||
, Long.parseLong(params.get("limit").toString())),wrapper);
|
||||
for (CourseToTalent courseToTalent:pageRes.getRecords()){
|
||||
courseToTalent.setCourseEntity(courseService.getById(courseToTalent.getCourseId()));
|
||||
courseToTalent.setTaihuTalent(taihuTalentService.getById(courseToTalent.getTalentId()));
|
||||
}
|
||||
return R.ok().put("pageRes",pageRes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user