-
Notifications
You must be signed in to change notification settings - Fork 133
/
wechatorder.sql
99 lines (90 loc) · 4.39 KB
/
wechatorder.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
Navicat MySQL Data Transfer
Source Server : uifuture
Source Server Version : 50714
Source Host : localhost:3306
Source Database : wechatorder
Target Server Type : MYSQL
Target Server Version : 50714
File Encoding : 65001
Date: 2018-01-28 00:29:34
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for order_detail
-- ----------------------------
DROP TABLE IF EXISTS `order_detail`;
CREATE TABLE `order_detail` (
`detail_id` varchar(32) NOT NULL,
`order_id` varchar(32) NOT NULL COMMENT '订单id',
`product_id` varchar(32) NOT NULL COMMENT '商品id',
`product_name` varchar(64) NOT NULL COMMENT '商品名字',
`product_price` decimal(8,2) NOT NULL COMMENT '商品价格',
`product_quantity` int(11) NOT NULL COMMENT '商品数量',
`product_icon` varchar(512) NOT NULL COMMENT '商品小图',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`detail_id`),
KEY `idx_order_id` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单详情表';
-- ----------------------------
-- Table structure for order_master
-- ----------------------------
DROP TABLE IF EXISTS `order_master`;
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 DEFAULT '0' COMMENT '订单状态,默认0,新下单',
`pay_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '支付状态,默认0未支付',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`order_id`),
KEY `idx_buyer_openid` (`buyer_openid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单表';
-- ----------------------------
-- Table structure for product_category
-- ----------------------------
DROP TABLE IF EXISTS `product_category`;
CREATE TABLE `product_category` (
`category_id` int(11) NOT NULL AUTO_INCREMENT,
`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 NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`category_id`),
UNIQUE KEY `upe_category_type` (`category_type`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COMMENT='类目表';
-- ----------------------------
-- Table structure for product_info
-- ----------------------------
DROP TABLE IF EXISTS `product_info`;
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) DEFAULT NULL COMMENT '描述',
`product_icon` varchar(512) DEFAULT NULL COMMENT '小图的url',
`category_type` int(11) NOT NULL COMMENT '类目编号',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`product_status` tinyint(4) NOT NULL,
PRIMARY KEY (`product_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品表';
-- ----------------------------
-- Table structure for seller_info
-- ----------------------------
DROP TABLE IF EXISTS `seller_info`;
CREATE TABLE `seller_info` (
`seller_id` varchar(32) NOT NULL COMMENT '卖家信息表',
`username` varchar(32) NOT NULL,
`password` varchar(32) NOT NULL,
`openid` varchar(64) NOT NULL COMMENT '微信openid',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`seller_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='卖家信息表';