库存改为商品级库存
This commit is contained in:
@@ -801,7 +801,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||||||
*/
|
*/
|
||||||
public void incrStock(Integer productId, Integer skuId, Integer addNum) {
|
public void incrStock(Integer productId, Integer skuId, Integer addNum) {
|
||||||
TbProduct product = productMapper.selectById(productId);
|
TbProduct product = productMapper.selectById(productId);
|
||||||
if (product.getIsDistribute() == 1) {
|
if (true || product.getIsDistribute() == 1) {
|
||||||
productMapper.incrStock(product.getId(), addNum);
|
productMapper.incrStock(product.getId(), addNum);
|
||||||
} else {
|
} else {
|
||||||
producSkutMapper.incrStock(skuId, addNum);
|
producSkutMapper.incrStock(skuId, addNum);
|
||||||
@@ -817,7 +817,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||||||
*/
|
*/
|
||||||
public void decrStock(Integer productId, String skuId, int decrNum) {
|
public void decrStock(Integer productId, String skuId, int decrNum) {
|
||||||
TbProduct product = productMapper.selectById(productId);
|
TbProduct product = productMapper.selectById(productId);
|
||||||
if (product.getIsDistribute() == 1) {
|
if (true || product.getIsDistribute() == 1) {
|
||||||
if (product.getIsStock() == 1) {
|
if (product.getIsStock() == 1) {
|
||||||
if (productMapper.decrStock(productId, decrNum) < 1) {
|
if (productMapper.decrStock(productId, decrNum) < 1) {
|
||||||
throw new BadRequestException(product.getName() + "库存不足,下单失败");
|
throw new BadRequestException(product.getName() + "库存不足,下单失败");
|
||||||
|
|||||||
Reference in New Issue
Block a user