| | |
| | | /** |
| | | * 添加商品到购物车(Redis + 数据库) |
| | | */ |
| | | boolean addToCart(Long userId, Long unitId, CartItemDTO cartItemDTO); |
| | | boolean addToCart(String userId, String unitId, CartItemDTO cartItemDTO); |
| | | |
| | | /** |
| | | * 从购物车移除商品(Redis + 数据库) |
| | | */ |
| | | boolean removeFromCart(Long userId, Long unitId, Long pricingId); |
| | | boolean removeFromCart(String userId, String unitId, Long pricingId); |
| | | |
| | | /** |
| | | * 更新购物车商品数量(Redis + 数据库) |
| | | */ |
| | | boolean updateCartItemQuantity(Long userId, Long unitId, Long pricingId, Integer quantity); |
| | | boolean updateCartItemQuantity(String userId, String unitId, Long pricingId, Integer quantity); |
| | | |
| | | /** |
| | | * 清空购物车(Redis + 数据库) |
| | | */ |
| | | boolean clearCart(Long userId, Long unitId); |
| | | boolean clearCart(String userId, String unitId); |
| | | |
| | | /** |
| | | * 获取购物车信息(优先Redis,失败则从数据库加载) |
| | | */ |
| | | CartVO getCart(Long userId, Long unitId); |
| | | CartVO getCart(String userId, String unitId); |
| | | |
| | | /** |
| | | * 获取购物车商品列表(优先Redis,失败则从数据库加载) |
| | | */ |
| | | List<CartItemVO> getCartItems(Long userId, Long unitId); |
| | | List<CartItemVO> getCartItems(String userId, String unitId); |
| | | |
| | | /** |
| | | * 检查购物车商品库存 |
| | | */ |
| | | boolean checkCartItemStock(Long userId, Long unitId, Long pricingId); |
| | | boolean checkCartItemStock(String userId, String unitId, Long pricingId); |
| | | |
| | | /** |
| | | * 批量删除购物车商品(Redis + 数据库) |
| | | */ |
| | | boolean batchRemoveFromCart(Long userId, Long unitId, List<Long> pricingIds); |
| | | boolean batchRemoveFromCart(String userId, String unitId, List<Long> pricingIds); |
| | | |
| | | /** |
| | | * 获取购物车商品数量(优先Redis,失败则从数据库加载) |
| | | */ |
| | | Integer getCartItemCount(Long userId, Long unitId); |
| | | Integer getCartItemCount(String userId, String unitId); |
| | | |
| | | /** |
| | | * 从数据库加载购物车数据到Redis |
| | | */ |
| | | boolean loadCartFromDatabase(Long userId, Long unitId); |
| | | boolean loadCartFromDatabase(String userId, String unitId); |
| | | |
| | | /** |
| | | * 同步Redis数据到数据库 |
| | | */ |
| | | boolean syncCartToDatabase(Long userId, Long unitId); |
| | | boolean syncCartToDatabase(String userId, String unitId); |
| | | |
| | | /** |
| | | * 检查购物车数据一致性 |
| | | */ |
| | | boolean checkCartConsistency(Long userId, Long unitId); |
| | | boolean checkCartConsistency(String userId, String unitId); |
| | | } |