库存修改为商品级库存
This commit is contained in:
@@ -157,7 +157,7 @@ public class ProductService {
|
|||||||
|
|
||||||
public void incrStock(String productId, String skuId, int addNum) {
|
public void incrStock(String productId, String skuId, int addNum) {
|
||||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
|
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
|
||||||
if (product.getIsDistribute() == 1) {
|
if (true ||product.getIsDistribute() == 1) {
|
||||||
tbProductMapper.incrStock(productId, addNum);
|
tbProductMapper.incrStock(productId, addNum);
|
||||||
}else {
|
}else {
|
||||||
tbProductSkuMapper.incrStock(skuId, addNum);
|
tbProductSkuMapper.incrStock(skuId, addNum);
|
||||||
@@ -166,7 +166,7 @@ public class ProductService {
|
|||||||
|
|
||||||
public void decrStock(String productId, String skuId, int decrNum) {
|
public void decrStock(String productId, String skuId, int decrNum) {
|
||||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
|
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
|
||||||
if (product.getIsDistribute() == 1) {
|
if (true || product.getIsDistribute() == 1) {
|
||||||
if (product.getIsStock() == 1) {
|
if (product.getIsStock() == 1) {
|
||||||
if (tbProductMapper.decrStock(productId, decrNum) < 1) {
|
if (tbProductMapper.decrStock(productId, decrNum) < 1) {
|
||||||
throw new MsgException("库存不足,下单失败");
|
throw new MsgException("库存不足,下单失败");
|
||||||
|
|||||||
Reference in New Issue
Block a user