Commit 33a01e78bf99cd11a62236994aa1bb298ab09cea
1 parent
c6124871
mall:优化商品表的设计
Showing
7 changed files
with
177 additions
and
63 deletions
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/comment/ProductCommentEvaluateEnum.java renamed to yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/spu/ProductSpuSpecTypeEnum.java
| 1 | -package cn.iocoder.yudao.module.product.enums.comment; | |
| 1 | +package cn.iocoder.yudao.module.product.enums.spu; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.core.IntArrayValuable; |
| 4 | 4 | import lombok.AllArgsConstructor; |
| ... | ... | @@ -7,26 +7,25 @@ import lombok.Getter; |
| 7 | 7 | import java.util.Arrays; |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | - * 商品评论的评价枚举 | |
| 10 | + * 商品 SPU 规格类型 | |
| 11 | 11 | * |
| 12 | 12 | * @author 芋道源码 |
| 13 | 13 | */ |
| 14 | 14 | @Getter |
| 15 | 15 | @AllArgsConstructor |
| 16 | -public enum ProductCommentEvaluateEnum implements IntArrayValuable { | |
| 16 | +public enum ProductSpuSpecTypeEnum implements IntArrayValuable { | |
| 17 | 17 | |
| 18 | - GOOD(1, "好评"), | |
| 19 | - BAD(2, "差评"), | |
| 20 | - MIDDLE(2, "中评"),; | |
| 18 | + RECYCLE(1, "统一规格"), | |
| 19 | + DISABLE(2, "多规格"); | |
| 21 | 20 | |
| 22 | - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductCommentEvaluateEnum::getEvaluate).toArray(); | |
| 21 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductSpuSpecTypeEnum::getType).toArray(); | |
| 23 | 22 | |
| 24 | 23 | /** |
| 25 | - * 评价 | |
| 24 | + * 规格 | |
| 26 | 25 | */ |
| 27 | - private final Integer evaluate; | |
| 26 | + private final Integer type; | |
| 28 | 27 | /** |
| 29 | - * 评价名 | |
| 28 | + * 规格名 | |
| 30 | 29 | */ |
| 31 | 30 | private final String name; |
| 32 | 31 | ... | ... |
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/spu/ProductSpuStatusEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.product.enums.spu; | |
| 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 | + * 商品 SPU 状态 | |
| 11 | + * | |
| 12 | + * @author 芋道源码 | |
| 13 | + */ | |
| 14 | +@Getter | |
| 15 | +@AllArgsConstructor | |
| 16 | +public enum ProductSpuStatusEnum implements IntArrayValuable { | |
| 17 | + | |
| 18 | + RECYCLE(-1, "回收站"), | |
| 19 | + DISABLE(0, "下架"), | |
| 20 | + ENABLE(1, "上架"),; | |
| 21 | + | |
| 22 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductSpuStatusEnum::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/dal/dataobject/brand/ProductBrandDO.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/ProductCategoryDO.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/comment/ProductCommentDO.java
| ... | ... | @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.product.dal.dataobject.comment; |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | 4 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| 5 | 5 | import cn.iocoder.yudao.module.product.enums.comment.ProductCommentAuditStatusEnum; |
| 6 | -import cn.iocoder.yudao.module.product.enums.comment.ProductCommentEvaluateEnum; | |
| 7 | 6 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 8 | 7 | import com.baomidou.mybatisplus.annotation.TableField; |
| 9 | 8 | import com.baomidou.mybatisplus.annotation.TableId; |
| ... | ... | @@ -41,11 +40,23 @@ public class ProductCommentDO extends BaseDO { |
| 41 | 40 | */ |
| 42 | 41 | private Long spuId; |
| 43 | 42 | /** |
| 43 | + * 交易订单编号 | |
| 44 | + * | |
| 45 | + * 关联 TradeOrderDO 的 id 编号 | |
| 46 | + */ | |
| 47 | + private Long orderId; | |
| 48 | + /** | |
| 44 | 49 | * 交易订单项编号 |
| 45 | 50 | * |
| 46 | - * 关联 OrderItemDO 的 id 编号 | |
| 51 | + * 关联 TradeOrderItemDO 的 id 编号 | |
| 47 | 52 | */ |
| 48 | - private Long tradeOrderItemId; | |
| 53 | + private Long orderItemId; | |
| 54 | + /** | |
| 55 | + * 审核状态 | |
| 56 | + * | |
| 57 | + * 枚举 {@link ProductCommentAuditStatusEnum} | |
| 58 | + */ | |
| 59 | + private Integer auditStatus; | |
| 49 | 60 | |
| 50 | 61 | /** |
| 51 | 62 | * 用户编号 |
| ... | ... | @@ -71,15 +82,29 @@ public class ProductCommentDO extends BaseDO { |
| 71 | 82 | @TableField(typeHandler = JacksonTypeHandler.class) |
| 72 | 83 | private List<String> picUrls; |
| 73 | 84 | /** |
| 74 | - * 得分,0-5 分 | |
| 85 | + * 描述相符星级 | |
| 86 | + * | |
| 87 | + * 1-5 星 | |
| 88 | + */ | |
| 89 | + private Integer descriptionScore; | |
| 90 | + /** | |
| 91 | + * 商品评论星级 | |
| 92 | + * | |
| 93 | + * 1-5 星 | |
| 94 | + */ | |
| 95 | + private Integer productScore; | |
| 96 | + /** | |
| 97 | + * 服务评论星级 | |
| 98 | + * | |
| 99 | + * 1-5 星 | |
| 75 | 100 | */ |
| 76 | - private Integer score; | |
| 101 | + private Integer serviceScore; | |
| 77 | 102 | /** |
| 78 | - * 评价 | |
| 103 | + * 物流评论星级 | |
| 79 | 104 | * |
| 80 | - * 枚举 {@link ProductCommentEvaluateEnum} | |
| 105 | + * 1-5 星 | |
| 81 | 106 | */ |
| 82 | - private Integer evaluate; | |
| 107 | + private Integer expressComment; | |
| 83 | 108 | |
| 84 | 109 | /** |
| 85 | 110 | * 商家是否回复 |
| ... | ... | @@ -93,12 +118,6 @@ public class ProductCommentDO extends BaseDO { |
| 93 | 118 | * 商家回复时间 |
| 94 | 119 | */ |
| 95 | 120 | private Date replyTime; |
| 96 | - /** | |
| 97 | - * 审核状态 | |
| 98 | - * | |
| 99 | - * 枚举 {@link ProductCommentAuditStatusEnum} | |
| 100 | - */ | |
| 101 | - private Integer auditStatus; | |
| 102 | 121 | |
| 103 | 122 | /** |
| 104 | 123 | * 有用的计数 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java
| ... | ... | @@ -54,9 +54,9 @@ public class ProductSkuDO extends BaseDO { |
| 54 | 54 | */ |
| 55 | 55 | private Integer price; |
| 56 | 56 | /** |
| 57 | - * 原价,单位:分 | |
| 57 | + * 市场价,单位:分 | |
| 58 | 58 | */ |
| 59 | - private Integer originalPrice; | |
| 59 | + private Integer marketPrice; | |
| 60 | 60 | /** |
| 61 | 61 | * 成本价,单位:分 |
| 62 | 62 | */ |
| ... | ... | @@ -76,15 +76,9 @@ public class ProductSkuDO extends BaseDO { |
| 76 | 76 | */ |
| 77 | 77 | private Integer status; |
| 78 | 78 | /** |
| 79 | - * 购买中的库存 | |
| 80 | - * | |
| 81 | - * 商品 SKU 被下单时,未付款的商品 SKU 数量 | |
| 82 | - */ | |
| 83 | - private Integer stocks; | |
| 84 | - /** | |
| 85 | - * 实际库存 | |
| 79 | + * 库存 | |
| 86 | 80 | */ |
| 87 | - private Integer actualStocks; | |
| 81 | + private Integer stock; | |
| 88 | 82 | /** |
| 89 | 83 | * 商品重量,单位:kg 千克 |
| 90 | 84 | */ | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java
| 1 | 1 | package cn.iocoder.yudao.module.product.dal.dataobject.spu; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 5 | 4 | import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO; |
| 6 | 5 | import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; |
| 7 | -import cn.iocoder.yudao.module.product.dal.dataobject.delivery.DeliveryTemplateDO; | |
| 8 | 6 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 9 | -import cn.iocoder.yudao.module.product.enums.delivery.DeliveryModeEnum; | |
| 7 | +import cn.iocoder.yudao.module.product.enums.spu.ProductSpuSpecTypeEnum; | |
| 8 | +import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; | |
| 10 | 9 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 11 | 10 | import com.baomidou.mybatisplus.annotation.TableField; |
| 12 | 11 | import com.baomidou.mybatisplus.annotation.TableId; |
| ... | ... | @@ -21,7 +20,7 @@ import java.util.List; |
| 21 | 20 | * |
| 22 | 21 | * @author 芋道源码 |
| 23 | 22 | */ |
| 24 | -@TableName("product_spu") | |
| 23 | +@TableName(value = "product_spu", autoResultMap = true) | |
| 25 | 24 | @KeySequence("product_spu_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 |
| 26 | 25 | @Data |
| 27 | 26 | @EqualsAndHashCode(callSuper = true) |
| ... | ... | @@ -51,6 +50,10 @@ public class ProductSpuDO extends BaseDO { |
| 51 | 50 | */ |
| 52 | 51 | private String name; |
| 53 | 52 | /** |
| 53 | + * 商品编码 | |
| 54 | + */ | |
| 55 | + private String code; | |
| 56 | + /** | |
| 54 | 57 | * 商品卖点 |
| 55 | 58 | */ |
| 56 | 59 | private String sellPoint; |
| ... | ... | @@ -71,64 +74,103 @@ public class ProductSpuDO extends BaseDO { |
| 71 | 74 | */ |
| 72 | 75 | private Long brandId; |
| 73 | 76 | /** |
| 74 | - * 商品图片地址数组 | |
| 77 | + * 商品主图 | |
| 78 | + */ | |
| 79 | + private String bannerUrl; | |
| 80 | + /** | |
| 81 | + * 商品轮播图数组 | |
| 75 | 82 | */ |
| 76 | 83 | @TableField(typeHandler = JacksonTypeHandler.class) |
| 77 | 84 | private List<String> picUrls; |
| 78 | 85 | /** |
| 86 | + * 商品视频 | |
| 87 | + */ | |
| 88 | + private String videoUrl; | |
| 89 | + | |
| 90 | + /** | |
| 79 | 91 | * 排序字段 |
| 80 | 92 | */ |
| 81 | 93 | private Integer sort; |
| 82 | 94 | /** |
| 83 | 95 | * 商品状态 |
| 84 | 96 | * |
| 85 | - * 枚举 {@link CommonStatusEnum} | |
| 97 | + * 枚举 {@link ProductSpuStatusEnum} | |
| 86 | 98 | */ |
| 87 | 99 | private Integer status; |
| 88 | 100 | |
| 89 | 101 | // ========== SKU 相关字段 ========= |
| 90 | 102 | |
| 91 | 103 | /** |
| 92 | - * 价格,单位使用:分 | |
| 104 | + * 规格类型 | |
| 105 | + * | |
| 106 | + * 枚举 {@link ProductSpuSpecTypeEnum} | |
| 107 | + */ | |
| 108 | + private Integer specType; | |
| 109 | + /** | |
| 110 | + * 最小价格,单位使用:分 | |
| 93 | 111 | * |
| 94 | 112 | * 基于其对应的 {@link ProductSkuDO#getPrice()} 最小值 |
| 95 | 113 | */ |
| 96 | - private Integer price; | |
| 114 | + private Integer minPrice; | |
| 115 | + /** | |
| 116 | + * 最大价格,单位使用:分 | |
| 117 | + * | |
| 118 | + * 基于其对应的 {@link ProductSkuDO#getPrice()} 最大值 | |
| 119 | + */ | |
| 120 | + private Integer maxPrice; | |
| 121 | + /** | |
| 122 | + * 市场价,单位使用:分 | |
| 123 | + * | |
| 124 | + * 基于其对应的 {@link ProductSkuDO#getMarketPrice()} 最大值 | |
| 125 | + */ | |
| 126 | + private Integer marketPrice; | |
| 97 | 127 | /** |
| 98 | 128 | * 总库存 |
| 99 | 129 | * |
| 100 | - * 基于其对应的 {@link ProductSkuDO#getActualStocks()} 求和 | |
| 130 | + * 基于其对应的 {@link ProductSkuDO#getStock()} 求和 | |
| 101 | 131 | */ |
| 102 | - private Integer totalStocks; | |
| 103 | - | |
| 104 | - // ========== 统计相关字段 ========= | |
| 105 | - | |
| 132 | + private Integer totalStock; | |
| 106 | 133 | /** |
| 107 | - * 已销售数量(真实) | |
| 134 | + * 预警预存 | |
| 108 | 135 | */ |
| 109 | - private Integer soldCount; | |
| 136 | + private Integer warnStock; | |
| 110 | 137 | /** |
| 111 | - * 浏览量 | |
| 138 | + * 是否展示库存 | |
| 112 | 139 | */ |
| 113 | - private Integer visitCount; | |
| 140 | + private Boolean showStock; | |
| 114 | 141 | |
| 115 | - // ========== 物流相关字段 ========= | |
| 142 | + // ========== 统计相关字段 ========= | |
| 116 | 143 | |
| 117 | 144 | /** |
| 118 | - * 配送方式 | |
| 119 | - * | |
| 120 | - * 枚举 {@link DeliveryModeEnum} | |
| 145 | + * 商品销量 | |
| 121 | 146 | */ |
| 122 | - private Integer deliveryMode; | |
| 147 | + private Integer salesCount; | |
| 123 | 148 | /** |
| 124 | - * 配置模板编号 | |
| 125 | - * | |
| 126 | - * 关联 {@link DeliveryTemplateDO#getId()} | |
| 149 | + * 虚拟销量 | |
| 150 | + */ | |
| 151 | + private Integer virtualSalesCount; | |
| 152 | + /** | |
| 153 | + * 商品点击量 | |
| 127 | 154 | */ |
| 128 | - private Long deliveryTemplateId; | |
| 155 | + private Integer clickCount; | |
| 156 | + | |
| 157 | + // ========== 物流相关字段 ========= | |
| 158 | + | |
| 159 | + // TODO 芋艿:稍后完善物流的字段 | |
| 160 | +// /** | |
| 161 | +// * 配送方式 | |
| 162 | +// * | |
| 163 | +// * 枚举 {@link DeliveryModeEnum} | |
| 164 | +// */ | |
| 165 | +// private Integer deliveryMode; | |
| 166 | +// /** | |
| 167 | +// * 配置模板编号 | |
| 168 | +// * | |
| 169 | +// * 关联 {@link DeliveryTemplateDO#getId()} | |
| 170 | +// */ | |
| 171 | +// private Long deliveryTemplateId; | |
| 129 | 172 | |
| 130 | 173 | // TODO ========== 待定字段:yv ========= |
| 131 | - // TODO bar_code 条形码 | |
| 132 | 174 | // TODO vip_price 会员价格 |
| 133 | 175 | // TODO postage 邮费 |
| 134 | 176 | // TODO is_postage 是否包邮 |
| ... | ... | @@ -139,7 +181,6 @@ public class ProductSpuDO extends BaseDO { |
| 139 | 181 | // TODO integral 所需积分 |
| 140 | 182 | // TODO is_seckill 秒杀状态 |
| 141 | 183 | // TODO is_bargain 砍价状态 |
| 142 | - // TODO ficti 虚拟销量 | |
| 143 | 184 | // TODO code_path 产品二维码地址 |
| 144 | 185 | // TODO is_sub 是否分佣 |
| 145 | 186 | |
| ... | ... | @@ -152,7 +193,26 @@ public class ProductSpuDO extends BaseDO { |
| 152 | 193 | |
| 153 | 194 | // TODO ========== 待定字段:cf ========= |
| 154 | 195 | // TODO source_link 淘宝京东1688类型 |
| 155 | - // TODO video_link 主图视频链接 | |
| 156 | 196 | // TODO activity 活动显示排序 0=默认 1=秒 2=砍价 3=拼团 |
| 157 | 197 | |
| 198 | + // TODO ========== 待定字段:lf ========= | |
| 199 | + | |
| 200 | + // TODO free_shipping_type:运费类型:1-包邮;2-统一运费;3-运费模板 | |
| 201 | + // TODO free_shipping:统一运费金额 | |
| 202 | + // TODO free_shipping_template_id:运费模板 | |
| 203 | + // TODO is_commission:分销佣金:1-开启;0-不开启;first_ratio second_ratio three_ratio | |
| 204 | + // TODO is_share_bouns:区域股东分红:1-开启;0-不开启;region_ratio;shareholder_ratio | |
| 205 | + | |
| 206 | + // TODO is_new:新品推荐:1-是;0-否 | |
| 207 | + // TODO is_best:好物优选:1-是;0-否 | |
| 208 | + // TODO is_like:猜你喜欢:1-是;0-否 | |
| 209 | + | |
| 210 | + // TODO is_team:是否开启拼团[0=否, 1=是] | |
| 211 | + // TODO is_integral:积分抵扣:1-开启;0-不开启 | |
| 212 | + // TODO is_member:会员价:1-开启;0-不开启 | |
| 213 | + // TODO give_integral_type:赠送积分类型:0-不赠送;1-赠送固定积分;2-按比例赠送积分 | |
| 214 | + // TODO give_integral:赠送积分; | |
| 215 | + | |
| 216 | + // TODO poster:商品自定义海报 | |
| 217 | + | |
| 158 | 218 | } | ... | ... |