课程详细添加课程关联商品
This commit is contained in:
@@ -9,6 +9,7 @@ import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.common.to.ChangeCatalogueFeeDto;
|
||||
import com.peanut.modules.master.service.*;
|
||||
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;
|
||||
@@ -32,6 +33,8 @@ public class CourseController {
|
||||
private CourseCatalogueChapterVideoService courseCatalogueChapterVideoService;
|
||||
@Autowired
|
||||
private SysCourseDirectService sysCourseDirectService;
|
||||
@Autowired
|
||||
private ShopProductService shopProductService;
|
||||
|
||||
|
||||
@RequestMapping("/getCourseList")
|
||||
@@ -60,7 +63,15 @@ public class CourseController {
|
||||
@RequestMapping("/getCoursedetail")
|
||||
public R getCoursedetail(@RequestBody ParamTo param){
|
||||
CourseEntity course = courseService.getById(param.getId());
|
||||
return R.ok().put("course",course);
|
||||
List<ShopProduct> shopProductList = null;
|
||||
//课程关联商品
|
||||
if (StringUtils.isNotEmpty(course.getRelationProductIds())){
|
||||
String[] ids = course.getRelationProductIds().split(",");
|
||||
shopProductList = shopProductService.list(new LambdaQueryWrapper<ShopProduct>()
|
||||
.in(ShopProduct::getProductId, ids)
|
||||
.orderByAsc(ShopProduct::getSort));
|
||||
}
|
||||
return R.ok().put("course",course).put("shopProductList",shopProductList);
|
||||
}
|
||||
|
||||
@RequestMapping("/getCourseCatalogues")
|
||||
@@ -195,6 +206,12 @@ public class CourseController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/getProductListForCourse")
|
||||
public R getProductListForCourse(@RequestBody Map<String,Object> param){
|
||||
Page<ShopProduct> shopProductListhopProducts = courseService.getProductListForCourse(param);
|
||||
return R.ok().put("shopProductListhopProducts",shopProductListhopProducts);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.common.entity.ShopProduct;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
|
||||
import java.util.List;
|
||||
@@ -30,4 +31,6 @@ public interface CourseService extends IService<CourseEntity> {
|
||||
R courseCatalogueTransfer(Map<String,Object> param);
|
||||
|
||||
R getCourseLableLinkList(Map<String,Object> param);
|
||||
|
||||
Page<ShopProduct> getProductListForCourse(Map<String,Object> param);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.ObjectUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.service.CouponProductRelationService;
|
||||
import com.peanut.modules.common.dao.*;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
@@ -15,7 +14,6 @@ import com.peanut.modules.master.service.CourseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -289,6 +287,22 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
||||
return R.ok().put("resList",resList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ShopProduct> getProductListForCourse(Map<String, Object> param) {
|
||||
Integer limit = Integer.valueOf(param.get("limit").toString());
|
||||
Integer page = Integer.valueOf(param.get("page").toString());
|
||||
CourseEntity c = this.getOne(new LambdaQueryWrapper<CourseEntity>().eq(CourseEntity::getId,param.get("courseId")));
|
||||
Page<ShopProduct> resPage = null;
|
||||
LambdaQueryWrapper<ShopProduct> w = new LambdaQueryWrapper<>();
|
||||
w.like(ShopProduct::getProductName,param.get("productName"));
|
||||
if (StringUtils.isNotBlank(c.getRelationProductIds())){
|
||||
String[] productIds = c.getRelationProductIds().split(",");
|
||||
w.notIn(ShopProduct::getProductId,productIds);
|
||||
}
|
||||
resPage = shopProductDao.selectPage(new Page<>(page, limit), w);
|
||||
return resPage;
|
||||
}
|
||||
|
||||
private CourseMedicine getPCourseMedicine(CourseMedicine m){
|
||||
if (m.getPid()!=0){
|
||||
CourseMedicine pm = medicalDao.selectById(m.getPid());
|
||||
|
||||
Reference in New Issue
Block a user