This commit is contained in:
wangjinlei
2024-05-21 14:56:30 +08:00
parent 654cf3f6fd
commit 46f3c49197
5 changed files with 50 additions and 11 deletions

View File

@@ -3,10 +3,12 @@ package com.peanut.modules.master.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.ObjectUtils;
import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.CourseEntity;
import com.peanut.modules.common.entity.CourseMedicineMarketEntity;
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
import com.peanut.modules.common.entity.CourseToSociologyMarketEntity;
import com.peanut.modules.master.service.CourseMedicineMarketService;
import com.peanut.modules.master.service.CourseService;
import com.peanut.modules.master.service.CourseToMedicineMarketService;
@@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@RestController("masterCourseMedicineMarket")
@@ -134,15 +137,12 @@ public class CourseMedicineMarketController {
*/
@RequestMapping("/getNotToMarketList")
public R getNotToMarketList(@RequestBody Map params){
LambdaQueryWrapper<CourseEntity> wrapper = new LambdaQueryWrapper();
wrapper.like(CourseEntity::getTitle,params.get("title"));
if (params.containsKey("marketId")&&!"".equals(params.get("marketId").toString())){
String sql = "select course_id from course_to_market where del_flag = 0 and market_id = "+params.get("marketId");
wrapper.notInSql(CourseEntity::getId,sql);
}
Page<CourseEntity> page = courseService.page(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
return R.ok().put("result", page);
List<Integer> collect1 = toMarketService.getBaseMapper().selectList(new LambdaQueryWrapper<CourseToMedicineMarketEntity>().eq(CourseToMedicineMarketEntity::getMedicineMarketId, params.get("marketId"))).stream().map(CourseToMedicineMarketEntity::getCourseId).collect(Collectors.toList());
LambdaQueryWrapper<CourseEntity> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.notIn(collect1.size()>0,CourseEntity::getId,collect1);
wrapper1.like(StringUtils.isNotBlank(params.get("title").toString()),CourseEntity::getTitle,params.get("title").toString());
Page<CourseEntity> page1 = courseService.page(new Page<>(Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper1);
return R.ok().put("page",page1);
}
@RequestMapping(path = "/saveToMarket")