create database net_eicp_greenbook;
use net_eicp_greenbook;
create table GB_user
(
U_id int identity(10000,1)primary key,
U_loginname nvarchar(20)not null unique,
U_pswd binary(16)not null,
U_realname nvarchar(20),
U_addr nvarchar(100),
U_mobile nvarchar(20),
U_email nvarchar(50)not null unique,
U_qq bigint,
U_homepage nvarchar(100),
U_privacyoption smallint,
U_avatar binary(16),
U_registered datetime,
U_buycount int not null,
U_buytotal money not null,
U_buystars int not null,
U_sellcount int not null,
U_selltotal money not null,
U_sellstars int not null
);
create table GB_category
(
C_id int identity(1,1)primary key,
C_parent nvarchar(20)not null,
C_child nvarchar(20)not null
);
create table GB_book
(
B_id int identity(1,1)primary key,
B_title nvarchar(100)not null,
B_isbn nvarchar(20),
B_author nvarchar(100),
B_publisher nvarchar(50),
B_version nvarchar(20),
B_language nvarchar(30),
B_originalprice numeric(5,2)not null check(B_originalprice>=0),
B_categoryid int references GB_category(C_id),
B_introduction ntext,
B_visits int not null
);
create table GB_supply
(
S_id int identity(1,1)primary key,
S_bookid int not null references GB_book(B_id)on delete cascade,
S_sellerid int not null references GB_user(U_id)on delete cascade,
S_amount int not null check(S_amount>=0),
S_price numeric(5,2)not null check(S_price>0),
S_quality numeric(2,0)check(S_quality>0),
S_photohash binary(16),
S_description ntext
);
create table GB_request
(
R_id int identity(1,1)primary key,
R_buyerid int not null references GB_user(U_id)on delete cascade,
R_bookid int not null references GB_book(B_id)on delete cascade,
R_amount int not null,
R_reqtime datetime not null,
R_reqsupply int references GB_supply(S_id),
unique(R_buyerid,R_bookid)
);
create table GB_transaction
(
T_id int identity(1,1)primary key,
T_buyerid int not null references GB_user(U_id)on delete cascade,
T_bookid int not null references GB_book(B_id)on delete cascade,
T_amount int not null,
T_reqtime datetime not null,
T_supplyid int not null references GB_supply(S_id),
T_dealtime datetime,
T_rate tinyint not null check(T_rate in(1,2,3,4,5)),
T_ratetext ntext,
T_revrated bit
);
create table GB_message
(
M_id int identity(1,1)primary key,
M_sender int not null references GB_user(U_id),
M_receiver int not null references GB_user(U_id)on delete cascade,
M_message ntext not null,
M_time datetime not null,
M_read bit
);
create index index1 on GB_message(M_sender);
create index index2 on GB_message(M_receiver);
create index index3 on GB_book(B_title);
create index index4 on GB_user(U_loginname);
create index index5 on GB_request(R_buyerid);
create index index6 on GB_request(R_bookid);
create index index7 on GB_transaction(T_buyerid);
insert into GB_user values('系统管理员',0x00,null,null,null,'bspub@139.com',null,null,null,null,null,0,0,0,0,0,0);
create procedure sp_readssmss @uid int,@mode smallint as
begin
if @mode=0 begin /*所有未读*/
select M_sender,U_loginname,M_message,M_time,M_id
from GB_message,GB_user
where M_receiver=@uid and M_read=0 and U_id=M_sender
order by M_id desc
update GB_message
set M_read=1
where M_receiver=@uid and M_read=0
end
else if @mode=1 begin /*所有*/
select M_sender,U_loginname,M_message,M_time,M_id
from GB_message,GB_user
where M_receiver=@uid and U_id=M_sender
order by M_id desc
update GB_message
set M_read=1
where M_receiver=@uid and M_read=0
end
else if @mode=2 begin /*前20条*/
select top 20 M_sender,U_loginname,M_message,M_time,M_id
from GB_message,GB_user
where M_receiver=@uid and U_id=M_sender
order by M_id desc
update GB_message
set M_read=1
where M_id in
(select top 20 M_id
from GB_message
where M_receiver=@uid
order by M_id desc)
end
end
create trigger tg_onremoveuser
on GB_user
instead of delete
as
begin
update GB_user
set U_privacyoption=3
where U_id in
(select U_id
from deleted)
end
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
二手书交易系统源码 (104个子文件)
Global.asax 12KB
BookList.ascx 3KB
BookInfo.ascx 2KB
SupplyInfo.ascx 2KB
BookInfoCompact.ascx 793B
CategoryList.ascx 315B
CategoryListNew.ascx 196B
EditProfile.aspx 12KB
AboutUs.aspx 9KB
Register.aspx 9KB
NewBook.aspx 9KB
NewBook3.aspx 8KB
EditBook.aspx 7KB
Book.aspx 7KB
UserDetails.aspx 6KB
SellerSquare.aspx 6KB
NewBook1.aspx 5KB
SiteSMS.aspx 5KB
Login.aspx 3KB
Buy.aspx 3KB
PhotoClipperTestPage.aspx 3KB
Default.aspx 3KB
ConsumerSquare.aspx 2KB
NewBook2.aspx 2KB
NewBook4.aspx 2KB
DelSupply.aspx 2KB
NBFinish.aspx 1KB
Notice.aspx 1KB
AdvSearch.aspx 996B
Search.aspx 982B
SiteMap.aspx 974B
HowTo.aspx 797B
SellerDecReq.aspx 563B
SellerAccReq.aspx 563B
ValiCode.aspx 432B
Zoomer.aspx 428B
Rate.aspx 356B
Redirect.aspx 352B
web.config 9KB
packages.config 149B
SellerSquare.aspx.cs 12KB
EditProfile.aspx.cs 8KB
SiteSMS.aspx.cs 8KB
BookInfo.ascx.cs 7KB
MasterPage.master.cs 6KB
Register.aspx.cs 6KB
Book.aspx.cs 6KB
NewBook1.aspx.cs 5KB
Buy.aspx.cs 5KB
UserDetails.aspx.cs 5KB
Login.aspx.cs 5KB
NewBook3.aspx.cs 5KB
Search.aspx.cs 4KB
BookList.ascx.cs 4KB
BookInfoCompact.ascx.cs 4KB
ConsumerSquare.aspx.cs 4KB
NewBook.aspx.cs 4KB
EditBook.aspx.cs 3KB
DelSupply.aspx.cs 3KB
SupplyInfo.ascx.cs 3KB
NewBook4.aspx.cs 2KB
ValiCode.aspx.cs 2KB
Default.aspx.cs 2KB
Zoomer.aspx.cs 2KB
CategoryList.ascx.cs 2KB
NewBook2.aspx.cs 2KB
SellerDecReq.aspx.cs 1010B
SellerAccReq.aspx.cs 1010B
Global.cs 768B
NBFinish.aspx.cs 497B
Notice.aspx.cs 344B
Redirect.aspx.cs 341B
Rate.aspx.cs 288B
CategoryListNew.ascx.cs 274B
AdvSearch.aspx.cs 263B
AboutUs.aspx.cs 259B
SiteMap.aspx.cs 259B
HowTo.aspx.cs 257B
StyleSheet.css 763B
face08.gif 10KB
face02.gif 4KB
face15.gif 3KB
face11.gif 3KB
face13.gif 2KB
face16.gif 2KB
face12.gif 2KB
face10.gif 2KB
face14.gif 2KB
face09.gif 2KB
face01.gif 2KB
face04.gif 2KB
face07.gif 2KB
face05.gif 2KB
face06.gif 2KB
face03.gif 1KB
alert.gif 1KB
PhotoClipperTestPage.html 3KB
back.jpg 102KB
LOGO.jpg 7KB
zanwu.jpg 3KB
共 104 条
- 1
- 2
同济隐士
- 粉丝: 2
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 进一步了解“学习 Spring Security”.zip
- 这是 Vue 2 的 repo 对于 Vue 3,请访问.zip
- 这个 repo 包含按频率排序的 10,000 个最常见的英语单词列表,由 Google 万亿词语料库的 n-gram 频率分析确定 .zip
- 软件版本控制可视化.zip
- 转至012345678.zip
- 设计模式Golang实现《研磨设计模式》读书笔记.zip
- 终极围棋学习指南.zip
- 用于读写 parquet 文件的纯 golang 库.zip
- 用于访问 Google API 的 PHP 客户端库.zip
- 用于 S3 兼容对象存储的 MinIO Go 客户端 SDK.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页