模块:
用户:注册、登陆
商品:浏览、管理
订单:生成、管理
仓配:库存、管理
用户登录表(customer_login)
CREATE TABLE customer_login(
customer_id INT UNSIGNED AUTO_INCREMENT NOT NULL COMMENT '用户ID',
login_name VARCHAR(20) NOT NULL COMMENT '用户登录名',
password CHAR(32) NOT NULL COMMENT 'md5加密的密码',
user_stats TINYINT NOT NULL DEFAULT 1 COMMENT '用户状态',
modified_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY pk_customerid(customer_id)
) ENGINE = innodb COMMENT '用户登录表'
用户信息表(customer_inf)
CREATE TABLE customer_inf(
customer_inf_id INT UNSIGNED AUTO_INCREMENT NOT NULL COMMENT '自增主键ID',
customer_id INT UNSIGNED NOT NULL COMMENT 'customer_login表的自增ID',
customer_name VARCHAR(20) NOT NULL COMMENT '用户真实姓名',
identity_card_type TINYINT NOT NULL DEFAULT 1 COMMENT '证件类型:1 身份证,2 军官证,3 护照',
identity_card_no VARCHAR(20) COMMENT '证件号码',
mobile_phone INT UNSIGNED COMMENT '手机号',
customer_email VARCHAR(50) COMMENT '邮箱',
gender CHAR(1) COMMENT '性别',
user_point INT NOT NULL DEFAULT 0 COMMENT '用户积分',
register_time TIMESTAMP NOT NULL COMMENT '注册时间',
birthday DATETIME COMMENT '会员生日',
customer_level TINYINT NOT NULL DEFAULT 1 COMMENT '会员级别:1 普通会员,2 青铜,3白银,4黄金,5钻石',
user_money DECIMAL(8,2) NOT NULL DEFAULT 0.00 COMMENT '用户余额',
modified_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY pk_customerinfid(customer_inf_id)
) ENGINE = innodb COMMENT '用户信息表';
CREATE TABLE brand_info(
brand_id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL COMMENT '品牌ID',
brand_name VARCHAR(50) NOT NULL COMMENT '品牌名称',
brand_logo VARCHAR(100) COMMENT '品牌logo URL',
brand_desc VARCHAR(150) COMMENT '品牌描述',
brand_status TINYINT NOT NULL DEFAULT 0 COMMENT '品牌状态,0禁用,1启用',
PRIMARY KEY pk_brandid (brand_id)
)ENGINE=innodb COMMENT '品牌信息表';
分类信息表(product_category)
CREATE TABLE product_category(
category_id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL COMMENT '分类ID',
category_name VARCHAR(10) NOT NULL COMMENT '分类名称',
img VARCHAR(100) NOT NULL COMMENT '分类图片logo',
parent_id SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '父分类ID--若为0则该层为父类',
category_level TINYINT NOT NULL DEFAULT 1 COMMENT '分类层级--该层为该分类第几层',
category_status TINYINT NOT NULL DEFAULT 1 COMMENT '分类状态--是否还可继续往下分,是1否0',
PRIMARY KEY pk_categoryid(category_id)
)ENGINE=innodb COMMENT '商品分类表'
商品信息表(product_info)
CREATE TABLE product_info(
sku_id INT UNSIGNED AUTO_INCREMENT NOT NULL COMMENT '商品ID',
product_name VARCHAR(20) NOT NULL COMMENT '商品名称',
category_id1 SMALLINT UNSIGNED NOT NULL COMMENT '一级分类ID',
category_id2 SMALLINT UNSIGNED NOT NULL COMMENT '二级分类ID',
category_id3 SMALLINT UNSIGNED NOT NULL COMMENT '三级分类ID',
price FLOAT NOT NULL COMMENT '商品销售价格',
publish_status TINYINT NOT NULL DEFAULT 0 COMMENT '上下架状态:0下架1上架',
descript VARCHAR(100) NOT NULL COMMENT '商品描述',
spec_param VARCHAR(10000) NOT NULL COMMENT '商品规格参数',
title VARCHAR(100) NOT NULL COMMENT '商品标题',
PRIMARY KEY pk_productid(product_id)
) ENGINE = innodb COMMENT '商品信息表';
商品图片表(productpicinfo)
CREATE TABLE product_pic_info(
product_pic_id INT UNSIGNED AUTO_INCREMENT NOT NULL COMMENT '商品图片ID',
product_id INT UNSIGNED NOT NULL COMMENT '商品ID',
pic_desc VARCHAR(50) COMMENT '图片描述',
pic_url VARCHAR(200) NOT NULL COMMENT '图片URL',
is_master TINYINT NOT NULL DEFAULT 0 COMMENT '是否主图:0.非主图1.主图',
pic_status TINYINT NOT NULL DEFAULT 1 COMMENT '图片是否有效:0无效 1有效',
PRIMARY KEY pk_picid(product_pic_id)
)ENGINE=innodb COMMENT '商品图片信息表';
商品评论表(product_comment)
CREATE TABLE product_comment(
comment_id INT UNSIGNED AUTO_INCREMENT NOT NULL COMMENT '评论ID',
product_id INT UNSIGNED NOT NULL COMMENT '商品ID',
order_id BIGINT UNSIGNED NOT NULL COMMENT '订单ID',
customer_id INT UNSIGNED NOT NULL COMMENT '用户ID',
title VARCHAR(50) NOT NULL COMMENT '评论标题',
content VARCHAR(300) NOT NULL COMMENT '评论内容',
audit_status TINYINT NOT NULL COMMENT '审核状态:0未审核,1已审核',
audit_time TIMESTAMP NOT NULL COMMENT '评论时间',
modified_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY pk_commentid(comment_id)
) ENGINE = innodb COMMENT '商品评论表';