库存改为商品级库存

This commit is contained in:
2024-10-11 14:14:10 +08:00
parent cc4d34b6fe
commit 713ff653ad

View File

@@ -801,7 +801,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
*/
public void incrStock(Integer productId, Integer skuId, Integer addNum) {
TbProduct product = productMapper.selectById(productId);
if (product.getIsDistribute() == 1) {
if (true || product.getIsDistribute() == 1) {
productMapper.incrStock(product.getId(), addNum);
} else {
producSkutMapper.incrStock(skuId, addNum);
@@ -817,7 +817,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
*/
public void decrStock(Integer productId, String skuId, int decrNum) {
TbProduct product = productMapper.selectById(productId);
if (product.getIsDistribute() == 1) {
if (true || product.getIsDistribute() == 1) {
if (product.getIsStock() == 1) {
if (productMapper.decrStock(productId, decrNum) < 1) {
throw new BadRequestException(product.getName() + "库存不足,下单失败");