库存修改为商品级库存

This commit is contained in:
2024-10-12 09:20:33 +08:00
parent 93ac57971b
commit 6416eaf548

View File

@@ -157,7 +157,7 @@ public class ProductService {
public void incrStock(String productId, String skuId, int addNum) {
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
if (product.getIsDistribute() == 1) {
if (true ||product.getIsDistribute() == 1) {
tbProductMapper.incrStock(productId, addNum);
}else {
tbProductSkuMapper.incrStock(skuId, addNum);
@@ -166,7 +166,7 @@ public class ProductService {
public void decrStock(String productId, String skuId, int decrNum) {
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
if (product.getIsDistribute() == 1) {
if (true || product.getIsDistribute() == 1) {
if (product.getIsStock() == 1) {
if (tbProductMapper.decrStock(productId, decrNum) < 1) {
throw new MsgException("库存不足,下单失败");