因为在家闲着无聊,也没有面试邀请,就让大佬给我推荐了个电商项目去做,也是从头锻炼一下自己,不要得过且过,原作者的Github地址我会放到
下面,这个是建库语句,方便大家审阅,也方便自己按照表结构来做需求
商品分类表
create table pms_product_category
(
id bigint not null auto_increment,
parent_id bigint comment '上级分类的编号:0表示一级分类',
name varchar(64) comment '名称',
level int(1) comment '分类级别:0->1级;1->2级',
product_count int comment '商品数量',
product_unit varchar(64) comment '商品单位',
nav_status int(1) comment '是否显示在导航栏:0->不显示;1->显示',
show_status int(1) comment '显示状态:0->不显示;1->显示',
sort int comment '排序',
icon varchar(255) comment '图标',
keywords varchar(255) comment '关键字',
description text comment '描述',
primary key (id)
);
商品品牌表
create table pms_brand
(
id bigint not null auto_increment,
name varchar(64) comment '名称',
first_letter varchar(8) comment '首字母',
sort int comment '排序',
factory_status int(1) comment '是否为品牌制造商:0->不是;1->是',
show_status int(1) comment '是否显示',
product_count int comment '产品数量',
product_comment_count int comment '产品评论数量',
logo varchar(255) comment '品牌logo',
big_pic varchar(255) comment '专区大图',
brand_story text comment '品牌故事',
primary key (id)
);
商品属性分类表
create table pms_product_attribute_category
(
id bigint not null auto_increment,
name varchar(64) comment '名称',
attribute_count int comment '属性数量',
param_count int comment '参数数量',
primary key (id)
);
商品属性表
create table pms_product_attribute
(
id bigint not null auto_increment,
product_attribute_category_id bigint comment '商品属性分类id',
name varchar(64) comment '名称',
select_type int(1) comment '属性选择类型:0->唯一;1->单选;2->多选;对应属性和参数意义不同;',
input_type int(1) comment '属性录入方式:0->手工录入;1->从列表中选取',
input_list varchar(255) comment '可选值列表,以逗号隔开',
sort int comment '排序字段:最高的可以单独上传图片',
filter_type int(1) comment '分类筛选样式:1->普通;1->颜色',
search_type int(1) comment '检索类型;0->不需要进行检索;1->关键字检索;2->范围检索',
related_status int(1) comment '相同属性产品是否关联;0->不关联;1->关联',
hand_add_status int(1) comment '是否支持手动新增;0->不支持;1->支持',
type int(1) comment '属性的类型;0->规格;1->参数',
primary key (id)
);
商品属性值表
create table pms_product_attribute_value
(
id bigint not null auto_increment,
product_id bigint comment '商品id',
product_attribute_id bigint comment '商品属性id',
value varchar(64) comment '手动添加规格或参数的值,参数单值,规格有多个时以逗号隔开',
primary key (id)
);
商品分类和属性的关系表
create table pms_product_category_attribute_relation
(
id bigint not null auto_increment,
product_category_id bigint comment '商品分类id',
product_attribute_id bigint comment '商品属性id',
primary key (id)
);
商品表
create table pms_product
(
id bigint not null auto_increment,
brand_id bigint comment '品牌id',
product_category_id bigint comment '品牌分类id',
feight_template_id bigint comment '运费模版id',
product_attribute_category_id bigint comment '品牌属性分类id',
name varchar(64) not null comment '商品名称',
pic varchar(255) comment '图片',
product_sn varchar(64) not null comment '货号',
delete_status int(1) comment '删除状态:0->未删除;1->已删除',
publish_status int(1) comment '上架状态:0->下架;1->上架',
new_status int(1) comment '新品状态:0->不是新品;1->新品',
recommand_status int(1) comment '推荐状态;0->不推荐;1->推荐',
verify_status int(1) comment '审核状态:0->未审核;1->审核通过',
sort int comment '排序',
sale int comment '销量',
price decimal(10,2) comment '价格',
promotion_price decimal(10,2) comment '促销价格',
gift_growth int default 0 comment '赠送的成长值',
gift_point int default 0 comment '赠送的积分',
use_point_limit int comment '限制使用的积分数',
sub_title varchar(255) comment '副标题',
description text comment '商品描述',
original_price decimal(10,2) comment '市场价',
stock int comment '库存',
low_stock int comment '库存预警值',
unit varchar(16) comment '单位',
weight decimal(10,2) comment '商品重量,默认为克',
preview_status int(1) comment '是否为预告商品:0->不是;1->是',
service_ids varchar(64) comment '以逗号分割的产品服务:1->无忧退货;2->快速退款;3->免费包邮',
keywords varchar(255) comment '关键字',
note varchar(255) comment '备注',
album_pics varchar(255) comment '画册图片,连产品图片限制为5张,以逗号分割',
detail_title varchar(255) comment '详情标题',
detail_desc text comment