2017-11-19 14:48:41 +08:00
|
|
|
create table bs_meta_permission
|
2017-11-16 22:24:37 +08:00
|
|
|
(
|
|
|
|
permission_level integer primary key,
|
|
|
|
name varchar(10)
|
|
|
|
);
|
2017-11-19 14:48:41 +08:00
|
|
|
insert into bs_meta_permission values (0,'超级管理员'),(1,'管理员'),(2,'图书馆借阅处'),(3,'读者');
|
2017-11-16 22:24:37 +08:00
|
|
|
|
|
|
|
|
2017-11-19 14:48:41 +08:00
|
|
|
create table bs_meta_account
|
2017-11-16 22:24:37 +08:00
|
|
|
(
|
|
|
|
account_status integer primary key,
|
|
|
|
name varchar(10)
|
|
|
|
);
|
2017-11-19 14:48:41 +08:00
|
|
|
insert into bs_meta_account values (0,'隐藏'),(1,'禁止登陆'),(2,'待验证'),(3,'正常');
|
2017-11-16 22:24:37 +08:00
|
|
|
|
2017-11-19 14:48:41 +08:00
|
|
|
create table bs_meta_book
|
2017-11-16 22:24:37 +08:00
|
|
|
(
|
|
|
|
status integer primary key,
|
|
|
|
name varchar(10)
|
|
|
|
);
|
2017-11-19 14:48:41 +08:00
|
|
|
insert into bs_meta_book values (0,'隐藏'),(1,'禁用'),(2,'正常');
|
2017-11-16 22:24:37 +08:00
|
|
|
|
2017-11-19 14:48:41 +08:00
|
|
|
create table bs_meta_bookstatus
|
2017-11-16 22:24:37 +08:00
|
|
|
(
|
|
|
|
status integer primary key,
|
|
|
|
name varchar(10)
|
|
|
|
);
|
2017-11-19 14:48:41 +08:00
|
|
|
insert into bs_meta_bookstatus values (0,'借出'),(1,'丢失'),(2,'在馆');
|
2017-11-16 22:24:37 +08:00
|
|
|
|
2017-11-19 14:48:41 +08:00
|
|
|
create table bs_user
|
2017-11-16 22:24:37 +08:00
|
|
|
(
|
|
|
|
username varchar(10) primary key,
|
|
|
|
password char(32),
|
|
|
|
nickname varchar(10),
|
2017-11-19 14:48:41 +08:00
|
|
|
permission_level integer references bs_meta_permission(permission_level),
|
|
|
|
account_status integer references bs_meta_account(account_status)
|
2017-11-16 22:24:37 +08:00
|
|
|
);
|
2017-11-19 14:48:41 +08:00
|
|
|
create table bs_level
|
2017-11-16 22:24:37 +08:00
|
|
|
(
|
|
|
|
user_lv integer primary key,
|
|
|
|
min_amount_limit integer,
|
|
|
|
max_amount_limit integer,
|
|
|
|
min_time_limit integer,
|
|
|
|
max_time_limit integer,
|
|
|
|
min_balance decimal(10,2)
|
|
|
|
);
|
2017-11-19 14:48:41 +08:00
|
|
|
create table bs_reader
|
2017-11-16 22:24:37 +08:00
|
|
|
(
|
2017-11-19 14:48:41 +08:00
|
|
|
username varchar(10) references bs_user(username),
|
2017-11-16 22:24:37 +08:00
|
|
|
realname varchar(10),
|
|
|
|
realid char(18),
|
|
|
|
phonenum varchar(15),
|
2017-11-19 14:48:41 +08:00
|
|
|
user_lv integer references bs_level(user_lv),
|
2017-11-16 22:24:37 +08:00
|
|
|
user_exp integer,
|
|
|
|
borrow_limit integer,
|
|
|
|
borrow_used integer,
|
|
|
|
borrow_time_limit integer,
|
|
|
|
bonus integer,
|
|
|
|
balance decimal(10,2)
|
|
|
|
);
|
2017-11-19 14:48:41 +08:00
|
|
|
create table bs_booktype
|
2017-11-16 22:24:37 +08:00
|
|
|
(
|
|
|
|
book_type varchar(10) primary key
|
|
|
|
);
|
2017-11-19 14:48:41 +08:00
|
|
|
create table bs_book
|
2017-11-16 22:24:37 +08:00
|
|
|
(
|
2017-11-19 23:28:27 +08:00
|
|
|
class_id integer primary key,
|
2017-11-16 22:24:37 +08:00
|
|
|
isbn varchar(13) unique,
|
|
|
|
name varchar(20),
|
2017-11-19 14:48:41 +08:00
|
|
|
book_type varchar(10) references bs_booktype(book_type),
|
2017-11-16 22:24:37 +08:00
|
|
|
author varchar(10),
|
|
|
|
publisher varchar(20),
|
|
|
|
publish_time date,
|
2017-11-19 14:48:41 +08:00
|
|
|
status integer references bs_meta_book(status)
|
2017-11-16 22:24:37 +08:00
|
|
|
);
|
2017-11-19 14:48:41 +08:00
|
|
|
create table bs_bookstatus
|
2017-11-16 22:24:37 +08:00
|
|
|
(
|
2017-11-19 23:28:27 +08:00
|
|
|
book_id integer primary key,
|
|
|
|
class_id integer references bs_book(class_id),
|
2017-11-16 22:24:37 +08:00
|
|
|
position varchar(30),
|
2017-11-19 14:48:41 +08:00
|
|
|
status integer references bs_meta_bookstatus(status)
|
2017-11-16 22:24:37 +08:00
|
|
|
);
|
2017-11-19 14:48:41 +08:00
|
|
|
create table bs_borrow
|
2017-11-16 22:24:37 +08:00
|
|
|
(
|
2017-11-19 14:48:41 +08:00
|
|
|
username varchar(10) references bs_user(username),
|
2017-11-19 23:28:27 +08:00
|
|
|
book_id integer references bs_bookstatus(book_id),
|
2017-11-16 22:24:37 +08:00
|
|
|
borrow_time date not null,
|
|
|
|
return_deadline date not null,
|
|
|
|
return_time date
|
2017-11-19 14:48:41 +08:00
|
|
|
);
|
|
|
|
create table bs_session
|
|
|
|
(
|
|
|
|
id char(32) primary key,
|
|
|
|
last_time integer,
|
|
|
|
username varchar(10) references bs_user(username)
|
2017-11-16 22:24:37 +08:00
|
|
|
);
|