Procházet zdrojové kódy

feat(backend): 组合SKU实体/DTO与Mapper

Xiaogang Liao před 1 týdnem
rodič
revize
6cc4251a23

+ 12 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/ProductSkuDTO.java

@@ -17,6 +17,12 @@ public class ProductSkuDTO {
     private Integer stock;
     private Integer stock;
     private String image;
     private String image;
     private Boolean enabled;
     private Boolean enabled;
+    private Long linkedProductId;
+    private String linkedProductName;
+    private Integer linkedProductPrice;
+    private String linkedProductImage;
+    private Integer linkedProductStock;
+    private java.util.List<com.etotem.cfc.entity.ProductSkuComboItem> comboItems;
 
 
     public static ProductSkuDTO from(ProductSku sku) {
     public static ProductSkuDTO from(ProductSku sku) {
         if (sku == null) return null;
         if (sku == null) return null;
@@ -65,6 +71,12 @@ public class ProductSkuDTO {
                 dto.setSpecs(null);
                 dto.setSpecs(null);
             }
             }
         }
         }
+        dto.setLinkedProductId(sku.getLinkedProductId());
+        dto.setLinkedProductName(sku.getLinkedProductName());
+        dto.setLinkedProductPrice(sku.getLinkedProductPrice());
+        dto.setLinkedProductImage(sku.getLinkedProductImage());
+        dto.setLinkedProductStock(sku.getLinkedProductStock());
+        dto.setComboItems(sku.getComboItems());
         return dto;
         return dto;
     }
     }
 }
 }

+ 1 - 0
cfc-backend/src/main/java/com/etotem/cfc/entity/ProductOrder.java

@@ -19,6 +19,7 @@ public class ProductOrder implements Serializable {
     private Long productId;
     private Long productId;
     private String productName;
     private String productName;
     private String productType;
     private String productType;
+    private Long skuId;
     private Long buyerId;
     private Long buyerId;
     private Long familyId;
     private Long familyId;
     private Integer quantity;
     private Integer quantity;

+ 12 - 0
cfc-backend/src/main/java/com/etotem/cfc/entity/ProductSku.java

@@ -30,4 +30,16 @@ public class ProductSku implements Serializable {
     private String label;
     private String label;
     private Date createTime;
     private Date createTime;
     private Date updateTime;
     private Date updateTime;
+
+    @com.baomidou.mybatisplus.annotation.TableField(exist = false)
+    private java.util.List<ProductSkuComboItem> comboItems;
+
+    @com.baomidou.mybatisplus.annotation.TableField(exist = false)
+    private String linkedProductName;
+    @com.baomidou.mybatisplus.annotation.TableField(exist = false)
+    private Integer linkedProductPrice;
+    @com.baomidou.mybatisplus.annotation.TableField(exist = false)
+    private String linkedProductImage;
+    @com.baomidou.mybatisplus.annotation.TableField(exist = false)
+    private Integer linkedProductStock;
 }
 }

+ 33 - 0
cfc-backend/src/main/java/com/etotem/cfc/entity/ProductSkuComboItem.java

@@ -0,0 +1,33 @@
+package com.etotem.cfc.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@TableName("product_sku_combo_items")
+public class ProductSkuComboItem implements Serializable {
+
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    private Long skuId;
+    private Long childProductId;
+    private Long childSkuId;
+    private Integer quantity;
+    private Date createdAt;
+
+    @TableField(exist = false)
+    private String childProductName;
+    @TableField(exist = false)
+    private String childProductImage;
+    @TableField(exist = false)
+    private Integer childProductPrice;
+    @TableField(exist = false)
+    private String childSkuSpecs;
+}

+ 7 - 0
cfc-backend/src/main/java/com/etotem/cfc/mapper/ProductSkuComboItemMapper.java

@@ -0,0 +1,7 @@
+package com.etotem.cfc.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.etotem.cfc.entity.ProductSkuComboItem;
+
+public interface ProductSkuComboItemMapper extends BaseMapper<ProductSkuComboItem> {
+}