资源描述
本科学生设计性实验报告
数据库课程设计
学 院: 软通学院
课程名称: 数据库课程设计
专业班级:
姓 名:
学 号:
开课学期 2013 至 2014 学年 第二 学期
学生实验报告
(一)
学生姓名
学号
同组人:
实验项目
图书馆系统
Ö必修□选修
□演示性实验 □验证性实验 Ö操作性实验 □综合性实验
实验地点
实验仪器台号
指导教师
陈辉
实验日期及节次
一、实验综述
一、实验任务
1) 以图书信息管理系统为例,开展数据库系统设计
2) 使用Java语言开发相关系统界面,实现系统相关功能
3) 完成系统测试
二、实验要求(系统功能要求)
1) 人员管理:读者、图书管理员、系统管理员,管理的内容包括人员增、删、查、改;
2) 书籍管理:采购、入库、预约、借阅、续借、归还、查询、统计、读书评论。
3) 仓库管理:管理图书馆藏信息
4) 供应商管理:管理图书供应商
5) 财务管理:管理图书采购帐目
三、实验仪器、设备或软件
仪器设备:电脑一台
数据库系统设计:Powerdesigner
Java开发工具: JDK1.6或以上 Eclipse 或者NetBeans
系统测试:人工测试
二、实验过程(编程,调试,运行;请写上源码,要求要有注释)1.
1.ER图
2.逻辑结构
3.物理结构
代码部分
建表命令
/*==============================================================*/
/* Table: 仓库 */
/*==============================================================*/
create table 仓库 (
仓库编号 char(10) not null,
图书数量 int null,
constraint PK_仓库 primary key nonclustered (仓库编号)
)
go
/*==============================================================*/
/* Table: 供货单位 */
/*==============================================================*/
create table 供货单位 (
供货单位编号 char(10) not null,
供货单位名称 char(10) null,
供货单位地址 char(15) null,
供货单位电话 char(11) null,
constraint PK_供货单位 primary key nonclustered (供货单位编号)
)
go
/*==============================================================*/
/* Table: 借阅 */
/*==============================================================*/
create table 借阅 (
借书证号 char(10) not null,
图书编号 char(10) not null,
借出日期 datetime null,
constraint PK_借阅 primary key nonclustered (借书证号, 图书编号)
)
go
/*==============================================================*/
/* Table: 借阅者 */
/*==============================================================*/
create table 借阅者 (
借书证号 char(10) not null,
读者班级 char(8) null,
读者性别 char(2) not null,
办证日期 char(10) null,
图书数量 int null,
读者姓名 varchar(8) not null,
constraint PK_借阅者 primary key nonclustered (借书证号)
)
go
/*==============================================================*/
/* Table: 图书 */
/*==============================================================*/
create table 图书 (
图书编号 char(10) not null,
作者 varchar(8) null,
书名 char(10) null,
借出日期 datetime null,
出版社 char(15) null,
库存数 int null,
价格 int null,
constraint PK_图书 primary key nonclustered (图书编号)
)
go
/*==============================================================*/
/* Table: 图书管理 */
/*==============================================================*/
create table 图书管理 (
图书管理编号 char(10) not null,
图书编号 char(10) not null,
constraint PK_图书管理 primary key nonclustered (图书管理编号, 图书编号)
)
go
/*==============================================================*/
/* Table: 图书管理员 */
/*==============================================================*/
create table 图书管理员 (
图书管理编号 char(10) not null,
图书管理姓名 varchar(8) not null,
图书管理性别 char(2) not null,
constraint PK_图书管理员 primary key nonclustered (图书管理编号)
)
go
/*==============================================================*/
/* Table: 存入 */
/*==============================================================*/
create table 存入 (
仓库编号 char(10) not null,
图书编号 char(10) not null,
constraint PK_存入 primary key nonclustered (仓库编号, 图书编号)
)
go
/*==============================================================*/
/* Table: 归还 */
/*==============================================================*/
create table 归还 (
借书证号 char(10) not null,
图书管理编号 char(10) not null,
归还日期 datetime null,
图书编号 char(10) null,
书名 char(10) null,
constraint PK_归还 primary key nonclustered (借书证号, 图书管理编号)
)
go
/*==============================================================*/
/* Table: 管理2 */
/*==============================================================*/
create table 管理2 (
图书管理编号 char(10) not null,
系统管理编号 char(10) not null,
constraint PK_管理2 primary key nonclustered (图书管理编号, 系统管理编号)
)
go
/*==============================================================*/
/* Table: 管理3 */
/*==============================================================*/
create table 管理3 (
系统管理编号 char(10) not null,
人员编号 char(10) not null,
constraint PK_管理3 primary key nonclustered (系统管理编号, 人员编号)
)
go
/*==============================================================*/
/* Table: 系统管理 */
/*==============================================================*/
create table 系统管理 (
系统管理编号 char(10) not null,
系统管理性别 char(2) not null,
系统管理姓名 varchar(8) not null,
constraint PK_系统管理 primary key nonclustered (系统管理编号)
)
go
/*==============================================================*/
/* Table: 读书评论 */
/*==============================================================*/
create table 读书评论 (
借书证号 char(10) not null,
评论 char(50) null,
图书管理编号 char(10) not null,
图书编号 char(10) null,
constraint PK_读书评论 primary key nonclustered (借书证号, 图书管理编号)
)
go
/*==============================================================*/
/* Table: 购销 */
/*==============================================================*/
create table 购销 (
人员编号 char(10) not null,
供货单位编号 char(10) not null,
购销价格 int null,
constraint PK_购销 primary key nonclustered (人员编号, 供货单位编号)
)
go
/*==============================================================*/
/* Table: 采购 */
/*==============================================================*/
create table 采购 (
人员编号 char(10) not null,
仓库编号 char(10) not null,
图书编号 char(10) not null,
采购数量 int null,
constraint PK_采购 primary key nonclustered (人员编号, 仓库编号)
)
go
/*==============================================================*/
/* Table: 采购人员 */
/*==============================================================*/
create table 采购人员 (
人员编号 char(10) not null,
人员姓名 varchar(8) null,
人员性别 char(2) not null,
人员电话 char(11) null,
constraint PK_采购人员 primary key nonclustered (人员编号)
)
go
/*==============================================================*/
/* Table: 预约 */
/*==============================================================*/
create table 预约 (
借书证号 char(10) not null,
图书管理编号 char(10) not null,
图书编号 char(10) null,
书名 char(10) null,
constraint PK_预约 primary key nonclustered (借书证号, 图书管理编号)
)
go
触发器
借书要求(书本没有库存,则无法进行借书操作)
use Librarysystem
go
CREATE TRIGGER tri_book
on 图书
for update
as
declare @btotal int
select @btotal=库存数
from inserted
if(@btotal<=0)
begin
rollback transaction
print '借阅失败!'
print'对不起,此书已经没有库存,无法进行本次借书操作!'
end
go
借书要求(读者最多借阅量)
use Librarysystem
go
CREATE TRIGGER tri_bookreader
on 借阅者
for insert
as
declare @no char(10),@num int
select @no=inserted.借书证号 from inserted
begin
select @num=count(*)
from 借阅者
where 借书证号=@no and 图书数量=@num
if(@num>5)
begin
rollback transaction
print '借阅失败!'
print'对不起,你的借阅总量已经达到本,无法进行本次借书操作!请归还部分书籍后,再进行下次借书操作!'
end
end
存储过程
读者借阅图书存储过程
use Librarysystem
go
create procedure RBorrowBook
@no varchar(10) ,
@bno varchar(10)
as
declare @bname varchar(50)
if exists(
select * from 借阅者,图书 where 借书证号=@no and 图书编号=@bno)
begin
print'对不起,你已经借阅了同一本图书,故而无法进行此次借书操作,请核实!'
end
else
begin
update 图书 set 库存数=库存数-1
where 图书编号=@bno
insert
into 借阅 (借书证号,图书编号,借出日期)
values (@no,@bno,getdate())
declare @rname varchar(8)
select @rname=读者姓名 from 借阅者 where 借书证号=@no
select @bname=书名 from 图书 where 图书编号=@bno
select '编号为'+@no+',姓名为'+@rname+'的读者,于'
+datename(year,GETDATE())+' 年'+datename(month,GETDATE())
+' 月'+datename(day,GETDATE())+' 日'+datename(hour,GETDATE())
+' 时'+datename(minute,GETDATE())+' 分'+datename(second,GETDATE())
+' 秒,成功地从图书馆借出《'+@bname+'》一书!'
as 读者借书成功信息
end
go
读者还书存储过程
use Librarysystem
go
create procedure ReturnBook
@no varchar(10),@bno varchar(10)
as
declare @bname varchar(50)
if not exists(select * from 借阅 where 借书证号=@no and 图书编号=@bno)
begin
print'对不起,你没有借阅此书,故而无法进行此次还书操作,请核实!'
end
else begin
update 图书 set 库存数=库存数+1
where 图书编号=@bno
delete
from 借阅
where 借书证号=@no and 图书编号=@bno
declare @rname varchar(8)
select @rname=读者姓名
from 借阅者
where 借书证号=@no
select @bname=书名
from 图书
where 图书编号=@bno
select '编号为'+@no+',姓名为'+@rname+'的读者,于'
+datename(year,GETDATE())+' 年'+datename(month,GETDATE())+
' 月'+datename(day,GETDATE())+' 日'+datename(hour,GETDATE())+
' 时'+datename(minute,GETDATE())+' 分'+datename(second,GETDATE())+
' 秒,成功地向图书馆归还《'+@bname+'》一书!'
as 读者还书成功信息
end
exec ReturnBook 1234567890,1234567890
三, 实验中遇到的困难
在做powerdesigner的过程中,写概念模型时会对实体与实体之间的联系分不清。
四、指导教师评语及成绩:
成绩: 指导教师签名:陈辉
批阅日期:2013年10月27日
其中专业理论知识内容包括:保安理论知识、消防业务知识、职业道德、法律常识、保安礼仪、救护知识。作技能训练内容包括:岗位操作指引、勤务技能、消防技能、军事技能。
二.培训的及要求培训目的
安全生产目标责任书
为了进一步落实安全生产责任制,做到“责、权、利”相结合,根据我公司2015年度安全生产目标的内容,现与财务部签订如下安全生产目标:
一、目标值:
1、全年人身死亡事故为零,重伤事故为零,轻伤人数为零。
2、现金安全保管,不发生盗窃事故。
3、每月足额提取安全生产费用,保障安全生产投入资金的到位。
4、安全培训合格率为100%。
二、本单位安全工作上必须做到以下内容:
1、对本单位的安全生产负直接领导责任,必须模范遵守公司的各项安全管理制度,不发布与公司安全管理制度相抵触的指令,严格履行本人的安全职责,确保安全责任制在本单位全面落实,并全力支持安全工作。
2、保证公司各项安全管理制度和管理办法在本单位内全面实施,并自觉接受公司安全部门的监督和管理。
3、在确保安全的前提下组织生产,始终把安全工作放在首位,当“安全与交货期、质量”发生矛盾时,坚持安全第一的原则。
4、参加生产碰头会时,首先汇报本单位的安全生产情况和安全问题落实情况;在安排本单位生产任务时,必须安排安全工作内容,并写入记录。
5、在公司及政府的安全检查中杜绝各类违章现象。
6、组织本部门积极参加安全检查,做到有检查、有整改,记录全。
7、以身作则,不违章指挥、不违章操作。对发现的各类违章现象负有查禁的责任,同时要予以查处。
8、虚心接受员工提出的问题,杜绝不接受或盲目指挥;
9、发生事故,应立即报告主管领导,按照“四不放过”的原则召开事故分析会,提出整改措施和对责任者的处理意见,并填写事故登记表,严禁隐瞒不报或降低对责任者的处罚标准。
10、必须按规定对单位员工进行培训和新员工上岗教育;
11、严格执行公司安全生产十六项禁令,保证本单位所有人员不违章作业。
三、 安全奖惩:
1、对于全年实现安全目标的按照公司生产现场管理规定和工作说明书进行考核奖励;对于未实现安全目标的按照公司规定进行处罚。
2、每月接受主管领导指派人员对安全生产责任状的落
展开阅读全文