-
Notifications
You must be signed in to change notification settings - Fork 177
/
small.sql
263 lines (218 loc) · 7.27 KB
/
small.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# Host: localhost (Version: 5.5.5-10.1.30-MariaDB)
# Date: 2018-02-25 21:06:11
# Generator: MySQL-Front 5.3 (Build 4.269)
/*!40101 SET NAMES utf8 */;
#
# Structure for table "category"
#
DROP TABLE IF EXISTS `category`;
CREATE TABLE `category` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL DEFAULT '',
`recommend` int(11) NOT NULL DEFAULT '0',
`deleteAt` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#
# Data for table "category"
#
#
# Structure for table "config"
#
DROP TABLE IF EXISTS `config`;
CREATE TABLE `config` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`cname` varchar(255) DEFAULT NULL,
`value` varchar(255) DEFAULT NULL,
`rate` int(11) NOT NULL DEFAULT '0',
`deleteAt` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
#
# Data for table "config"
#
INSERT INTO `config` VALUES (1,'website_name','网站名称','小小商城',100,NULL),(2,'index_description','首页描述','小小商城是我的一个非常小巧轻便的商城系统',50,NULL),(3,'index_keyword','首页关键词','小小商城,商超系统',25,NULL),(4,'index_title','首页标题','小小商城——基于Java的商城项目实践',12,NULL),(5,'path_product_img','产品图片存放目录','pictures/product/',6,NULL),(6,'path_category_img','分类图片存放目录','pictures/category/',5,NULL);
#
# Structure for table "product"
#
DROP TABLE IF EXISTS `product`;
CREATE TABLE `product` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cid` int(11) DEFAULT NULL,
`name` varchar(255) NOT NULL DEFAULT '',
`subTitle` varchar(255) NOT NULL DEFAULT '',
`originalPrice` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
`nowPrice` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
`stock` int(11) unsigned NOT NULL DEFAULT '0',
`imgid` int(11) DEFAULT NULL,
`createDate` datetime DEFAULT NULL,
`commentCount` int(11) unsigned NOT NULL DEFAULT '0',
`saleCount` int(11) unsigned NOT NULL DEFAULT '0',
`deleteAt` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_product_category` (`cid`),
KEY `fk_product_product_image` (`imgid`),
CONSTRAINT `fk_product_category` FOREIGN KEY (`cid`) REFERENCES `category` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#
# Data for table "product"
#
#
# Structure for table "product_image"
#
DROP TABLE IF EXISTS `product_image`;
CREATE TABLE `product_image` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pid` int(11) DEFAULT NULL,
`type` varchar(255) DEFAULT NULL,
`deleteAt` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_product_image` (`pid`),
CONSTRAINT `fk_product_image` FOREIGN KEY (`pid`) REFERENCES `product` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#
# Data for table "product_image"
#
#
# Structure for table "property"
#
DROP TABLE IF EXISTS `property`;
CREATE TABLE `property` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cid` int(11) DEFAULT NULL,
`name` varchar(255) NOT NULL DEFAULT '',
`deleteAt` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_property_category` (`cid`),
CONSTRAINT `fk_property_category` FOREIGN KEY (`cid`) REFERENCES `category` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#
# Data for table "property"
#
#
# Structure for table "property_value"
#
DROP TABLE IF EXISTS `property_value`;
CREATE TABLE `property_value` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pid` int(11) DEFAULT NULL,
`ptid` int(11) DEFAULT NULL,
`value` varchar(255) NOT NULL DEFAULT '',
`deleteAt` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_property_value_property` (`ptid`),
KEY `fk_property_value_product` (`pid`),
CONSTRAINT `fk_property_value_product` FOREIGN KEY (`pid`) REFERENCES `product` (`id`),
CONSTRAINT `fk_property_value_property` FOREIGN KEY (`ptid`) REFERENCES `property` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#
# Data for table "property_value"
#
#
# Structure for table "user"
#
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT '',
`password` varchar(255) DEFAULT '',
`group_` varchar(255) NOT NULL DEFAULT 'user',
`deleteAt` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#
# Data for table "user"
#
INSERT INTO `user` VALUES (1,'admin','3acf16259def65456fc2a68ab5e10d96','superAdmin',NULL);
#
# Structure for table "order_"
#
DROP TABLE IF EXISTS `order_`;
CREATE TABLE `order_` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) DEFAULT NULL,
`orderCode` varchar(255) NOT NULL DEFAULT '',
`sum` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
`totalNumber` int(11) unsigned NOT NULL DEFAULT '0',
`address` varchar(255) DEFAULT '',
`post` varchar(255) DEFAULT '',
`receiver` varchar(255) DEFAULT '',
`mobile` varchar(255) DEFAULT '',
`userMessage` varchar(255) DEFAULT '',
`createDate` datetime DEFAULT NULL,
`payDate` datetime DEFAULT NULL,
`deliverDate` datetime DEFAULT NULL,
`confirmDate` datetime DEFAULT NULL,
`status` varchar(255) DEFAULT NULL,
`deleteAt` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_order_user` (`uid`),
CONSTRAINT `fk_order_user` FOREIGN KEY (`uid`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#
# Data for table "order_"
#
#
# Structure for table "comment"
#
DROP TABLE IF EXISTS `comment`;
CREATE TABLE `comment` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pid` int(11) DEFAULT NULL,
`uid` int(11) DEFAULT NULL,
`content` text,
`createDate` datetime DEFAULT NULL,
`deleteAt` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_comment_product` (`pid`),
KEY `fk_comment_user` (`uid`),
CONSTRAINT `fk_comment_product` FOREIGN KEY (`pid`) REFERENCES `product` (`id`),
CONSTRAINT `fk_comment_user` FOREIGN KEY (`uid`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#
# Data for table "comment"
#
#
# Structure for table "orderitem"
#
DROP TABLE IF EXISTS `orderitem`;
CREATE TABLE `orderitem` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`oid` int(11) DEFAULT NULL,
`pid` int(11) DEFAULT NULL,
`cmid` int(11) DEFAULT NULL,
`number` int(11) unsigned NOT NULL DEFAULT '0',
`sum` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
`deleteAt` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_orderitem_product` (`pid`),
KEY `fk_orderitem_order` (`oid`),
KEY `fk_orderitem_comment` (`cmid`),
CONSTRAINT `fk_orderitem_comment` FOREIGN KEY (`cmid`) REFERENCES `comment` (`id`),
CONSTRAINT `fk_orderitem_order` FOREIGN KEY (`oid`) REFERENCES `order_` (`id`),
CONSTRAINT `fk_orderitem_product` FOREIGN KEY (`pid`) REFERENCES `product` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#
# Data for table "orderitem"
#
#
# Structure for table "cartitem"
#
DROP TABLE IF EXISTS `cartitem`;
CREATE TABLE `cartitem` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) DEFAULT NULL,
`pid` int(11) DEFAULT NULL,
`number` int(11) NOT NULL DEFAULT '0',
`sum` decimal(10,2) NOT NULL DEFAULT '0.00',
`deleteAt` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_cartitem_product` (`pid`),
KEY `fk_cartitem_user` (`uid`),
CONSTRAINT `fk_cartitem_product` FOREIGN KEY (`pid`) REFERENCES `product` (`id`),
CONSTRAINT `fk_cartitem_user` FOREIGN KEY (`uid`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#
# Data for table "cartitem"
#