商品模块
This commit is contained in:
@@ -148,6 +148,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
@Override
|
||||
public List<ProductDTO> getProductList(ProductDTO param) {
|
||||
QueryWrapper queryWrapper = buildFullQueryWrapper(param);
|
||||
queryWrapper.eq(Product::getIsSale, YesNoEnum.YES.value());
|
||||
List<ProductDTO> records = super.listAs(queryWrapper, ProductDTO.class);
|
||||
buildProductExtInfo(records);
|
||||
return records;
|
||||
@@ -280,18 +281,36 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
String type = param.getType();
|
||||
Long id = param.getId();
|
||||
Integer isSale = param.getIsSale();
|
||||
UpdateChain.of(ProdSku.class)
|
||||
.set(ProdSku::getIsGrounding, isSale)
|
||||
.eq(ProdSku::getId, id)
|
||||
.eq(ProdSku::getShopId, shopId)
|
||||
.update();
|
||||
if (ProductIsSaleTypeEnum.PRODUCT.value().equals(type)) {
|
||||
if (ProductIsSaleTypeEnum.SKU.value().equals(type)) {
|
||||
ProdSku prodSku = prodSkuMapper.selectOneById(id);
|
||||
if (prodSku == null) {
|
||||
throw new CzgException("SKU不存在");
|
||||
}
|
||||
prodSku.setIsGrounding(isSale);
|
||||
prodSkuMapper.update(prodSku);
|
||||
long normalCount = prodSkuMapper.selectCountByQuery(QueryWrapper.create().eq(ProdSku::getProductId, prodSku.getProductId()).eq(ProdSku::getIsDel, DeleteEnum.NORMAL.value()));
|
||||
if (normalCount == 0) {
|
||||
UpdateChain.of(Product.class)
|
||||
.set(Product::getIsSale, isSale)
|
||||
.eq(Product::getId, prodSku.getProductId())
|
||||
.eq(Product::getShopId, shopId)
|
||||
.update();
|
||||
}
|
||||
} else if (ProductIsSaleTypeEnum.PRODUCT.value().equals(type)) {
|
||||
UpdateChain.of(Product.class)
|
||||
.set(Product::getIsSale, isSale)
|
||||
.eq(Product::getId, id)
|
||||
.eq(Product::getShopId, shopId)
|
||||
.update();
|
||||
UpdateChain.of(ProdSku.class)
|
||||
.set(ProdSku::getIsGrounding, isSale)
|
||||
.eq(ProdSku::getProductId, id)
|
||||
.eq(ProdSku::getShopId, shopId)
|
||||
.update();
|
||||
}
|
||||
|
||||
prodSkuMapper.selectOneById(id);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user