This repository has been archived by the owner on Aug 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
miaosha.sql
133 lines (118 loc) · 6.24 KB
/
miaosha.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
/*
Navicat Premium Data Transfer
Source Server : mysql
Source Server Type : MySQL
Source Server Version : 50556
Source Host : localhost:3306
Source Schema : miaosha
Target Server Type : MySQL
Target Server Version : 50556
File Encoding : 65001
Date: 09/05/2018 09:10:28
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for goods
-- ----------------------------
DROP TABLE IF EXISTS `goods`;
CREATE TABLE `goods` (
`id` bigint(20) NOT NULL,
`goods_name` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`goods_title` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`goods_img` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`goods_detail` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
`goods_price` decimal(10, 2) NULL DEFAULT 0.00,
`goods_stock` int(11) NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of goods
-- ----------------------------
INSERT INTO `goods` VALUES (1, 'iphoneX', 'Apple iphone X A(1865) 全面屏', '/img/iphonex.png', 'Apple iphone X A(1865) 全面屏', 8765.00, 100);
INSERT INTO `goods` VALUES (2, '华为mate9', '华为Mate 9 4GB +32GB版本', '/img/meta10.png', '华为Mate 9 4GB +32GB版本', 3212.00, 100);
-- ----------------------------
-- Table structure for miaosha_goods
-- ----------------------------
DROP TABLE IF EXISTS `miaosha_goods`;
CREATE TABLE `miaosha_goods` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '秒杀的商品表',
`goods_id` bigint(20) NULL DEFAULT NULL COMMENT '商品id',
`miaosha_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '秒杀价格',
`stock_count` int(11) NULL DEFAULT 0 COMMENT '库存数量',
`start_date` datetime NULL DEFAULT NULL COMMENT '秒杀开始的时间',
`end_date` datetime NULL DEFAULT NULL COMMENT '秒杀结束时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of miaosha_goods
-- ----------------------------
INSERT INTO `miaosha_goods` VALUES (1, 1, 0.01, 7, '2018-05-06 19:21:10', '2018-07-22 20:13:17');
INSERT INTO `miaosha_goods` VALUES (2, 2, 0.01, 7, '2018-05-06 16:40:43', '2018-07-04 17:13:58');
-- ----------------------------
-- Table structure for miaosha_order
-- ----------------------------
DROP TABLE IF EXISTS `miaosha_order`;
CREATE TABLE `miaosha_order` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) NULL DEFAULT NULL,
`order_id` bigint(20) NULL DEFAULT NULL,
`goods_id` bigint(20) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `u_uid_god`(`user_id`, `order_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of miaosha_order
-- ----------------------------
INSERT INTO `miaosha_order` VALUES (1, 13577601243, 1, 1);
INSERT INTO `miaosha_order` VALUES (2, 13577601243, 2, 2);
INSERT INTO `miaosha_order` VALUES (3, 13577601243, 3, 1);
INSERT INTO `miaosha_order` VALUES (4, 13577601243, 4, 1);
INSERT INTO `miaosha_order` VALUES (5, 13577601243, 5, 2);
-- ----------------------------
-- Table structure for order_info
-- ----------------------------
DROP TABLE IF EXISTS `order_info`;
CREATE TABLE `order_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) NULL DEFAULT NULL,
`goods_id` bigint(20) NULL DEFAULT NULL,
`delivery_addr_id` bigint(20) NULL DEFAULT NULL,
`goods_name` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`goods_count` int(11) NULL DEFAULT NULL,
`goods_price` decimal(10, 2) NULL DEFAULT NULL,
`order_channel` tinyint(4) NULL DEFAULT NULL,
`status` tinyint(4) NULL DEFAULT NULL COMMENT '0代表未支付、1已经支付、2已经发货、3已经收货、4已经退款、5已经完成',
`create_date` datetime NULL DEFAULT NULL,
`pay_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of order_info
-- ----------------------------
INSERT INTO `order_info` VALUES (1, 13577601243, 1, NULL, 'iphoneX', 1, 0.01, 1, 0, '2018-05-01 19:30:33', NULL);
INSERT INTO `order_info` VALUES (2, 13577601243, 2, NULL, '华为mate9', 1, 0.01, 1, 0, '2018-05-06 17:30:31', NULL);
INSERT INTO `order_info` VALUES (3, 13577601243, 1, NULL, 'iphoneX', 1, 0.01, 1, 0, '2018-05-06 20:53:36', NULL);
INSERT INTO `order_info` VALUES (4, 13577601243, 1, NULL, 'iphoneX', 1, 0.01, 1, 0, '2018-05-08 08:52:34', NULL);
INSERT INTO `order_info` VALUES (5, 13577601243, 2, NULL, '华为mate9', 1, 0.01, 1, 0, '2018-05-08 09:59:44', NULL);
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户ID,手机号码',
`name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`nickname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`password` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'MD5( MD5 ( pass明文 + 固定salt) + salt)',
`salt` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`head` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像、云贮存的ID',
`register_date` datetime NULL DEFAULT NULL COMMENT '注册时间',
`last_login_date` datetime NULL DEFAULT NULL COMMENT '上次登录时间',
`login_count` int(11) NULL DEFAULT 0 COMMENT '登录次数',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 13577601244 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES (13577601243, 'allen', 'xcallen', '55d2c90932ec170a830910b15d5f907f', '1a2b3d4c', NULL, '2018-02-26 20:39:35', '2018-04-11 20:38:57', 1);
SET FOREIGN_KEY_CHECKS = 1;