| | |
| | | import com.oying.modules.pc.product.domain.Product; |
| | | |
| | | public interface ProductInventoryService { |
| | | Product getProductById(Long id); |
| | | Product setStockQuantity(Long product, Integer quantity, Long version); |
| | | Product increaseStock(Long product, Integer amount); |
| | | Product decreaseStock(Long product, Integer amount); |
| | | |
| | | /** |
| | | * 获取商品信息 |
| | | * @param productId 商品ID |
| | | * @return Product |
| | | */ |
| | | Product getProductById(Long productId); |
| | | |
| | | /** |
| | | * 设置库存数量 |
| | | * @param productId 商品ID |
| | | * @param quantity 库存数量 |
| | | * @param version 版本号 |
| | | * @return Product |
| | | */ |
| | | Product setStockQuantity(Long productId, Integer quantity, Long version); |
| | | |
| | | /** |
| | | * 增加库存 |
| | | * @param productId 商品ID |
| | | * @param amount 库存数量 |
| | | * @return Product |
| | | */ |
| | | Product increaseStock(Long productId, Integer amount); |
| | | |
| | | /** |
| | | * 减少库存 |
| | | * @param productId 商品ID |
| | | * @param amount 库存数量 |
| | | * @return Product |
| | | */ |
| | | Product decreaseStock(Long productId, Integer amount); |
| | | |
| | | /** |
| | | * 库存是否足够 |
| | | * @param productId 商品ID |
| | | * @param requiredAmount 库存数量 |
| | | * @return true Or false |
| | | */ |
| | | boolean isStockSufficient(Long productId, Integer requiredAmount); |
| | | } |