1、图书馆管理系统powerdesigner本科学生设计性实验报告数据库课程设计学 院: 软通学院 课程名称: 数据库课程设计 专业班级: 姓 名: 学 号: 开课学期 2013 至 2014 学年 第二 学期学生实验报告(一)学生姓名 学号同组人:实验项目图书馆系统必修选修 演示性实验 验证性实验 操作性实验 综合性实验实验地点 实验仪器台号指导教师陈辉实验日期及节次一、实验综述 一、实验任务1) 以图书信息管理系统为例,开展数据库系统设计2) 使用Java语言开发相关系统界面,实现系统相关功能3) 完成系统测试二、实验要求(系统功能要求)1) 人员管理:读者、图书管理员、系统管理员,管理的内容
2、包括人员增、删、查、改;2) 书籍管理:采购、入库、预约、借阅、续借、归还、查询、统计、读书评论。3) 仓库管理:管理图书馆藏信息4) 供应商管理:管理图书供应商5) 财务管理:管理图书采购帐目三、实验仪器、设备或软件仪器设备:电脑一台数据库系统设计:PowerdesignerJava开发工具:JDK1.6或以上Eclipse或者NetBeans系统测试:人工测试二、实验过程(编程,调试,运行;请写上源码,要求要有注释)1.1.ER图2.逻辑结构3.物理结构代码部分建表命令/*=*/* Table: 仓库 */*=*/create table 仓库 ( 仓库编号 char(10) not nu
3、ll, 图书数量 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 借阅 (
4、 借书证号 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, const
5、raint 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 tab
6、le 图书管理 ( 图书管理编号 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 (图书管理编号)g
7、o/*=*/* 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, const
8、raint 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
9、, 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) no
10、t 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/*=*
11、/* 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, 人员电话 c
12、har(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 goCR
13、EATE TRIGGER tri_bookon 图书for updateas declare btotal intselect btotal=库存数from inserted if(btotal5) begin rollback transaction print 借阅失败! print对不起,你的借阅总量已经达到本,无法进行本次借书操作!请归还部分书籍后,再进行下次借书操作! end end存储过程读者借阅图书存储过程use Librarysystem gocreate procedure RBorrowBook no varchar(10) ,bno varchar(10) asdecla
14、re bname varchar(50) if exists(select * from 借阅者,图书 where 借书证号=no and 图书编号=bno) begin print对不起,你已经借阅了同一本图书,故而无法进行此次借书操作,请核实! end else begin update 图书 set 库存数=库存数-1 where 图书编号=bnoinsert into 借阅 (借书证号,图书编号,借出日期) values (no,bno,getdate() declare rname varchar(8) select rname=读者姓名 from 借阅者 where 借书证号=no
15、 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
16、 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 图书编号=bnodelete from 借阅 where 借书证号=no and 图书编号=bno declare rname
17、 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日
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1