-
Notifications
You must be signed in to change notification settings - Fork 98
/
db_springbootshopmaster.sql
332 lines (302 loc) · 14.4 KB
/
db_springbootshopmaster.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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
/*
Navicat MySQL Data Transfer
Source Server : 127.0.0.1
Source Server Version : 80019
Source Host : localhost:3306
Source Database : db_shopmaster
Target Server Type : MYSQL
Target Server Version : 80019
File Encoding : 65001
Date: 2021-07-24 17:18:18
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for activity
-- ----------------------------
DROP TABLE IF EXISTS `activity`;
CREATE TABLE `activity` (
`activityId` int NOT NULL AUTO_INCREMENT,
`activityName` varchar(50) NOT NULL,
`activityDes` varchar(500) NOT NULL,
`discount` float DEFAULT '1',
`fullPrice` int DEFAULT NULL,
`reducePrice` int DEFAULT NULL,
`fullNum` int DEFAULT NULL,
`reduceNum` int DEFAULT NULL,
PRIMARY KEY (`activityId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of activity
-- ----------------------------
INSERT INTO `activity` VALUES ('1', '测试活动', '1231', '1', '123', '123', '1231', '12');
INSERT INTO `activity` VALUES ('2', '开业大酬宾', '开业大酬宾,全场9折。', '9.2', '100', '8', '200', '20');
-- ----------------------------
-- Table structure for address
-- ----------------------------
DROP TABLE IF EXISTS `address`;
CREATE TABLE `address` (
`addressID` int NOT NULL AUTO_INCREMENT,
`userId` int NOT NULL,
`province` varchar(50) NOT NULL,
`city` varchar(50) NOT NULL,
`county` varchar(50) NOT NULL,
`detailAddr` varchar(50) NOT NULL,
`conName` varchar(50) NOT NULL,
`conTel` varchar(50) NOT NULL,
PRIMARY KEY (`addressID`),
KEY `addressID` (`addressID`),
KEY `userId` (`userId`),
CONSTRAINT `address_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `user` (`userId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of address
-- ----------------------------
INSERT INTO `address` VALUES ('7', '1', '北京市', '北京市市辖区', '东城区', '12312', '123123', '2131231321');
INSERT INTO `address` VALUES ('8', '3', '湖南省', '长沙市', '雨花区', '长沙理工大学', '张鑫', '18229189406');
-- ----------------------------
-- Table structure for admin
-- ----------------------------
DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin` (
`adminId` int NOT NULL AUTO_INCREMENT,
`adminName` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
PRIMARY KEY (`adminId`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of admin
-- ----------------------------
INSERT INTO `admin` VALUES ('1', 'admin', '25d55ad283aa400af464c76d713c07ad');
-- ----------------------------
-- Table structure for category
-- ----------------------------
DROP TABLE IF EXISTS `category`;
CREATE TABLE `category` (
`cateId` int NOT NULL AUTO_INCREMENT,
`cateName` varchar(50) NOT NULL,
PRIMARY KEY (`cateId`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of category
-- ----------------------------
INSERT INTO `category` VALUES ('1', '数码');
INSERT INTO `category` VALUES ('2', '服饰');
INSERT INTO `category` VALUES ('3', '家电');
INSERT INTO `category` VALUES ('4', '书籍');
INSERT INTO `category` VALUES ('5', '其他');
-- ----------------------------
-- Table structure for collection
-- ----------------------------
DROP TABLE IF EXISTS `collection`;
CREATE TABLE `collection` (
`userId` int NOT NULL,
`goodsId` int NOT NULL,
`collectTime` datetime NOT NULL,
PRIMARY KEY (`userId`,`goodsId`),
KEY `collection_ibfk_2` (`goodsId`),
CONSTRAINT `collection_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `user` (`userId`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `collection_ibfk_2` FOREIGN KEY (`goodsId`) REFERENCES `goods` (`goodsId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of collection
-- ----------------------------
INSERT INTO `collection` VALUES ('3', '93', '2019-05-13 10:47:26');
INSERT INTO `collection` VALUES ('3', '94', '2019-05-13 10:16:11');
INSERT INTO `collection` VALUES ('3', '95', '2019-05-13 10:37:35');
INSERT INTO `collection` VALUES ('3', '97', '2019-05-13 10:23:11');
-- ----------------------------
-- Table structure for comment
-- ----------------------------
DROP TABLE IF EXISTS `comment`;
CREATE TABLE `comment` (
`commentId` int NOT NULL AUTO_INCREMENT,
`userId` int NOT NULL,
`goodsId` int NOT NULL,
`point` int NOT NULL,
`content` varchar(255) NOT NULL,
`commentTime` datetime NOT NULL,
PRIMARY KEY (`commentId`),
KEY `userId` (`userId`),
KEY `goodsId` (`goodsId`),
CONSTRAINT `comment_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `user` (`userId`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `comment_ibfk_2` FOREIGN KEY (`goodsId`) REFERENCES `goods` (`goodsId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of comment
-- ----------------------------
INSERT INTO `comment` VALUES ('2', '3', '93', '4', '商品特别好,我非常喜欢', '2019-05-13 10:48:51');
-- ----------------------------
-- Table structure for deliver
-- ----------------------------
DROP TABLE IF EXISTS `deliver`;
CREATE TABLE `deliver` (
`deliverId` int NOT NULL AUTO_INCREMENT,
`orderId` int NOT NULL,
`sendId` int NOT NULL,
PRIMARY KEY (`deliverId`),
KEY `orderId` (`orderId`),
CONSTRAINT `deliver_ibfk_1` FOREIGN KEY (`orderId`) REFERENCES `indent` (`orderId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of deliver
-- ----------------------------
-- ----------------------------
-- Table structure for goods
-- ----------------------------
DROP TABLE IF EXISTS `goods`;
CREATE TABLE `goods` (
`goodsId` int NOT NULL AUTO_INCREMENT,
`goodsName` varchar(50) NOT NULL,
`price` int NOT NULL,
`num` int NOT NULL,
`upTime` datetime NOT NULL,
`category` int NOT NULL,
`detailCate` varchar(50) NOT NULL,
`description` text NOT NULL,
`activityId` int NOT NULL DEFAULT '1',
PRIMARY KEY (`goodsId`),
KEY `activityId` (`activityId`),
KEY `category` (`category`),
CONSTRAINT `goods_ibfk_1` FOREIGN KEY (`activityId`) REFERENCES `activity` (`activityId`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `goods_ibfk_2` FOREIGN KEY (`category`) REFERENCES `category` (`cateId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of goods
-- ----------------------------
INSERT INTO `goods` VALUES ('93', '测试商品1', '10', '29', '2019-05-10 19:43:04', '1', '测试', '这是测试商品1', '1');
INSERT INTO `goods` VALUES ('94', '测试商品2', '23', '34', '2019-05-10 19:44:28', '2', '测试', '这是测试商品2', '1');
INSERT INTO `goods` VALUES ('95', '这是测试商品', '123', '1231', '2019-05-11 11:41:24', '1', '测试', '测试商品', '1');
INSERT INTO `goods` VALUES ('96', '测试商品4', '213', '222', '2019-05-11 11:42:00', '1', '12321', '这是一个测试商品4', '1');
INSERT INTO `goods` VALUES ('97', '测试商品5', '213', '212', '2019-05-13 10:22:58', '1', '测试', '这是测试商品', '1');
INSERT INTO `goods` VALUES ('98', 'test商品1', '10', '100', '2021-07-24 11:50:07', '1', '测试', '测试商品', '1');
INSERT INTO `goods` VALUES ('99', '1231', '1231', '1231', '2021-07-24 11:51:20', '1', '1231231', '1231', '1');
-- ----------------------------
-- Table structure for imagepath
-- ----------------------------
DROP TABLE IF EXISTS `imagepath`;
CREATE TABLE `imagepath` (
`pathId` int NOT NULL AUTO_INCREMENT,
`goodId` int NOT NULL,
`path` varchar(255) NOT NULL,
PRIMARY KEY (`pathId`),
KEY `goodid` (`goodId`),
CONSTRAINT `imagepath_ibfk_1` FOREIGN KEY (`goodId`) REFERENCES `goods` (`goodsId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=131 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of imagepath
-- ----------------------------
INSERT INTO `imagepath` VALUES ('114', '93', '3a25测试商品1新公司录用offer.png');
INSERT INTO `imagepath` VALUES ('115', '93', '6a7b测试商品1原公司解约通知.png');
INSERT INTO `imagepath` VALUES ('116', '94', 'c1a9测试商品2user3.png');
INSERT INTO `imagepath` VALUES ('117', '95', 'bd30这是测试商品QQ浏览器截图20181120200039.png');
INSERT INTO `imagepath` VALUES ('118', '96', '94e9123QQ浏览器截图20180925163930.png');
INSERT INTO `imagepath` VALUES ('119', '96', '7c68123QQ浏览器截图20181120200033.png');
INSERT INTO `imagepath` VALUES ('120', '96', '669e123QQ浏览器截图20181120200038.png');
INSERT INTO `imagepath` VALUES ('121', '97', 'c2e5测试商品5QQ浏览器截图20180628082816.png');
INSERT INTO `imagepath` VALUES ('122', '97', '61dd测试商品5QQ浏览器截图20180910091336.png');
INSERT INTO `imagepath` VALUES ('123', '97', '0f0b测试商品5QQ浏览器截图20180917082049.png');
INSERT INTO `imagepath` VALUES ('124', '97', '8020测试商品5QQ浏览器截图20180925163930.png');
INSERT INTO `imagepath` VALUES ('125', '97', 'd8f2测试商品5QQ浏览器截图20181120200033.png');
INSERT INTO `imagepath` VALUES ('126', '97', '776b测试商品5QQ浏览器截图20181120200038.png');
INSERT INTO `imagepath` VALUES ('127', '97', '65be测试商品5QQ浏览器截图20181120200039.png');
INSERT INTO `imagepath` VALUES ('128', '97', 'c2a3测试商品5QQ浏览器截图20190307101645.png');
INSERT INTO `imagepath` VALUES ('129', '98', 'a0a9test商品1复制算法.png');
INSERT INTO `imagepath` VALUES ('130', '99', 'false');
-- ----------------------------
-- Table structure for indent
-- ----------------------------
DROP TABLE IF EXISTS `indent`;
CREATE TABLE `indent` (
`orderId` int NOT NULL AUTO_INCREMENT,
`userId` int NOT NULL,
`orderTime` datetime NOT NULL,
`oldPrice` float NOT NULL,
`newPrice` float NOT NULL,
`isPay` tinyint(1) NOT NULL,
`isSend` tinyint(1) NOT NULL,
`isReceive` tinyint(1) NOT NULL,
`isComplete` tinyint(1) NOT NULL,
`addressId` int NOT NULL,
PRIMARY KEY (`orderId`),
KEY `userId` (`userId`),
KEY `orderGoods` (`orderTime`),
KEY `addressId` (`addressId`),
CONSTRAINT `indent_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `user` (`userId`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `indent_ibfk_2` FOREIGN KEY (`addressId`) REFERENCES `address` (`addressID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of indent
-- ----------------------------
INSERT INTO `indent` VALUES ('28', '3', '2019-05-11 11:33:10', '10', '10', '1', '1', '1', '1', '8');
INSERT INTO `indent` VALUES ('29', '3', '2019-05-11 11:39:39', '125', '125', '1', '1', '1', '1', '8');
INSERT INTO `indent` VALUES ('30', '3', '2019-05-13 10:16:19', '109', '109', '1', '1', '1', '1', '8');
INSERT INTO `indent` VALUES ('31', '3', '2019-05-13 10:37:59', '10', '10', '0', '1', '1', '1', '8');
INSERT INTO `indent` VALUES ('32', '3', '2019-05-13 10:43:05', '10', '10', '1', '1', '0', '0', '8');
INSERT INTO `indent` VALUES ('33', '3', '2019-05-13 10:47:42', '40', '40', '1', '1', '1', '1', '8');
INSERT INTO `indent` VALUES ('34', '3', '2021-07-24 12:02:01', '40', '40', '1', '1', '0', '0', '8');
-- ----------------------------
-- Table structure for orderitem
-- ----------------------------
DROP TABLE IF EXISTS `orderitem`;
CREATE TABLE `orderitem` (
`itemId` int NOT NULL AUTO_INCREMENT,
`orderId` int NOT NULL,
`goodsId` int NOT NULL,
`num` int NOT NULL,
PRIMARY KEY (`itemId`),
KEY `orderId` (`orderId`),
KEY `goodsId` (`goodsId`),
CONSTRAINT `orderitem_ibfk_1` FOREIGN KEY (`orderId`) REFERENCES `indent` (`orderId`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `orderitem_ibfk_2` FOREIGN KEY (`goodsId`) REFERENCES `goods` (`goodsId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of orderitem
-- ----------------------------
INSERT INTO `orderitem` VALUES ('14', '28', '93', '1');
INSERT INTO `orderitem` VALUES ('15', '29', '93', '1');
INSERT INTO `orderitem` VALUES ('16', '29', '94', '5');
INSERT INTO `orderitem` VALUES ('17', '30', '93', '4');
INSERT INTO `orderitem` VALUES ('18', '30', '94', '3');
INSERT INTO `orderitem` VALUES ('19', '31', '93', '1');
INSERT INTO `orderitem` VALUES ('20', '32', '93', '1');
INSERT INTO `orderitem` VALUES ('21', '33', '93', '4');
INSERT INTO `orderitem` VALUES ('22', '34', '98', '4');
-- ----------------------------
-- Table structure for shopcart
-- ----------------------------
DROP TABLE IF EXISTS `shopcart`;
CREATE TABLE `shopcart` (
`userId` int NOT NULL,
`goodsid` int NOT NULL,
`cateDate` datetime NOT NULL,
`goodsNum` int NOT NULL,
PRIMARY KEY (`userId`,`goodsid`),
KEY `userId` (`userId`),
KEY `goodsid` (`goodsid`),
CONSTRAINT `shopcart_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `user` (`userId`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `shopcart_ibfk_2` FOREIGN KEY (`goodsid`) REFERENCES `goods` (`goodsId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of shopcart
-- ----------------------------
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`userId` int NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`regTime` datetime NOT NULL,
`email` varchar(50) NOT NULL,
`telephone` varchar(50) NOT NULL,
PRIMARY KEY (`userId`),
KEY `userId` (`userId`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('1', 'root', '25d55ad283aa400af464c76d713c07ad', '2019-04-18 17:16:34', '916877983@qq.com', '18229819406');
INSERT INTO `user` VALUES ('2', 'codingzx', '25d55ad283aa400af464c76d713c07ad', '2019-04-22 15:29:12', '994683607@qq.com', '18229819406');
INSERT INTO `user` VALUES ('3', 'admin', '25d55ad283aa400af464c76d713c07ad', '2019-05-16 10:46:46', '123123', '1231321');
SET FOREIGN_KEY_CHECKS=1;