后端 + 前端:添加到购物车
This commit is contained in:
@@ -39,9 +39,10 @@ public interface CartService {
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param skuId 商品 SKU 编号
|
||||
* @param selected 是否选中
|
||||
* @return 是否成功
|
||||
*/
|
||||
CommonResult<Boolean> updateSelected(Integer userId, Integer skuId);
|
||||
CommonResult<Boolean> updateSelected(Integer userId, Integer skuId, Boolean selected);
|
||||
|
||||
/**
|
||||
* 购物车删除商品
|
||||
@@ -67,7 +68,7 @@ public interface CartService {
|
||||
* @param userId 用户编号
|
||||
* @return 商品数量
|
||||
*/
|
||||
CommonResult<Integer> count(Integer userId, String nobody, Integer shopId);
|
||||
CommonResult<Integer> count(Integer userId);
|
||||
|
||||
/**
|
||||
* 显示买家购物车中的商品列表,并根据 selected 进行过滤。
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package cn.iocoder.mall.order.api.constant;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public enum CartItemStatusEnum {
|
||||
|
||||
ENABLE(1, "正常"),
|
||||
DELETE_BY_MANUAL(2, "主动删除"),
|
||||
DELETE_BY_(3, "下单删除"),
|
||||
;
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CartItemStatusEnum::getValue).toArray();
|
||||
|
||||
/**
|
||||
* 状态值
|
||||
*/
|
||||
private Integer value;
|
||||
/**
|
||||
* 状态名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
CartItemStatusEnum(Integer value, String name) {
|
||||
this.value = value;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public CartItemStatusEnum setValue(Integer value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public CartItemStatusEnum setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,6 +27,12 @@ public enum OrderErrorCodeEnum {
|
||||
ORDER_ITEM_ONLY_ONE(1008000004, "订单Item只有一个!"),
|
||||
ORDER_ITEM_SOME_NOT_EXISTS(-1, "有不存在的商品"), // TODO 芋艿 后面改下错误码
|
||||
|
||||
|
||||
// ========== 购物车 ==========
|
||||
CARD_ITEM_NOT_FOUND(1008003000, "购物车项不存在"),
|
||||
CARD_ITEM_SKU_NOT_FOUND(1008003001, "商品不存在"),
|
||||
CARD_ITEM_SKU_QUANTITY_NOT_ENOUGH(1008003002, "商品库存不足"),
|
||||
|
||||
;
|
||||
|
||||
private final int code;
|
||||
|
||||
Reference in New Issue
Block a user