工作流程图:
2.7 功能模块图:
用户界面 (有一般的用户权限)
登 录
管理员界面(有添加、修改、删除的权限) paper51.com
添加商品、
修改商品、评论、订单、用户
后台管理
删除商品、评论、订单、用户
查询商品、评论、订单、用户 内容来自论文无忧网 www.paper51.com
浏览商品
用 户 对商品评论
订购商品
家用电器
手机数码
前台商品分类
电脑产品
日用百货 paper51.com
管理员表(admin)
订单表1(dingdan1)
订单表2(dingdan2)
数据库 商品评论表(shppl)
用户表(users)
商品表(xangpian)
支付宝表(zhfb)
2.8 数据库逻辑设计:
2.8.1管理员表(admin)
内容来自论文无忧网 www.paper51.com
2.8.2订单表1(dingdan1)
内容来自www.paper51.com
2.8.3订单表2(dingdan2)
内容来自www.paper51.com
2.8.4商品评论表(shppl)
http://www.paper51.com
2.8.5支付宝表(zhfb)
2.8.6用户表(users)
http://www.paper51.com
2.8.7商品表(xangpian)
2.9 数据库中触发器:
2.9.1当删除订项时订单总金额减去删除项金额
CREATE trigger dele_dian
on dbo.diandan2
for delete
as
declare @a int
declare @moneys money
declare @number int
select @a=ddid,@moneys=moneys,@number=numer from deleted
update diandan1 set diandan1.moneys=diandan1.moneys-@moneys*@number where diandan1.ddid=@a copyright paper51.com
2.9.2当添加订项时订单总金额加上添加项金额
create trigger up_dian1_clinch
on diandan1
for update
as
if update(clinch)
begin
update zhfb set zhfb.vacancy=zhfb.vacancy+(select moneys from inserted)
where account='8888' and (select clinch from inserted)=1
update zhfb set zhfb.vacancy=zhfb.vacancy-(select moneys from inserted)
where account=(select account from users where yfname=(select yhname from inserted)) and (select clinch from inserted)=1
end
go
2.9.3当删除订单时删除所有订单子项
create trigger dele_dian1
on diandan1
for delete
as
delete from diandan2
where diandan2.ddid=(select ddid from deleted)
go
paper51.com |