购物车详情,类初始化

master
DongZeLiang 2024-04-07 15:30:12 +08:00
parent e4eeac9c41
commit 62a35f5f45
7 changed files with 182 additions and 0 deletions

View File

@ -0,0 +1,61 @@
package com.muyu.shop.cart.domain.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.List;
/**
* @author DongZl
* @description:
* @Date 2024/4/7 3:22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CartSkuModel {
/**
* ID
*/
private Long cartInfoId;
/**
*
*/
private String image;
/**
*
*/
private String name;
/**
* SKU
*/
private BigDecimal price;
/**
* Sku
*/
private List<SkuRuleModel> skuRuleList;
/**
*
*/
private Long num;
/**
*
*/
private BigDecimal subtotal;
/**
*
*/
private String isSelected;
}

View File

@ -0,0 +1,28 @@
package com.muyu.shop.cart.domain.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author DongZl
* @description: Sku
* @Date 2024/4/7 3:19
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SkuRuleModel {
/**
*
*/
private String ruleName;
/**
*
*/
private String ruleValue;
}

View File

@ -0,0 +1,37 @@
package com.muyu.shop.cart.domain.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @author DongZl
* @description:
* @Date 2024/4/7 3:25
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class StatisticsCartModel {
/**
*
*/
private Long total;
/**
*
*/
private Long selectTotal;
/**
*
*/
private BigDecimal priceTotal;
/**
*
*/
private BigDecimal actualTotal;
}

View File

@ -0,0 +1,31 @@
package com.muyu.shop.cart.domain.resp;
import com.muyu.shop.cart.domain.model.CartSkuModel;
import com.muyu.shop.cart.domain.model.StatisticsCartModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author DongZl
* @description:
* @Date 2024/4/7 3:27
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CartDetailResp {
/**
*
*/
private List<CartSkuModel> cartSkuList;
/**
*
*/
private StatisticsCartModel statisticsCart;
}

View File

@ -3,6 +3,7 @@ package com.muyu.shop.cart.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.muyu.shop.cart.domain.resp.CartDetailResp;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -75,6 +76,12 @@ public class CartInfoController extends BaseController {
return Result.success(cartInfoService.getById(id)); return Result.success(cartInfoService.getById(id));
} }
@GetMapping("/detail")
public Result<CartDetailResp> detail(){
return Result.success(cartInfoService.detail());
}
/** /**
* *
*/ */

View File

@ -3,6 +3,7 @@ package com.muyu.shop.cart.service;
import java.util.List; import java.util.List;
import com.muyu.shop.cart.domain.CartInfo; import com.muyu.shop.cart.domain.CartInfo;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.shop.cart.domain.resp.CartDetailResp;
/** /**
* Service * Service
@ -25,4 +26,10 @@ public interface CartInfoService extends IService<CartInfo> {
* @return * @return
*/ */
boolean add (CartInfo cartInfo); boolean add (CartInfo cartInfo);
/**
*
* @return
*/
CartDetailResp detail ();
} }

View File

@ -12,6 +12,7 @@ import com.muyu.product.cache.ProjectSkuStockCache;
import com.muyu.product.cache.key.SkuStockKey; import com.muyu.product.cache.key.SkuStockKey;
import com.muyu.shop.cart.cache.CartCache; import com.muyu.shop.cart.cache.CartCache;
import com.muyu.shop.cart.cache.key.CartHashKey; import com.muyu.shop.cart.cache.key.CartHashKey;
import com.muyu.shop.cart.domain.resp.CartDetailResp;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -117,4 +118,14 @@ public class CartInfoServiceImpl extends ServiceImpl<CartInfoMapper, CartInfo>
return true; return true;
} }
/**
*
*
* @return
*/
@Override
public CartDetailResp detail () {
return null;
}
} }