mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-10-31 02:28:03 +08:00 
			
		
		
		
	mall:优化商品表的设计
This commit is contained in:
		| @ -1,4 +1,4 @@ | |||||||
| package cn.iocoder.yudao.module.product.enums.comment; | package cn.iocoder.yudao.module.product.enums.spu; | ||||||
| 
 | 
 | ||||||
| import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | ||||||
| import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||||
| @ -7,26 +7,25 @@ import lombok.Getter; | |||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * 商品评论的评价枚举 |  * 商品 SPU 规格类型 | ||||||
|  * |  * | ||||||
|  * @author 芋道源码 |  * @author 芋道源码 | ||||||
|  */ |  */ | ||||||
| @Getter | @Getter | ||||||
| @AllArgsConstructor | @AllArgsConstructor | ||||||
| public enum ProductCommentEvaluateEnum implements IntArrayValuable { | public enum ProductSpuSpecTypeEnum implements IntArrayValuable { | ||||||
| 
 | 
 | ||||||
|     GOOD(1, "好评"), |     RECYCLE(1, "统一规格"), | ||||||
|     BAD(2, "差评"), |     DISABLE(2, "多规格"); | ||||||
|     MIDDLE(2, "中评"),; |  | ||||||
| 
 | 
 | ||||||
|     public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductCommentEvaluateEnum::getEvaluate).toArray(); |     public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductSpuSpecTypeEnum::getType).toArray(); | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 评价 |      * 规格 | ||||||
|      */ |      */ | ||||||
|     private final Integer evaluate; |     private final Integer type; | ||||||
|     /** |     /** | ||||||
|      * 评价名 |      * 规格名 | ||||||
|      */ |      */ | ||||||
|     private final String name; |     private final String name; | ||||||
| 
 | 
 | ||||||
