1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- package com.foonsu.efenxiao.platform.service.impl;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.core.toolkit.Wrappers;
- import com.foonsu.efenxiao.platform.entity.PlatformGoods;
- import com.foonsu.efenxiao.platform.entity.PlatformGoodsDistribute;
- import com.foonsu.efenxiao.platform.entity.PlatformGoodsSku;
- import com.foonsu.efenxiao.platform.vo.PlatformGoodsSkuVO;
- import com.foonsu.efenxiao.platform.mapper.PlatformGoodsSkuMapper;
- import com.foonsu.efenxiao.platform.service.IPlatformGoodsSkuService;
- import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- import org.checkerframework.checker.units.qual.A;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import org.springframework.transaction.annotation.Transactional;
- import java.util.ArrayList;
- import java.util.List;
- @Service
- public class PlatformGoodsSkuServiceImpl extends ServiceImpl<PlatformGoodsSkuMapper, PlatformGoodsSku> implements IPlatformGoodsSkuService {
- @Autowired
- private PlatformGoodsDistributeServiceImpl platformGoodsDistributeService;
- @Override
- public IPage<PlatformGoodsSkuVO> selectPlatformGoodsSkuPage(IPage<PlatformGoodsSkuVO> page, PlatformGoodsSkuVO platformGoodsSku) {
- return page.setRecords(baseMapper.selectPlatformGoodsSkuPage(page, platformGoodsSku));
- }
- @Override
- public PlatformGoodsSku queryByProductIdSkuId(Long shopBizId, String productId, String skuId) {
- LambdaQueryWrapper<PlatformGoodsSku> queryWrapper = Wrappers.<PlatformGoodsSku>query().lambda().eq(PlatformGoodsSku::getShopBizId, shopBizId)
- .eq(PlatformGoodsSku::getProductId, productId).eq(PlatformGoodsSku::getSkuId, skuId);
- List<PlatformGoodsSku> skus = baseMapper.selectList(queryWrapper);
- return skus.size()>0?skus.get(0):null;
- }
- @Override
- @Transactional
- public void addPlatformGoodsSku(PlatformGoodsSku sku, PlatformGoodsDistribute platformGoodsDistribute) {
- this.save(sku);
- platformGoodsDistributeService.save(platformGoodsDistribute);
- }
- @Override
- public List<PlatformGoodsSku> queryByProductIdsSkuIds(Long shopId, List<String> productIds, List<String> skuIds) {
- if(skuIds.size() == 0){
- return new ArrayList<>();
- }
- LambdaQueryWrapper<PlatformGoodsSku> queryWrapper = Wrappers.<PlatformGoodsSku>query().lambda().eq(PlatformGoodsSku::getShopBizId, shopId)
- .in(PlatformGoodsSku::getProductId, productIds).in(PlatformGoodsSku::getSkuId, skuIds);
- List<PlatformGoodsSku> skus = baseMapper.selectList(queryWrapper);
- return skus;
- }
- }
|