商品模块代码提交
This commit is contained in:
@@ -16,6 +16,7 @@ import com.czg.product.entity.Product;
|
||||
import com.czg.product.enums.ProductIsSaleTypeEnum;
|
||||
import com.czg.product.enums.ProductTypeEnum;
|
||||
import com.czg.product.param.ProductIsSaleParam;
|
||||
import com.czg.product.param.ProductIsSoldOutParam;
|
||||
import com.czg.product.service.ProductService;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.product.mapper.ProdSkuMapper;
|
||||
@@ -256,23 +257,38 @@ 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)
|
||||
.update();
|
||||
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)
|
||||
.update();
|
||||
} else if (ProductIsSaleTypeEnum.SKU.value().equals(type)) {
|
||||
UpdateChain.of(ProdSku.class)
|
||||
.set(ProdSku::getIsGrounding, isSale)
|
||||
.eq(ProdSku::getId, id)
|
||||
.update();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean markProductIsSoldOut(ProductIsSoldOutParam param) {
|
||||
Long shopId = StpKit.USER.getLoginIdAsLong();
|
||||
String type = param.getType();
|
||||
Long id = param.getId();
|
||||
Integer isSoldOut = param.getIsSoldOut();
|
||||
UpdateChain.of(ProdSku.class)
|
||||
.set(ProdSku::getIsPauseSale, isSoldOut)
|
||||
.eq(ProdSku::getProductId, id)
|
||||
.update();
|
||||
if (ProductIsSaleTypeEnum.PRODUCT.value().equals(type)) {
|
||||
UpdateChain.of(Product.class)
|
||||
.set(Product::getIsSoldStock, isSoldOut)
|
||||
.eq(Product::getId, id)
|
||||
.eq(Product::getShopId, shopId)
|
||||
.update();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user