| @ -0,0 +1,38 @@ | |||||||
|  | package cn.iocoder.yudao.module.product.enums.spu; | ||||||
|  |  | ||||||
|  | import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | ||||||
|  | import lombok.AllArgsConstructor; | ||||||
|  | import lombok.Getter; | ||||||
|  |  | ||||||
|  | import java.util.Arrays; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 商品 SPU 状态 | ||||||
|  |  * | ||||||
|  |  * @author 芋道源码 | ||||||
|  |  */ | ||||||
|  | @Getter | ||||||
|  | @AllArgsConstructor | ||||||
|  | public enum ProductSpuStatusEnum implements IntArrayValuable { | ||||||
|  |  | ||||||
|  |     RECYCLE(-1, "回收站"), | ||||||
|  |     DISABLE(0, "下架"), | ||||||
|  |     ENABLE(1, "上架"),; | ||||||
|  |  | ||||||
|  |     public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductSpuStatusEnum::getStyle).toArray(); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 状态 | ||||||
|  |      */ | ||||||
|  |     private final Integer style; | ||||||
|  |     /** | ||||||
|  |      * 状态名 | ||||||
|  |      */ | ||||||
|  |     private final String name; | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public int[] array() { | ||||||
|  |         return ARRAYS; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -48,4 +48,6 @@ public class ProductBrandDO extends BaseDO { | |||||||
|      */ |      */ | ||||||
|     private Integer status; |     private Integer status; | ||||||
|  |  | ||||||
|  |     // TODO 芋艿:firstLetter 首字母 | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -70,4 +70,6 @@ public class ProductCategoryDO extends BaseDO { | |||||||
|      */ |      */ | ||||||
|     private Integer status; |     private Integer status; | ||||||
|  |  | ||||||
|  |     // TODO 芋艿:is_recommend 是否首页推荐:1-是;0-否 | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -3,7 +3,6 @@ package cn.iocoder.yudao.module.product.dal.dataobject.comment; | |||||||
| import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||||||
| import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | ||||||
| import cn.iocoder.yudao.module.product.enums.comment.ProductCommentAuditStatusEnum; | import cn.iocoder.yudao.module.product.enums.comment.ProductCommentAuditStatusEnum; | ||||||
| import cn.iocoder.yudao.module.product.enums.comment.ProductCommentEvaluateEnum; |  | ||||||
| import com.baomidou.mybatisplus.annotation.KeySequence; | import com.baomidou.mybatisplus.annotation.KeySequence; | ||||||
| import com.baomidou.mybatisplus.annotation.TableField; | import com.baomidou.mybatisplus.annotation.TableField; | ||||||
| import com.baomidou.mybatisplus.annotation.TableId; | import com.baomidou.mybatisplus.annotation.TableId; | ||||||
| @ -40,12 +39,24 @@ public class ProductCommentDO extends BaseDO { | |||||||
|      * 关联 {@link ProductSpuDO#getId()} |      * 关联 {@link ProductSpuDO#getId()} | ||||||
|      */ |      */ | ||||||
|     private Long spuId; |     private Long spuId; | ||||||
|  |     /** | ||||||
|  |      * 交易订单编号 | ||||||
|  |      * | ||||||
|  |      * 关联 TradeOrderDO 的 id 编号 | ||||||
|  |      */ | ||||||
|  |     private Long orderId; | ||||||
|     /** |     /** | ||||||
|      * 交易订单项编号 |      * 交易订单项编号 | ||||||
|      * |      * | ||||||
|      * 关联 OrderItemDO 的 id 编号 |      * 关联 TradeOrderItemDO 的 id 编号 | ||||||
|      */ |      */ | ||||||
|     private Long tradeOrderItemId; |     private Long orderItemId; | ||||||
|  |     /** | ||||||
|  |      * 审核状态 | ||||||
|  |      * | ||||||
|  |      * 枚举 {@link ProductCommentAuditStatusEnum} | ||||||
|  |      */ | ||||||
|  |     private Integer auditStatus; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 用户编号 |      * 用户编号 | ||||||
| @ -71,15 +82,29 @@ public class ProductCommentDO extends BaseDO { | |||||||
|     @TableField(typeHandler = JacksonTypeHandler.class) |     @TableField(typeHandler = JacksonTypeHandler.class) | ||||||
|     private List<String> picUrls; |     private List<String> picUrls; | ||||||
|     /** |     /** | ||||||
|      * 得分,0-5 分 |      * 描述相符星级 | ||||||
|      */ |  | ||||||
|     private Integer score; |  | ||||||
|     /** |  | ||||||
|      * 评价 |  | ||||||
|      * |      * | ||||||
|      * 枚举 {@link ProductCommentEvaluateEnum} |      * 1-5 星 | ||||||
|      */ |      */ | ||||||
|     private Integer evaluate; |     private Integer descriptionScore; | ||||||
|  |     /** | ||||||
|  |      * 商品评论星级 | ||||||
|  |      * | ||||||
|  |      * 1-5 星 | ||||||
|  |      */ | ||||||
|  |     private Integer productScore; | ||||||
|  |     /** | ||||||
|  |      * 服务评论星级 | ||||||
|  |      * | ||||||
|  |      * 1-5 星 | ||||||
|  |      */ | ||||||
|  |     private Integer serviceScore; | ||||||
|  |     /** | ||||||
|  |      * 物流评论星级 | ||||||
|  |      * | ||||||
|  |      * 1-5 星 | ||||||
|  |      */ | ||||||
|  |     private Integer expressComment; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 商家是否回复 |      * 商家是否回复 | ||||||
| @ -93,12 +118,6 @@ public class ProductCommentDO extends BaseDO { | |||||||
|      * 商家回复时间 |      * 商家回复时间 | ||||||
|      */ |      */ | ||||||
|     private Date replyTime; |     private Date replyTime; | ||||||
|     /** |  | ||||||
|      * 审核状态 |  | ||||||
|      * |  | ||||||
|      * 枚举 {@link ProductCommentAuditStatusEnum} |  | ||||||
|      */ |  | ||||||
|     private Integer auditStatus; |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 有用的计数 |      * 有用的计数 | ||||||
|  | |||||||
| @ -54,9 +54,9 @@ public class ProductSkuDO extends BaseDO { | |||||||
|      */ |      */ | ||||||
|     private Integer price; |     private Integer price; | ||||||
|     /** |     /** | ||||||
|      * 原价,单位:分 |      * 市场价,单位:分 | ||||||
|      */ |      */ | ||||||
|     private Integer originalPrice; |     private Integer marketPrice; | ||||||
|     /** |     /** | ||||||
|      * 成本价,单位:分 |      * 成本价,单位:分 | ||||||
|      */ |      */ | ||||||
| @ -76,15 +76,9 @@ public class ProductSkuDO extends BaseDO { | |||||||
|      */ |      */ | ||||||
|     private Integer status; |     private Integer status; | ||||||
|     /** |     /** | ||||||
|      * 购买中的库存 |      * 库存 | ||||||
|      * |  | ||||||
|      * 商品 SKU 被下单时,未付款的商品 SKU 数量 |  | ||||||
|      */ |      */ | ||||||
|     private Integer stocks; |     private Integer stock; | ||||||
|     /** |  | ||||||
|      * 实际库存 |  | ||||||
|      */ |  | ||||||
|     private Integer actualStocks; |  | ||||||
|     /** |     /** | ||||||
|      * 商品重量,单位:kg 千克 |      * 商品重量,单位:kg 千克 | ||||||
|      */ |      */ | ||||||
|  | |||||||
| @ -1,12 +1,11 @@ | |||||||
| package cn.iocoder.yudao.module.product.dal.dataobject.spu; | package cn.iocoder.yudao.module.product.dal.dataobject.spu; | ||||||
|  |  | ||||||
| import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |  | ||||||
| import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||||||
| import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO; | import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO; | ||||||
| import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; | import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; | ||||||
| import cn.iocoder.yudao.module.product.dal.dataobject.delivery.DeliveryTemplateDO; |  | ||||||
| import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | ||||||
| import cn.iocoder.yudao.module.product.enums.delivery.DeliveryModeEnum; | import cn.iocoder.yudao.module.product.enums.spu.ProductSpuSpecTypeEnum; | ||||||
|  | import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; | ||||||
| import com.baomidou.mybatisplus.annotation.KeySequence; | import com.baomidou.mybatisplus.annotation.KeySequence; | ||||||
| import com.baomidou.mybatisplus.annotation.TableField; | import com.baomidou.mybatisplus.annotation.TableField; | ||||||
| import com.baomidou.mybatisplus.annotation.TableId; | import com.baomidou.mybatisplus.annotation.TableId; | ||||||
| @ -21,7 +20,7 @@ import java.util.List; | |||||||
|  * |  * | ||||||
|  * @author 芋道源码 |  * @author 芋道源码 | ||||||
|  */ |  */ | ||||||
| @TableName("product_spu") | @TableName(value = "product_spu", autoResultMap = true) | ||||||
| @KeySequence("product_spu_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | @KeySequence("product_spu_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||||||
| @Data | @Data | ||||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||||
| @ -50,6 +49,10 @@ public class ProductSpuDO extends BaseDO { | |||||||
|      * 商品名称 |      * 商品名称 | ||||||
|      */ |      */ | ||||||
|     private String name; |     private String name; | ||||||
|  |     /** | ||||||
|  |      * 商品编码 | ||||||
|  |      */ | ||||||
|  |     private String code; | ||||||
|     /** |     /** | ||||||
|      * 商品卖点 |      * 商品卖点 | ||||||
|      */ |      */ | ||||||
| @ -71,10 +74,19 @@ public class ProductSpuDO extends BaseDO { | |||||||
|      */ |      */ | ||||||
|     private Long brandId; |     private Long brandId; | ||||||
|     /** |     /** | ||||||
|      * 商品图片地址数组 |      * 商品主图 | ||||||
|  |      */ | ||||||
|  |     private String bannerUrl; | ||||||
|  |     /** | ||||||
|  |      * 商品轮播图数组 | ||||||
|      */ |      */ | ||||||
|     @TableField(typeHandler = JacksonTypeHandler.class) |     @TableField(typeHandler = JacksonTypeHandler.class) | ||||||
|     private List<String> picUrls; |     private List<String> picUrls; | ||||||
|  |     /** | ||||||
|  |      * 商品视频 | ||||||
|  |      */ | ||||||
|  |     private String videoUrl; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 排序字段 |      * 排序字段 | ||||||
|      */ |      */ | ||||||
| @ -82,53 +94,83 @@ public class ProductSpuDO extends BaseDO { | |||||||
|     /** |     /** | ||||||
|      * 商品状态 |      * 商品状态 | ||||||
|      * |      * | ||||||
|      * 枚举 {@link CommonStatusEnum} |      * 枚举 {@link ProductSpuStatusEnum} | ||||||
|      */ |      */ | ||||||
|     private Integer status; |     private Integer status; | ||||||
|  |  | ||||||
|     // ========== SKU 相关字段 ========= |     // ========== SKU 相关字段 ========= | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 价格,单位使用:分 |      * 规格类型 | ||||||
|  |      * | ||||||
|  |      * 枚举 {@link ProductSpuSpecTypeEnum} | ||||||
|  |      */ | ||||||
|  |     private Integer specType; | ||||||
|  |     /** | ||||||
|  |      * 最小价格,单位使用:分 | ||||||
|      * |      * | ||||||
|      * 基于其对应的 {@link ProductSkuDO#getPrice()} 最小值 |      * 基于其对应的 {@link ProductSkuDO#getPrice()} 最小值 | ||||||
|      */ |      */ | ||||||
|     private Integer price; |     private Integer minPrice; | ||||||
|  |     /** | ||||||
|  |      * 最大价格,单位使用:分 | ||||||
|  |      * | ||||||
|  |      * 基于其对应的 {@link ProductSkuDO#getPrice()} 最大值 | ||||||
|  |      */ | ||||||
|  |     private Integer maxPrice; | ||||||
|  |     /** | ||||||
|  |      * 市场价,单位使用:分 | ||||||
|  |      * | ||||||
|  |      * 基于其对应的 {@link ProductSkuDO#getMarketPrice()} 最大值 | ||||||
|  |      */ | ||||||
|  |     private Integer marketPrice; | ||||||
|     /** |     /** | ||||||
|      * 总库存 |      * 总库存 | ||||||
|      * |      * | ||||||
|      * 基于其对应的 {@link ProductSkuDO#getActualStocks()} 求和 |      * 基于其对应的 {@link ProductSkuDO#getStock()} 求和 | ||||||
|      */ |      */ | ||||||
|     private Integer totalStocks; |     private Integer totalStock; | ||||||
|  |     /** | ||||||
|  |      * 预警预存 | ||||||
|  |      */ | ||||||
|  |     private Integer warnStock; | ||||||
|  |     /** | ||||||
|  |      * 是否展示库存 | ||||||
|  |      */ | ||||||
|  |     private Boolean showStock; | ||||||
|  |  | ||||||
|     // ========== 统计相关字段 ========= |     // ========== 统计相关字段 ========= | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 已销售数量(真实) |      * 商品销量 | ||||||
|      */ |      */ | ||||||
|     private Integer soldCount; |     private Integer salesCount; | ||||||
|     /** |     /** | ||||||
|      * 浏览量 |      * 虚拟销量 | ||||||
|      */ |      */ | ||||||
|     private Integer visitCount; |     private Integer virtualSalesCount; | ||||||
|  |     /** | ||||||
|  |      * 商品点击量 | ||||||
|  |      */ | ||||||
|  |     private Integer clickCount; | ||||||
|  |  | ||||||
|     // ========== 物流相关字段 ========= |     // ========== 物流相关字段 ========= | ||||||
|  |  | ||||||
|     /** |     // TODO 芋艿:稍后完善物流的字段 | ||||||
|      * 配送方式 | //    /** | ||||||
|      * | //     * 配送方式 | ||||||
|      * 枚举 {@link DeliveryModeEnum} | //     * | ||||||
|      */ | //     * 枚举 {@link DeliveryModeEnum} | ||||||
|     private Integer deliveryMode; | //     */ | ||||||
|     /** | //    private Integer deliveryMode; | ||||||
|      * 配置模板编号 | //    /** | ||||||
|      * | //     * 配置模板编号 | ||||||
|      * 关联 {@link DeliveryTemplateDO#getId()} | //     * | ||||||
|      */ | //     * 关联 {@link DeliveryTemplateDO#getId()} | ||||||
|     private Long deliveryTemplateId; | //     */ | ||||||
|  | //    private Long deliveryTemplateId; | ||||||
|  |  | ||||||
|     // TODO ========== 待定字段:yv ========= |     // TODO ========== 待定字段:yv ========= | ||||||
|     // TODO bar_code 条形码 |  | ||||||
|     // TODO vip_price 会员价格 |     // TODO vip_price 会员价格 | ||||||
|     // TODO postage 邮费 |     // TODO postage 邮费 | ||||||
|     // TODO is_postage 是否包邮 |     // TODO is_postage 是否包邮 | ||||||
| @ -139,7 +181,6 @@ public class ProductSpuDO extends BaseDO { | |||||||
|     // TODO integral 所需积分 |     // TODO integral 所需积分 | ||||||
|     // TODO is_seckill 秒杀状态 |     // TODO is_seckill 秒杀状态 | ||||||
|     // TODO is_bargain 砍价状态 |     // TODO is_bargain 砍价状态 | ||||||
|     // TODO ficti 虚拟销量 |  | ||||||
|     // TODO code_path 产品二维码地址 |     // TODO code_path 产品二维码地址 | ||||||
|     // TODO is_sub 是否分佣 |     // TODO is_sub 是否分佣 | ||||||
|  |  | ||||||
| @ -152,7 +193,26 @@ public class ProductSpuDO extends BaseDO { | |||||||
|  |  | ||||||
|     // TODO ========== 待定字段:cf ========= |     // TODO ========== 待定字段:cf ========= | ||||||
|     // TODO source_link 淘宝京东1688类型 |     // TODO source_link 淘宝京东1688类型 | ||||||
|     // TODO video_link 主图视频链接 |  | ||||||
|     // TODO activity 活动显示排序 0=默认 1=秒 2=砍价 3=拼团 |     // TODO activity 活动显示排序 0=默认 1=秒 2=砍价 3=拼团 | ||||||
|  |  | ||||||
|  |     // TODO ========== 待定字段:lf ========= | ||||||
|  |  | ||||||
|  |     // TODO free_shipping_type:运费类型:1-包邮;2-统一运费;3-运费模板 | ||||||
|  |     // TODO free_shipping:统一运费金额 | ||||||
|  |     // TODO free_shipping_template_id:运费模板 | ||||||
|  |     // TODO is_commission:分销佣金:1-开启;0-不开启;first_ratio second_ratio three_ratio | ||||||
|  |     // TODO is_share_bouns:区域股东分红:1-开启;0-不开启;region_ratio;shareholder_ratio | ||||||
|  |  | ||||||
|  |     // TODO is_new:新品推荐:1-是;0-否 | ||||||
|  |     // TODO is_best:好物优选:1-是;0-否 | ||||||
|  |     // TODO is_like:猜你喜欢:1-是;0-否 | ||||||
|  |  | ||||||
|  |     // TODO is_team:是否开启拼团[0=否, 1=是] | ||||||
|  |     // TODO is_integral:积分抵扣:1-开启;0-不开启 | ||||||
|  |     // TODO is_member:会员价:1-开启;0-不开启 | ||||||
|  |     // TODO give_integral_type:赠送积分类型:0-不赠送;1-赠送固定积分;2-按比例赠送积分 | ||||||
|  |     // TODO give_integral:赠送积分; | ||||||
|  |  | ||||||
|  |     // TODO poster:商品自定义海报 | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV