Commit 9577f9b17d68bc52a382a53783df5715988db113
1 parent
2340f09c
mall:调整部分 Spu、Sku、Property、Group、Shop 的表设计
Showing
18 changed files
with
350 additions
and
40 deletions
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/delivery/DeliveryModeEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.product.enums.delivery; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | ||
| 4 | +import lombok.AllArgsConstructor; | ||
| 5 | +import lombok.Getter; | ||
| 6 | + | ||
| 7 | +import java.util.Arrays; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 配送方式枚举 | ||
| 11 | + * | ||
| 12 | + * @author 芋道源码 | ||
| 13 | + */ | ||
| 14 | +@Getter | ||
| 15 | +@AllArgsConstructor | ||
| 16 | +public enum DeliveryModeEnum implements IntArrayValuable { | ||
| 17 | + | ||
| 18 | + SHOP_DELIVERY(1, "商家配送"), | ||
| 19 | + USER_PICK_UP(2, "用户自提"); | ||
| 20 | + | ||
| 21 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DeliveryModeEnum::getMode).toArray(); | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 配送方式 | ||
| 25 | + */ | ||
| 26 | + private final Integer mode; | ||
| 27 | + /** | ||
| 28 | + * 状态名 | ||
| 29 | + */ | ||
| 30 | + private final String name; | ||
| 31 | + | ||
| 32 | + @Override | ||
| 33 | + public int[] array() { | ||
| 34 | + return ARRAYS; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | +} |
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/group/ProductGroupStyleEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.product.enums.group; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | ||
| 4 | +import lombok.AllArgsConstructor; | ||
| 5 | +import lombok.Getter; | ||
| 6 | + | ||
| 7 | +import java.util.Arrays; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 商品分组的样式枚举 | ||
| 11 | + * | ||
| 12 | + * @author 芋道源码 | ||
| 13 | + */ | ||
| 14 | +@Getter | ||
| 15 | +@AllArgsConstructor | ||
| 16 | +public enum ProductGroupStyleEnum implements IntArrayValuable { | ||
| 17 | + | ||
| 18 | + ONE(1, "每列一个"), | ||
| 19 | + TWO(2, "每列两个"), | ||
| 20 | + THREE(2, "每列三个"),; | ||
| 21 | + | ||
| 22 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductGroupStyleEnum::getStyle).toArray(); | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 列表样式 | ||
| 26 | + */ | ||
| 27 | + private final Integer style; | ||
| 28 | + /** | ||
| 29 | + * 状态名 | ||
| 30 | + */ | ||
| 31 | + private final String name; | ||
| 32 | + | ||
| 33 | + @Override | ||
| 34 | + public int[] array() { | ||
| 35 | + return ARRAYS; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | +} |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/ProductSkuController.java
| @@ -6,7 +6,7 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | @@ -6,7 +6,7 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 7 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; | 7 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; |
| 8 | import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; | 8 | import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; |
| 9 | -import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSkuDO; | 9 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 10 | import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; | 10 | import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; |
| 11 | import io.swagger.annotations.Api; | 11 | import io.swagger.annotations.Api; |
| 12 | import io.swagger.annotations.ApiImplicitParam; | 12 | import io.swagger.annotations.ApiImplicitParam; |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/ProductSkuConvert.java
| @@ -10,7 +10,7 @@ import org.mapstruct.Mapping; | @@ -10,7 +10,7 @@ import org.mapstruct.Mapping; | ||
| 10 | import org.mapstruct.Named; | 10 | import org.mapstruct.Named; |
| 11 | import org.mapstruct.factory.Mappers; | 11 | import org.mapstruct.factory.Mappers; |
| 12 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; | 12 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; |
| 13 | -import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSkuDO; | 13 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 14 | 14 | ||
| 15 | /** | 15 | /** |
| 16 | * 商品sku Convert | 16 | * 商品sku Convert |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/ProductCategoryDO.java
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.product.dal.dataobject.category; | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.product.dal.dataobject.category; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 5 | +import cn.iocoder.yudao.module.product.dal.dataobject.shop.ShopDO; | ||
| 5 | import com.baomidou.mybatisplus.annotation.TableId; | 6 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | import com.baomidou.mybatisplus.annotation.TableName; | 7 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | import lombok.*; | 8 | import lombok.*; |
| @@ -39,6 +40,12 @@ public class ProductCategoryDO extends BaseDO { | @@ -39,6 +40,12 @@ public class ProductCategoryDO extends BaseDO { | ||
| 39 | */ | 40 | */ |
| 40 | private Long parentId; | 41 | private Long parentId; |
| 41 | /** | 42 | /** |
| 43 | + * 店铺编号 | ||
| 44 | + * | ||
| 45 | + * 关联 {@link ShopDO#getId()} | ||
| 46 | + */ | ||
| 47 | + private Long shopId; | ||
| 48 | + /** | ||
| 42 | * 分类名称 | 49 | * 分类名称 |
| 43 | */ | 50 | */ |
| 44 | private String name; | 51 | private String name; |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/delivery/DeliveryTemplateDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.product.dal.dataobject.delivery; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 7 | +import lombok.*; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 配送模板 SPU DO | ||
| 11 | + * | ||
| 12 | + * @author 芋道源码 | ||
| 13 | + */ | ||
| 14 | +@TableName("delivery_template") | ||
| 15 | +@KeySequence("delivery_template_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 16 | +@Data | ||
| 17 | +@EqualsAndHashCode(callSuper = true) | ||
| 18 | +@ToString(callSuper = true) | ||
| 19 | +@Builder | ||
| 20 | +@NoArgsConstructor | ||
| 21 | +@AllArgsConstructor | ||
| 22 | +public class DeliveryTemplateDO extends BaseDO { | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 编号,自增 | ||
| 26 | + */ | ||
| 27 | + @TableId | ||
| 28 | + private Long id; | ||
| 29 | + | ||
| 30 | +} |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/group/ProductGroupBindDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.product.dal.dataobject.group; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | +import cn.iocoder.yudao.module.product.dal.dataobject.shop.ShopDO; | ||
| 5 | +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 7 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 8 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 9 | +import lombok.*; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 商品分组的绑定 DO | ||
| 13 | + * | ||
| 14 | + * @author 芋道源码 | ||
| 15 | + */ | ||
| 16 | +@TableName("product_group_bind") | ||
| 17 | +@KeySequence("product_group_bind_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 18 | +@Data | ||
| 19 | +@EqualsAndHashCode(callSuper = true) | ||
| 20 | +@ToString(callSuper = true) | ||
| 21 | +@Builder | ||
| 22 | +@NoArgsConstructor | ||
| 23 | +@AllArgsConstructor | ||
| 24 | +public class ProductGroupBindDO extends BaseDO { | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 编号,自增 | ||
| 28 | + */ | ||
| 29 | + @TableId | ||
| 30 | + private Long id; | ||
| 31 | + /** | ||
| 32 | + * 店铺编号 | ||
| 33 | + * | ||
| 34 | + * 关联 {@link ShopDO#getId()} | ||
| 35 | + */ | ||
| 36 | + private Long shopId; | ||
| 37 | + /** | ||
| 38 | + * 商品分组编号 | ||
| 39 | + * | ||
| 40 | + * 关联 {@link ProductGroupDO#getId()} | ||
| 41 | + */ | ||
| 42 | + private Long groupId; | ||
| 43 | + /** | ||
| 44 | + * 商品 SPU 编号 | ||
| 45 | + * | ||
| 46 | + * 关联 {@link ProductSpuDO#getId()} | ||
| 47 | + */ | ||
| 48 | + private Long spuId; | ||
| 49 | + | ||
| 50 | +} |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/group/ProductGroupDO.java
| 1 | package cn.iocoder.yudao.module.product.dal.dataobject.group; | 1 | package cn.iocoder.yudao.module.product.dal.dataobject.group; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 5 | +import cn.iocoder.yudao.module.product.dal.dataobject.shop.ShopDO; | ||
| 6 | +import cn.iocoder.yudao.module.product.enums.group.ProductGroupStyleEnum; | ||
| 4 | import com.baomidou.mybatisplus.annotation.KeySequence; | 7 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 5 | import com.baomidou.mybatisplus.annotation.TableId; | 8 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | import com.baomidou.mybatisplus.annotation.TableName; | 9 | import com.baomidou.mybatisplus.annotation.TableName; |
| @@ -26,7 +29,42 @@ public class ProductGroupDO extends BaseDO { | @@ -26,7 +29,42 @@ public class ProductGroupDO extends BaseDO { | ||
| 26 | */ | 29 | */ |
| 27 | @TableId | 30 | @TableId |
| 28 | private Long id; | 31 | private Long id; |
| 29 | - | ||
| 30 | - // TODO 芋艿:字段补全 | 32 | + /** |
| 33 | + * 店铺编号 | ||
| 34 | + * | ||
| 35 | + * 关联 {@link ShopDO#getId()} | ||
| 36 | + */ | ||
| 37 | + private Long shopId; | ||
| 38 | + /** | ||
| 39 | + * 分组名称 | ||
| 40 | + */ | ||
| 41 | + private String name; | ||
| 42 | + /** | ||
| 43 | + * 状态 | ||
| 44 | + * | ||
| 45 | + * 枚举 {@link CommonStatusEnum} | ||
| 46 | + */ | ||
| 47 | + private Integer status; | ||
| 48 | + /** | ||
| 49 | + * 商品数量 | ||
| 50 | + */ | ||
| 51 | + private Integer count; | ||
| 52 | + /** | ||
| 53 | + * 排序 | ||
| 54 | + */ | ||
| 55 | + private Integer sort; | ||
| 56 | + /** | ||
| 57 | + * 风格,用于 APP 首页展示商品的样式 | ||
| 58 | + * | ||
| 59 | + * 枚举 {@link ProductGroupStyleEnum} | ||
| 60 | + */ | ||
| 61 | + private Integer style; | ||
| 62 | + /** | ||
| 63 | + * 是否默认 | ||
| 64 | + * | ||
| 65 | + * true - 系统默认,不允许删除 | ||
| 66 | + * false - 自定义,允许删除 | ||
| 67 | + */ | ||
| 68 | + private Boolean defaulted; | ||
| 31 | 69 | ||
| 32 | } | 70 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.product.dal.dataobject.property; | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.product.dal.dataobject.property; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 5 | +import cn.iocoder.yudao.module.product.dal.dataobject.shop.ShopDO; | ||
| 5 | import com.baomidou.mybatisplus.annotation.KeySequence; | 6 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 6 | import com.baomidou.mybatisplus.annotation.TableId; | 7 | import com.baomidou.mybatisplus.annotation.TableId; |
| 7 | import com.baomidou.mybatisplus.annotation.TableName; | 8 | import com.baomidou.mybatisplus.annotation.TableName; |
| @@ -28,14 +29,22 @@ public class ProductPropertyDO extends BaseDO { | @@ -28,14 +29,22 @@ public class ProductPropertyDO extends BaseDO { | ||
| 28 | @TableId | 29 | @TableId |
| 29 | private Long id; | 30 | private Long id; |
| 30 | /** | 31 | /** |
| 32 | + * 店铺编号 | ||
| 33 | + * | ||
| 34 | + * 关联 {@link ShopDO#getId()} | ||
| 35 | + */ | ||
| 36 | + private Long shopId; | ||
| 37 | + /** | ||
| 31 | * 规格名称 | 38 | * 规格名称 |
| 32 | */ | 39 | */ |
| 33 | private String name; | 40 | private String name; |
| 34 | /** | 41 | /** |
| 35 | - * 状态: 0 开启 ,1 禁用 | 42 | + * 状态 |
| 36 | * | 43 | * |
| 37 | - * {@link CommonStatusEnum} | 44 | + * 枚举 {@link CommonStatusEnum} |
| 38 | */ | 45 | */ |
| 39 | private Integer status; | 46 | private Integer status; |
| 40 | 47 | ||
| 48 | + // TODO 芋艿:rule;规格属性 (发布商品时,和 SKU 关联);规格参数(搜索商品时,与 Category 关联搜索) | ||
| 49 | + | ||
| 41 | } | 50 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyValueDO.java
| 1 | package cn.iocoder.yudao.module.product.dal.dataobject.property; | 1 | package cn.iocoder.yudao.module.product.dal.dataobject.property; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | import com.baomidou.mybatisplus.annotation.KeySequence; | 5 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 5 | import com.baomidou.mybatisplus.annotation.TableId; | 6 | import com.baomidou.mybatisplus.annotation.TableId; |
| @@ -28,9 +29,9 @@ public class ProductPropertyValueDO extends BaseDO { | @@ -28,9 +29,9 @@ public class ProductPropertyValueDO extends BaseDO { | ||
| 28 | @TableId | 29 | @TableId |
| 29 | private Long id; | 30 | private Long id; |
| 30 | /** | 31 | /** |
| 31 | - * 规格键 id | 32 | + * 规格键编号 |
| 32 | * | 33 | * |
| 33 | - * TODO @franky:加个 关联 {@link ProductPropertyDO#getId()} ,这样就能更好的知道 | 34 | + * 关联 {@link ProductPropertyDO#getId()} |
| 34 | */ | 35 | */ |
| 35 | private Long propertyId; | 36 | private Long propertyId; |
| 36 | /** | 37 | /** |
| @@ -38,7 +39,9 @@ public class ProductPropertyValueDO extends BaseDO { | @@ -38,7 +39,9 @@ public class ProductPropertyValueDO extends BaseDO { | ||
| 38 | */ | 39 | */ |
| 39 | private String name; | 40 | private String name; |
| 40 | /** | 41 | /** |
| 41 | - * 状态: 1 开启 ,2 禁用 | 42 | + * 状态 |
| 43 | + * | ||
| 44 | + * 枚举 {@link CommonStatusEnum} | ||
| 42 | */ | 45 | */ |
| 43 | private Integer status; | 46 | private Integer status; |
| 44 | 47 |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/shop/ShopDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.product.dal.dataobject.shop; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import lombok.*; | ||
| 7 | + | ||
| 8 | +// TODO 芋艿:待设计 | ||
| 9 | +/** | ||
| 10 | + * 店铺 DO | ||
| 11 | + * | ||
| 12 | + * @author 芋道源码 | ||
| 13 | + */ | ||
| 14 | +@TableName("shop") | ||
| 15 | +@KeySequence("shop_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 16 | +@Data | ||
| 17 | +@EqualsAndHashCode(callSuper = true) | ||
| 18 | +@ToString(callSuper = true) | ||
| 19 | +@Builder | ||
| 20 | +@NoArgsConstructor | ||
| 21 | +@AllArgsConstructor | ||
| 22 | +public class ShopDO extends BaseDO { | ||
| 23 | + | ||
| 24 | + private Long id; | ||
| 25 | + | ||
| 26 | +} |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSkuDO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java
| 1 | -package cn.iocoder.yudao.module.product.dal.dataobject.spu; | 1 | +package cn.iocoder.yudao.module.product.dal.dataobject.sku; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 5 | +import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; | ||
| 6 | +import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; | ||
| 7 | +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | ||
| 4 | import com.baomidou.mybatisplus.annotation.KeySequence; | 8 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 9 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | import com.baomidou.mybatisplus.annotation.TableId; | 10 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | import com.baomidou.mybatisplus.annotation.TableName; | 11 | import com.baomidou.mybatisplus.annotation.TableName; |
| 12 | +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | ||
| 7 | import lombok.*; | 13 | import lombok.*; |
| 8 | 14 | ||
| 15 | +import java.util.List; | ||
| 16 | + | ||
| 9 | /** | 17 | /** |
| 10 | - * 商品sku DO | 18 | + * 商品 SKU DO |
| 11 | * | 19 | * |
| 12 | * @author 芋道源码 | 20 | * @author 芋道源码 |
| 13 | */ | 21 | */ |
| @@ -22,19 +30,25 @@ import lombok.*; | @@ -22,19 +30,25 @@ import lombok.*; | ||
| 22 | public class ProductSkuDO extends BaseDO { | 30 | public class ProductSkuDO extends BaseDO { |
| 23 | 31 | ||
| 24 | /** | 32 | /** |
| 25 | - * 主键 | 33 | + * 商品 SKU 编号,自增 |
| 26 | */ | 34 | */ |
| 27 | @TableId | 35 | @TableId |
| 28 | private Long id; | 36 | private Long id; |
| 29 | /** | 37 | /** |
| 30 | - * spu编号 | 38 | + * 商品 SKU 名字 |
| 39 | + */ | ||
| 40 | + private String name; | ||
| 41 | + /** | ||
| 42 | + * SPU 编号 | ||
| 43 | + * | ||
| 44 | + * 关联 {@link ProductSpuDO#getId()} | ||
| 31 | */ | 45 | */ |
| 32 | private Long spuId; | 46 | private Long spuId; |
| 33 | /** | 47 | /** |
| 34 | - * 规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }] | 48 | + * 规格值数组,JSON 格式 |
| 35 | */ | 49 | */ |
| 36 | - // TODO franky:可以定义一个内部的 Property 类,然后 List<Property> | ||
| 37 | - private String properties; | 50 | + @TableField(typeHandler = JacksonTypeHandler.class) |
| 51 | + private List<Property> properties; | ||
| 38 | /** | 52 | /** |
| 39 | * 销售价格,单位:分 | 53 | * 销售价格,单位:分 |
| 40 | */ | 54 | */ |
| @@ -44,11 +58,7 @@ public class ProductSkuDO extends BaseDO { | @@ -44,11 +58,7 @@ public class ProductSkuDO extends BaseDO { | ||
| 44 | */ | 58 | */ |
| 45 | private Integer originalPrice; | 59 | private Integer originalPrice; |
| 46 | /** | 60 | /** |
| 47 | - * 成本价,单位: 分 | ||
| 48 | - */ | ||
| 49 | - private Integer costPrice; | ||
| 50 | - /** | ||
| 51 | - * 条形码 | 61 | + * SKU 的条形码 |
| 52 | */ | 62 | */ |
| 53 | private String barCode; | 63 | private String barCode; |
| 54 | /** | 64 | /** |
| @@ -56,9 +66,47 @@ public class ProductSkuDO extends BaseDO { | @@ -56,9 +66,47 @@ public class ProductSkuDO extends BaseDO { | ||
| 56 | */ | 66 | */ |
| 57 | private String picUrl; | 67 | private String picUrl; |
| 58 | /** | 68 | /** |
| 59 | - * 状态: 0-正常 1-禁用 | 69 | + * SKU 状态 |
| 70 | + * | ||
| 71 | + * 枚举 {@link CommonStatusEnum} | ||
| 60 | */ | 72 | */ |
| 61 | private Integer status; | 73 | private Integer status; |
| 74 | + /** | ||
| 75 | + * 购买中的库存 | ||
| 76 | + * | ||
| 77 | + * 商品 SKU 被下单时,未付款的商品 SKU 数量 | ||
| 78 | + */ | ||
| 79 | + private Integer stocks; | ||
| 80 | + /** | ||
| 81 | + * 实际库存 | ||
| 82 | + */ | ||
| 83 | + private Integer actualStocks; | ||
| 84 | + /** | ||
| 85 | + * 商品重量,单位:kg 千克 | ||
| 86 | + */ | ||
| 87 | + private Double weight; | ||
| 88 | + /** | ||
| 89 | + * 商品体积,单位:m^3 平米 | ||
| 90 | + */ | ||
| 91 | + private Double volume; | ||
| 92 | + | ||
| 93 | + @Data | ||
| 94 | + public static class Property { | ||
| 95 | + | ||
| 96 | + /** | ||
| 97 | + * 属性编号 | ||
| 98 | + * | ||
| 99 | + * 关联 {@link ProductPropertyDO#getId()} | ||
| 100 | + */ | ||
| 101 | + private Long propertyId; | ||
| 102 | + /** | ||
| 103 | + * 属性值编号 | ||
| 104 | + * | ||
| 105 | + * 关联 {@link ProductPropertyValueDO#getId()} | ||
| 106 | + */ | ||
| 107 | + private Long valueId; | ||
| 108 | + | ||
| 109 | + } | ||
| 62 | 110 | ||
| 63 | } | 111 | } |
| 64 | 112 |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java
| @@ -4,7 +4,10 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | @@ -4,7 +4,10 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 5 | import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO; | 5 | import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO; |
| 6 | import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; | 6 | import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; |
| 7 | -import cn.iocoder.yudao.module.product.dal.dataobject.group.ProductGroupDO; | 7 | +import cn.iocoder.yudao.module.product.dal.dataobject.delivery.DeliveryTemplateDO; |
| 8 | +import cn.iocoder.yudao.module.product.dal.dataobject.shop.ShopDO; | ||
| 9 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | ||
| 10 | +import cn.iocoder.yudao.module.product.enums.delivery.DeliveryModeEnum; | ||
| 8 | import com.baomidou.mybatisplus.annotation.KeySequence; | 11 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 9 | import com.baomidou.mybatisplus.annotation.TableField; | 12 | import com.baomidou.mybatisplus.annotation.TableField; |
| 10 | import com.baomidou.mybatisplus.annotation.TableId; | 13 | import com.baomidou.mybatisplus.annotation.TableId; |
| @@ -34,6 +37,16 @@ public class ProductSpuDO extends BaseDO { | @@ -34,6 +37,16 @@ public class ProductSpuDO extends BaseDO { | ||
| 34 | */ | 37 | */ |
| 35 | @TableId | 38 | @TableId |
| 36 | private Long id; | 39 | private Long id; |
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 店铺编号 | ||
| 43 | + * | ||
| 44 | + * 关联 {@link ShopDO#getId()} | ||
| 45 | + */ | ||
| 46 | + private Long shopId; | ||
| 47 | + | ||
| 48 | + // ========== 基本信息 ========= | ||
| 49 | + | ||
| 37 | /** | 50 | /** |
| 38 | * 商品名称 | 51 | * 商品名称 |
| 39 | */ | 52 | */ |
| @@ -59,13 +72,6 @@ public class ProductSpuDO extends BaseDO { | @@ -59,13 +72,6 @@ public class ProductSpuDO extends BaseDO { | ||
| 59 | */ | 72 | */ |
| 60 | private Long brandId; | 73 | private Long brandId; |
| 61 | /** | 74 | /** |
| 62 | - * 商品分组编号数组 | ||
| 63 | - * | ||
| 64 | - * 关联 {@link ProductGroupDO#getId()} | ||
| 65 | - */ | ||
| 66 | - @TableField(typeHandler = JacksonTypeHandler.class) | ||
| 67 | - private List<Long> groupIds; | ||
| 68 | - /** | ||
| 69 | * 商品图片地址数组 | 75 | * 商品图片地址数组 |
| 70 | */ | 76 | */ |
| 71 | @TableField(typeHandler = JacksonTypeHandler.class) | 77 | @TableField(typeHandler = JacksonTypeHandler.class) |
| @@ -80,6 +86,9 @@ public class ProductSpuDO extends BaseDO { | @@ -80,6 +86,9 @@ public class ProductSpuDO extends BaseDO { | ||
| 80 | * 枚举 {@link CommonStatusEnum} | 86 | * 枚举 {@link CommonStatusEnum} |
| 81 | */ | 87 | */ |
| 82 | private Integer status; | 88 | private Integer status; |
| 89 | + | ||
| 90 | + // ========== SKU 相关字段 ========= | ||
| 91 | + | ||
| 83 | /** | 92 | /** |
| 84 | * 价格,单位使用:分 | 93 | * 价格,单位使用:分 |
| 85 | * | 94 | * |
| @@ -87,14 +96,29 @@ public class ProductSpuDO extends BaseDO { | @@ -87,14 +96,29 @@ public class ProductSpuDO extends BaseDO { | ||
| 87 | */ | 96 | */ |
| 88 | private Integer price; | 97 | private Integer price; |
| 89 | /** | 98 | /** |
| 90 | - * 库存数量 | 99 | + * 总库存 |
| 91 | * | 100 | * |
| 92 | - * 基于其对应的 {@link ProductSkuDO#getPrice()} 求和 | 101 | + * 基于其对应的 {@link ProductSkuDO#getActualStocks()} 求和 |
| 93 | */ | 102 | */ |
| 94 | - private Integer quantity; | 103 | + private Integer totalStocks; |
| 104 | + /** | ||
| 105 | + * 已销售数量 | ||
| 106 | + */ | ||
| 107 | + private Integer soldNum; | ||
| 95 | 108 | ||
| 109 | + // ========== 物流相关字段 ========= | ||
| 96 | 110 | ||
| 97 | - // TODO 芋艿:配送方式:商家配送、商家自提 | ||
| 98 | - // TODO 芋艿:运费设置;如果选择了 “商家配送” 配送方式,则选择「运费设置」编号 | 111 | + /** |
| 112 | + * 配送方式 | ||
| 113 | + * | ||
| 114 | + * 枚举 {@link DeliveryModeEnum} | ||
| 115 | + */ | ||
| 116 | + private Integer deliveryMode; | ||
| 117 | + /** | ||
| 118 | + * 配置模板编号 | ||
| 119 | + * | ||
| 120 | + * 关联 {@link DeliveryTemplateDO#getId()} | ||
| 121 | + */ | ||
| 122 | + private Long deliveryTemplateId; | ||
| 99 | 123 | ||
| 100 | } | 124 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java
| @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuExportReqVO; | 6 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuExportReqVO; |
| 7 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuPageReqVO; | 7 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuPageReqVO; |
| 8 | -import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSkuDO; | 8 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 9 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | ||
| 11 | import java.util.List; | 11 | import java.util.List; |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuService.java
| @@ -5,7 +5,7 @@ import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateR | @@ -5,7 +5,7 @@ import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateR | ||
| 5 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuExportReqVO; | 5 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuExportReqVO; |
| 6 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuPageReqVO; | 6 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuPageReqVO; |
| 7 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuUpdateReqVO; | 7 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuUpdateReqVO; |
| 8 | -import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSkuDO; | 8 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 9 | 9 | ||
| 10 | import javax.validation.Valid; | 10 | import javax.validation.Valid; |
| 11 | import java.util.Collection; | 11 | import java.util.Collection; |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java
| @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.product.controller.admin.property.vo.ProductPrope | @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.product.controller.admin.property.vo.ProductPrope | ||
| 6 | import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.ProductPropertyValueRespVO; | 6 | import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.ProductPropertyValueRespVO; |
| 7 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; | 7 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; |
| 8 | import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; | 8 | import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; |
| 9 | -import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSkuDO; | 9 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 10 | import cn.iocoder.yudao.module.product.dal.mysql.sku.ProductSkuMapper; | 10 | import cn.iocoder.yudao.module.product.dal.mysql.sku.ProductSkuMapper; |
| 11 | import cn.iocoder.yudao.module.product.enums.ErrorCodeConstants; | 11 | import cn.iocoder.yudao.module.product.enums.ErrorCodeConstants; |
| 12 | import cn.iocoder.yudao.module.product.service.property.ProductPropertyService; | 12 | import cn.iocoder.yudao.module.product.service.property.ProductPropertyService; |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java
| @@ -12,7 +12,7 @@ import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppSpuPageReqVO; | @@ -12,7 +12,7 @@ import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppSpuPageReqVO; | ||
| 12 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppSpuPageRespVO; | 12 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppSpuPageRespVO; |
| 13 | import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; | 13 | import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; |
| 14 | import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; | 14 | import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; |
| 15 | -import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSkuDO; | 15 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 16 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | 16 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| 17 | import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper; | 17 | import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper; |
| 18 | import cn.iocoder.yudao.module.product.service.category.ProductCategoryService; | 18 | import cn.iocoder.yudao.module.product.service.category.ProductCategoryService; |
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImplTest.java
| @@ -8,7 +8,7 @@ import javax.annotation.Resource; | @@ -8,7 +8,7 @@ import javax.annotation.Resource; | ||
| 8 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 8 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 9 | 9 | ||
| 10 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; | 10 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; |
| 11 | -import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSkuDO; | 11 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 12 | import cn.iocoder.yudao.module.product.dal.mysql.sku.ProductSkuMapper; | 12 | import cn.iocoder.yudao.module.product.dal.mysql.sku.ProductSkuMapper; |
| 13 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 13 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 14 | 14 |