|
|
|
|
@@ -3,24 +3,30 @@ package com.peanut.modules.sociology.service.impl;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import com.peanut.modules.common.dao.BookDao;
|
|
|
|
|
import com.peanut.modules.common.dao.ShopProductBookDao;
|
|
|
|
|
import com.peanut.modules.common.dao.ShopProductCourseDao;
|
|
|
|
|
import com.peanut.modules.common.dao.ShopProductDao;
|
|
|
|
|
import com.peanut.modules.common.entity.ShopProduct;
|
|
|
|
|
import com.peanut.modules.common.entity.ShopProductCourseEntity;
|
|
|
|
|
import com.peanut.modules.common.entity.ShopProductToSociologyMarket;
|
|
|
|
|
import com.peanut.modules.common.entity.*;
|
|
|
|
|
import com.peanut.modules.common.to.ParamTo;
|
|
|
|
|
import com.peanut.modules.sociology.service.ShopProductService;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Service("sociologyShopProduct")
|
|
|
|
|
public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProduct> implements ShopProductService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private ShopProductCourseDao shopProductCourseDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ShopProductBookDao shopProductBookDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private BookDao bookDao;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Page getMarketProductList(ParamTo param) {
|
|
|
|
|
@@ -32,7 +38,6 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
|
|
|
|
return shopProductPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<ShopProduct> getProductListForCourse(Integer catalogueId) {
|
|
|
|
|
MPJLambdaWrapper<ShopProductCourseEntity> wrapper = new MPJLambdaWrapper<>();
|
|
|
|
|
@@ -43,4 +48,27 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
|
|
|
|
List<ShopProduct> shopProducts = shopProductCourseDao.selectJoinList(ShopProduct.class, wrapper);
|
|
|
|
|
return shopProducts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getProductDetail(Integer productId) {
|
|
|
|
|
ShopProduct product = this.getById(productId);
|
|
|
|
|
HashMap<String, Object> flag = new HashMap<>();
|
|
|
|
|
flag.put("detail",product);//基础信息
|
|
|
|
|
//查询包含的书
|
|
|
|
|
MPJLambdaWrapper<ShopProductBookEntity> shopProductBookEntityMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
|
|
shopProductBookEntityMPJLambdaWrapper.selectAll(BookEntity.class);
|
|
|
|
|
shopProductBookEntityMPJLambdaWrapper.leftJoin(BookEntity.class,BookEntity::getId,ShopProductBookEntity::getBookId);
|
|
|
|
|
shopProductBookEntityMPJLambdaWrapper.eq(ShopProductBookEntity::getProductId,productId);
|
|
|
|
|
List<BookEntity> bookEntities = shopProductBookDao.selectJoinList(BookEntity.class, shopProductBookEntityMPJLambdaWrapper);
|
|
|
|
|
flag.put("books",bookEntities);
|
|
|
|
|
//查询包含的课
|
|
|
|
|
MPJLambdaWrapper<ShopProductCourseEntity> shopProductCourseEntityMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
|
|
shopProductCourseEntityMPJLambdaWrapper.selectAll(CourseEntity.class);
|
|
|
|
|
shopProductCourseEntityMPJLambdaWrapper.leftJoin(CourseEntity.class,CourseEntity::getId,ShopProductCourseEntity::getCourseId);
|
|
|
|
|
shopProductCourseEntityMPJLambdaWrapper.eq(ShopProductCourseEntity::getProductId,productId);
|
|
|
|
|
List<CourseEntity> courseEntities = shopProductCourseDao.selectJoinList(CourseEntity.class, shopProductCourseEntityMPJLambdaWrapper);
|
|
|
|
|
flag.put("courses",courseEntities);
|
|
|
|
|
|
|
|
|
|
return flag;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|