课程详细添加课程关联商品
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.common.to.ChangeCatalogueFeeDto;
|
||||||
import com.peanut.modules.master.service.*;
|
import com.peanut.modules.master.service.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -32,6 +33,8 @@ public class CourseController {
|
|||||||
private CourseCatalogueChapterVideoService courseCatalogueChapterVideoService;
|
private CourseCatalogueChapterVideoService courseCatalogueChapterVideoService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysCourseDirectService sysCourseDirectService;
|
private SysCourseDirectService sysCourseDirectService;
|
||||||
|
@Autowired
|
||||||
|
private ShopProductService shopProductService;
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("/getCourseList")
|
@RequestMapping("/getCourseList")
|
||||||
@@ -60,7 +63,15 @@ public class CourseController {
|
|||||||
@RequestMapping("/getCoursedetail")
|
@RequestMapping("/getCoursedetail")
|
||||||
public R getCoursedetail(@RequestBody ParamTo param){
|
public R getCoursedetail(@RequestBody ParamTo param){
|
||||||
CourseEntity course = courseService.getById(param.getId());
|
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")
|
@RequestMapping("/getCourseCatalogues")
|
||||||
@@ -195,6 +206,12 @@ public class CourseController {
|
|||||||
return R.ok();
|
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.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.peanut.common.utils.R;
|
import com.peanut.common.utils.R;
|
||||||
import com.peanut.modules.common.entity.CourseEntity;
|
import com.peanut.modules.common.entity.CourseEntity;
|
||||||
|
import com.peanut.modules.common.entity.ShopProduct;
|
||||||
import com.peanut.modules.common.to.ParamTo;
|
import com.peanut.modules.common.to.ParamTo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -30,4 +31,6 @@ public interface CourseService extends IService<CourseEntity> {
|
|||||||
R courseCatalogueTransfer(Map<String,Object> param);
|
R courseCatalogueTransfer(Map<String,Object> param);
|
||||||
|
|
||||||
R getCourseLableLinkList(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.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.peanut.common.utils.ObjectUtils;
|
import com.peanut.common.utils.ObjectUtils;
|
||||||
import com.peanut.common.utils.R;
|
import com.peanut.common.utils.R;
|
||||||
import com.peanut.modules.book.service.CouponProductRelationService;
|
|
||||||
import com.peanut.modules.common.dao.*;
|
import com.peanut.modules.common.dao.*;
|
||||||
import com.peanut.modules.common.entity.*;
|
import com.peanut.modules.common.entity.*;
|
||||||
import com.peanut.modules.common.to.ParamTo;
|
import com.peanut.modules.common.to.ParamTo;
|
||||||
@@ -15,7 +14,6 @@ import com.peanut.modules.master.service.CourseService;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -289,6 +287,22 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|||||||
return R.ok().put("resList",resList);
|
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){
|
private CourseMedicine getPCourseMedicine(CourseMedicine m){
|
||||||
if (m.getPid()!=0){
|
if (m.getPid()!=0){
|
||||||
CourseMedicine pm = medicalDao.selectById(m.getPid());
|
CourseMedicine pm = medicalDao.selectById(m.getPid());
|
||||||
|
|||||||
Reference in New Issue
Block a user