|
|
|
|
@@ -6,14 +6,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.peanut.common.utils.PageUtils;
|
|
|
|
|
import com.peanut.common.utils.Query;
|
|
|
|
|
import com.peanut.modules.book.dao.ShopProudictBookDao;
|
|
|
|
|
import com.peanut.modules.book.dao.ShopProductBookDao;
|
|
|
|
|
import com.peanut.modules.book.entity.BookEntity;
|
|
|
|
|
import com.peanut.modules.book.entity.ShopProductEntity;
|
|
|
|
|
import com.peanut.modules.book.entity.ShopProudictBookEntity;
|
|
|
|
|
import com.peanut.modules.book.entity.ShopProductBookEntity;
|
|
|
|
|
import com.peanut.modules.book.service.BookService;
|
|
|
|
|
import com.peanut.modules.book.service.ShopProductService;
|
|
|
|
|
import com.peanut.modules.book.service.ShopProudictBookService;
|
|
|
|
|
import com.peanut.modules.book.vo.ProudictBookqueryVO;
|
|
|
|
|
import com.peanut.modules.book.service.ShopProductBookService;
|
|
|
|
|
import com.peanut.modules.book.vo.ProductBookQueryVO;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
@@ -22,50 +22,50 @@ import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
@Service("shopProudictBookService")
|
|
|
|
|
public class ShopProudictBookServiceImpl extends ServiceImpl<ShopProudictBookDao, ShopProudictBookEntity> implements ShopProudictBookService {
|
|
|
|
|
@Service("shopProductBookService")
|
|
|
|
|
public class ShopProductBookServiceImpl extends ServiceImpl<ShopProductBookDao, ShopProductBookEntity> implements ShopProductBookService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private ShopProductService shopProductService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private BookService bookService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ShopProudictBookDao shopProudictBookDao;
|
|
|
|
|
private ShopProductBookDao shopProductBookDao;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageUtils queryPage(Map<String, Object> params) {
|
|
|
|
|
IPage<ShopProudictBookEntity> page = this.page(
|
|
|
|
|
new Query<ShopProudictBookEntity>().getPage(params),
|
|
|
|
|
new QueryWrapper<ShopProudictBookEntity>()
|
|
|
|
|
IPage<ShopProductBookEntity> page = this.page(
|
|
|
|
|
new Query<ShopProductBookEntity>().getPage(params),
|
|
|
|
|
new QueryWrapper<>()
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return new PageUtils(page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageUtils proudictBookqueryPage(Map<String, Object> params) {
|
|
|
|
|
public PageUtils productBookQueryPage(Map<String, Object> params) {
|
|
|
|
|
Object proudictId = params.get("proudictId");
|
|
|
|
|
IPage<ShopProudictBookEntity> page = this.page(
|
|
|
|
|
new Query<ShopProudictBookEntity>().getPage(params),
|
|
|
|
|
new QueryWrapper<ShopProudictBookEntity>().eq("proudict_id", proudictId)
|
|
|
|
|
IPage<ShopProductBookEntity> page = this.page(
|
|
|
|
|
new Query<ShopProductBookEntity>().getPage(params),
|
|
|
|
|
new QueryWrapper<ShopProductBookEntity>().eq("product_id", proudictId)
|
|
|
|
|
);
|
|
|
|
|
List<ShopProudictBookEntity> records = page.getRecords();
|
|
|
|
|
List<ShopProductBookEntity> records = page.getRecords();
|
|
|
|
|
return new PageUtils(page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<ProudictBookqueryVO> getCartList(Integer proudictId) {
|
|
|
|
|
public List<ProductBookQueryVO> getCartList(Integer productId) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ShopProductEntity shopProductEntity = shopProductService.getBaseMapper().selectOne(new QueryWrapper<ShopProductEntity>().eq("proudict_id", proudictId));
|
|
|
|
|
List<ShopProudictBookEntity> proudictBooklist = this.list(new QueryWrapper<ShopProudictBookEntity>().eq("proudict_id", proudictId));
|
|
|
|
|
ShopProductEntity shopProductEntity = shopProductService.getBaseMapper().selectOne(new QueryWrapper<ShopProductEntity>().eq("product_id", productId));
|
|
|
|
|
List<ShopProductBookEntity> proudictBooklist = this.list(new QueryWrapper<ShopProductBookEntity>().eq("product_id", productId));
|
|
|
|
|
List prList = new ArrayList<>();
|
|
|
|
|
List prLists = new ArrayList<>();
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
for (ShopProudictBookEntity shopProudictBookEntity : proudictBooklist) {
|
|
|
|
|
Integer bookId = shopProudictBookEntity.getBookId();
|
|
|
|
|
List<ShopProudictBookEntity> booklist = this.list(new QueryWrapper<ShopProudictBookEntity>().eq("book_id", bookId));
|
|
|
|
|
for (ShopProudictBookEntity shopProudictBook : booklist) {
|
|
|
|
|
Integer proudictId1 = shopProudictBook.getProudictId();
|
|
|
|
|
for (ShopProductBookEntity shopProductBookEntity : proudictBooklist) {
|
|
|
|
|
Integer bookId = shopProductBookEntity.getBookId();
|
|
|
|
|
List<ShopProductBookEntity> booklist = this.list(new QueryWrapper<ShopProductBookEntity>().eq("book_id", bookId));
|
|
|
|
|
for (ShopProductBookEntity shopProudictBook : booklist) {
|
|
|
|
|
Integer proudictId1 = shopProudictBook.getProductId();
|
|
|
|
|
Integer bookId1 = shopProudictBook.getBookId();
|
|
|
|
|
BookEntity bookbyId = bookService.getById(bookId1);
|
|
|
|
|
prList.add(bookbyId);
|
|
|
|
|
@@ -78,10 +78,10 @@ public class ShopProudictBookServiceImpl extends ServiceImpl<ShopProudictBookDao
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Integer> getBookidsByProductId(Integer productId) {
|
|
|
|
|
List<ShopProudictBookEntity> spbs = this.list(new QueryWrapper<ShopProudictBookEntity>().eq("del_flag", 0).eq("proudict_id", productId));
|
|
|
|
|
public List<Integer> getBookIdsByProductId(Integer productId) {
|
|
|
|
|
List<ShopProductBookEntity> spbs = this.list(new QueryWrapper<ShopProductBookEntity>().eq("del_flag", 0).eq("proudict_id", productId));
|
|
|
|
|
List<Integer> ids = new ArrayList();
|
|
|
|
|
for (ShopProudictBookEntity s : spbs) {
|
|
|
|
|
for (ShopProductBookEntity s : spbs) {
|
|
|
|
|
ids.add(s.getBookId());
|
|
|
|
|
}
|
|
|
|
|
return ids;
|
|
|
|
|
@@ -89,14 +89,14 @@ public class ShopProudictBookServiceImpl extends ServiceImpl<ShopProudictBookDao
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Integer getProductByBookId(Integer bookId) {
|
|
|
|
|
LambdaQueryWrapper<ShopProudictBookEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
wrapper.eq(ShopProudictBookEntity::getBookId, bookId);
|
|
|
|
|
wrapper.eq(ShopProudictBookEntity::getDelFlag, 0);
|
|
|
|
|
wrapper.groupBy(ShopProudictBookEntity::getProudictId);
|
|
|
|
|
List<ShopProudictBookEntity> shopProudictBookEntities = this.getBaseMapper().selectList(wrapper);
|
|
|
|
|
LambdaQueryWrapper<ShopProductBookEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
wrapper.eq(ShopProductBookEntity::getBookId, bookId);
|
|
|
|
|
wrapper.eq(ShopProductBookEntity::getDelFlag, 0);
|
|
|
|
|
wrapper.groupBy(ShopProductBookEntity::getProductId);
|
|
|
|
|
List<ShopProductBookEntity> shopProudictBookEntities = this.getBaseMapper().selectList(wrapper);
|
|
|
|
|
List ids = new ArrayList();
|
|
|
|
|
for (ShopProudictBookEntity s : shopProudictBookEntities) {
|
|
|
|
|
ids.add(s.getProudictId());
|
|
|
|
|
for (ShopProductBookEntity s : shopProudictBookEntities) {
|
|
|
|
|
ids.add(s.getProductId());
|
|
|
|
|
}
|
|
|
|
|
if (ids.size() == 0) {
|
|
|
|
|
return null;
|
|
|
|
|
@@ -114,7 +114,7 @@ public class ShopProudictBookServiceImpl extends ServiceImpl<ShopProudictBookDao
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Integer> getOrderBookId(String orderSn) {
|
|
|
|
|
return shopProudictBookDao.getOrderBookId(orderSn);
|
|
|
|
|
return shopProductBookDao.getOrderBookId(orderSn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|