This commit is contained in:
wangjinlei
2024-05-21 16:54:36 +08:00
parent f246c8a0a9
commit 8cfb645798
4 changed files with 38 additions and 10 deletions

View File

@@ -247,7 +247,7 @@ public class ShopProductController {
/**
* 获取关联订单列表
* 获取关联商品列表
*
* @param productId
* @return

View File

@@ -121,16 +121,24 @@ public class CourseMedicineMarketController {
/**
* 获取营销标签下课程
*/
// @RequestMapping(path = "/getCourseByMarketId")
// public R getCourseByMarket(@RequestBody Map<String, Object> params) {
// MPJLambdaWrapper<CourseToMedicineMarketEntity> wrapper = new MPJLambdaWrapper();
// wrapper.leftJoin(CourseEntity.class,CourseEntity::getId, CourseToMedicineMarketEntity::getCourseId);
// wrapper.selectAll(CourseEntity.class);
// wrapper.like(CourseEntity::getTitle,params.get("title"));
// wrapper.eq(CourseToMedicineMarketEntity::getMedicineMarketId,params.get("marketId"));
// Page res = toMarketService.pageMaps(new Page<>(
// Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
// return R.ok().put("result", res);
// }
@RequestMapping(path = "/getCourseByMarketId")
public R getCourseByMarket(@RequestBody Map<String, Object> params) {
MPJLambdaWrapper<CourseToMedicineMarketEntity> wrapper = new MPJLambdaWrapper();
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId, CourseToMedicineMarketEntity::getCourseId);
wrapper.selectAll(CourseEntity.class);
wrapper.like(CourseEntity::getTitle,params.get("title"));
wrapper.eq(CourseToMedicineMarketEntity::getMedicineMarketId,params.get("marketId"));
Page res = toMarketService.pageMaps(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
return R.ok().put("result", res);
public R getCourseByMarketId(@RequestBody Map<String,Integer> map){
int marketId = map.get("marketId");
List<CourseEntity> courseByMarketId = toMarketService.getCourseByMarketId(marketId);
return R.ok().put("list",courseByMarketId);
}
/**

View File

@@ -1,7 +1,12 @@
package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.CourseEntity;
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
import java.util.List;
public interface CourseToMedicineMarketService extends IService<CourseToMedicineMarketEntity> {
List<CourseEntity> getCourseByMarketId(int marketId);
}

View File

@@ -1,13 +1,28 @@
package com.peanut.modules.master.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.modules.common.dao.CourseToMedicineMarketDao;
import com.peanut.modules.common.entity.CourseEntity;
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
import com.peanut.modules.master.service.CourseToMedicineMarketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service("masterCourseToMarketService")
public class CourseToMedicineMarketServiceImpl extends ServiceImpl<CourseToMedicineMarketDao, CourseToMedicineMarketEntity> implements CourseToMedicineMarketService {
@Override
public List<CourseEntity> getCourseByMarketId(int marketId) {
MPJLambdaWrapper<CourseToMedicineMarketEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,CourseToMedicineMarketEntity::getCourseId);
wrapper.eq(CourseToMedicineMarketEntity::getMedicineMarketId,marketId);
List<CourseEntity> courseEntities = this.getBaseMapper().selectJoinList(CourseEntity.class, wrapper);
return courseEntities;
}
}