商城sql
CREATE TABLE `product_info` (
`product_id` VARCHAR(32) NOT NULL,
`product_name` VARCHAR(64) NOT NULL COMMENT '商品名称',
`product_price` DECIMAL(8,2) NOT NULL COMMENT '单价',
`product_stock` INT(11) NOT NULL COMMENT '库存',
`product_description` VARCHAR(64) NOT NULL COMMENT '描述',
`product_icon` VARCHAR(512) NOT NULL COMMENT '小图',
`category_type` VARCHAR(512) NOT NULL COMMENT '类目编号',
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` TIMESTAMP NULL DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`product_id`)
)
COMMENT='商品表'
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB;
CREATE TABLE `procuct_category` (
`category_id` VARCHAR(32) NOT NULL,
`category_name` VARCHAR(64) NOT NULL COMMENT '类目名字',
`category_type` INT(11) NOT NULL COMMENT '类目编号',
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` TIMESTAMP NULL DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`category_id`),
UNIQUE INDEX `category_type` (`category_type`)
)
COMMENT='类目表'
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB;
CREATE TABLE `order_master` (
`order_id` VARCHAR(32) NOT NULL,
`buyer_name` VARCHAR(32) NOT NULL COMMENT '买家名字',
`buyer_phone` VARCHAR(32) NOT NULL COMMENT '买家电话',
`buyer_address` VARCHAR(128) NOT NULL COMMENT '买家地址',
`buyer_openid` VARCHAR(64) NOT NULL COMMENT '买家微信openid',
`order_amount` DECIMAL(8,2) NOT NULL COMMENT '订单总金额',
`order_status` TINYINT(3) NOT NULL COMMENT '订单状态,默认0新下单',
`pay_status` TINYINT(3) NOT NULL COMMENT '支付状态,默认0未支付',
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` TIMESTAMP NULL DEFAULT NULL,
PRIMARY KEY (`order_id`)
)
COMMENT='订单表'
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB;
CREATE TABLE `order_detail` (
`detail_id` VARCHAR(32) NOT NULL,
`order_id` VARCHAR(32) NOT NULL,
`product_id` VARCHAR(32) NOT NULL,
`product_name` VARCHAR(64) NOT NULL COMMENT '商品名称',
`product_price` DECIMAL(8,2) NOT NULL COMMENT '商品价格',
`product_quantity` INT(11) NOT NULL COMMENT '商品数量',
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` TIMESTAMP NULL DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`detail_id`),
INDEX `order_id` (`order_id`)
)
COMMENT='订单详情表'
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB;