-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathdb.sql
More file actions
217 lines (177 loc) · 6.87 KB
/
db.sql
File metadata and controls
217 lines (177 loc) · 6.87 KB
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
--mysql
CREATE DATABASE bos;
USE bos;
drop table if exists bc_decidedzone;
drop table if exists bc_region;
drop table if exists bc_staff;
drop table if exists bc_standard;
drop table if exists bc_subarea;
drop table if exists user;
/*==============================================================*/
/* Table: bc_decidedzone */
/*==============================================================*/
create table bc_decidedzone
(
id varchar(32) not null,
name varchar(30),
staff_id varchar(32),
primary key (id)
);
/*==============================================================*/
/* Table: bc_region */
/*==============================================================*/
create table bc_region
(
id varchar(32) not null,
province varchar(50),
city varchar(50),
district varchar(50),
postcode varchar(50),
shortcode varchar(30),
citycode varchar(30),
primary key (id)
);
/*==============================================================*/
/* Table: bc_staff */
/*==============================================================*/
create table bc_staff
(
id varchar(32) not null,
name varchar(20),
telephone varchar(20),
haspda char(1),
deltag char(1),
station varchar(40),
standard_id varchar(32),
primary key (id)
);
/*==============================================================*/
/* Table: bc_standard */
/*==============================================================*/
create table bc_standard
(
id varchar(32) not null,
name varchar(30),
minweight double,
maxweight double,
deltag char(1),
user_id varchar(32),
updatetime timestamp,
primary key (id)
);
/*==============================================================*/
/* Table: bc_subarea */
/*==============================================================*/
create table bc_subarea
(
id varchar(32) not null,
decidedzone_id varchar(32),
region_id varchar(32),
addresskey varchar(100),
startnum varchar(30),
endnum varchar(30),
single char(1),
position varchar(255),
primary key (id)
);
/*==============================================================*/
/* Table: user */
/*==============================================================*/
create table user
(
id varchar(32) not null,
username varchar(20),
password varchar(32),
gender char(1),
birthday date,
salary double,
station varchar(40),
telephone varchar(40),
remark varchar(255),
primary key (id)
);
alter table bc_decidedzone add constraint FK_decidedzone_staff foreign key (staff_id)
references bc_staff (id) on delete restrict on update restrict;
alter table bc_staff add constraint FK_staff_standard foreign key (standard_id)
references bc_standard (id) on delete restrict on update restrict;
alter table bc_standard add constraint FK_stardard_user foreign key (user_id)
references user (id) on delete restrict on update restrict;
alter table bc_subarea add constraint FK_area_decidedzone foreign key (decidedzone_id)
references bc_decidedzone (id) on delete restrict on update restrict;
alter table bc_subarea add constraint FK_area_region foreign key (region_id)
references bc_region (id) on delete restrict on update restrict;
/* 初始化一条记录 */
insert into user(id,username,password) values('abcdefghijklmn','admin',md5('admin'));
--取派模块
drop table if exists qp_noticebill;
drop table if exists qp_workbill;
drop table if exists qp_workordermanage;
create table qp_noticebill
(
id varchar(32) not null,
customer_id varchar(32),
customer_name varchar(20),
delegater varchar(20),
telephone varchar(20),
pickaddress varchar(200),
arrivecity varchar(20),
product varchar(20),
pickdate date,
num int,
weight double,
volume varchar(20),
remark varchar(255),
ordertype varchar(20),
user_id varchar(32),
staff_id varchar(32),
primary key (id)
);
/*==============================================================*/
/* Table: qp_workbill */
/*==============================================================*/
create table qp_workbill
(
id varchar(32) not null,
noticebill_id varchar(32),
type varchar(20),
pickstate varchar(20),
buildtime timestamp,
attachbilltimes int,
remark varchar(255),
staff_id varchar(32),
primary key (id)
);
/*==============================================================*/
/* Table: qp_workordermanage */
/*==============================================================*/
create table qp_workordermanage
(
id varchar(32) not null,
arrivecity varchar(20),
product varchar(20),
num int,
weight double,
floadreqr varchar(255),
prodtimelimit varchar(40),
prodtype varchar(40),
sendername varchar(20),
senderphone varchar(20),
senderaddr varchar(200),
receivername varchar(20),
receiverphone varchar(20),
receiveraddr varchar(200),
feeitemnum int,
actlweit double,
vol varchar(20),
managerCheck varchar(1),
updatetime date,
primary key (id)
);
alter table qp_noticebill add constraint FK_Reference_2 foreign key (user_id)
references user (id) on delete restrict on update restrict;
alter table qp_noticebill add constraint FK_Reference_3 foreign key (staff_id)
references bc_staff (id) on delete restrict on update restrict;
alter table qp_workbill add constraint FK_Reference_4 foreign key (staff_id)
references bc_staff (id) on delete restrict on update restrict;
alter table qp_workbill add constraint FK_workbill_noticebill_fk foreign key (noticebill_id)
references qp_noticebill (id) on delete restrict on update restrict;