资源描述
安 徽 农 业 大 学
课程实践(设计)汇报
实践项目名称 图书管理系统设计
项目组成人员
院 系 信 年级专业 0
指 导 教 师 傅
目录
1课程设计背景(包含:现实状况、研究目标等) 3
2需求分析(包含:功效分析、操作步骤分析等) 3
2.1需求分析 3
3设计和实现(包含:前台页面、数据库、业务逻辑等设计) 4
3.1数据库结构设计 4
3.1.1 概念结构设计 4
3.1.2 逻辑结构设计……………………………………………………………………………………………………… . 7
3.2.1物理结构设计……………………………………………………………………………………………………….. 8
3.3.1系统功效设计图书管理模块功……………………………………………………………………………11
3.4系统界面设计和实现…………………………………………………………………………………………..11
3.4.1系统登录界面………………………………………………………………………………………………………11
1课程设计背景
图书馆信息化管理从最初对图书馆业务管理实施信息化管剪发展到对图书馆各个业务步骤和网络化管理,并建立大规模以个体文件目录联机查询为主资源共享系统;而图书馆正常运行中总是面对大量读者信息,图书信息及二者相互作用产生借书信息,所以要对读者资源,读者资源,借书信息进行管理,本系统开发就是在于提升图书管理工作效率!
2需求分析(包含:功效分析、操作步骤分析等)
2.1需求分析
通常通用图书馆借阅管理系统包含系统管理、读者管理、编目、图书流通、统计、查询等功效。比较优异能够在一个界面下实现图书、音像、期刊管理,设置假期、设置暂离锁(提升安全性)、暂停一些读者借阅权、导入导出读者、交换MARC数据、升级辅助编码库等。另外伴随Internet应用发展,一个完善系统还应该提供无缝接入Internet功效,经过IE浏览器让读者使用借阅资料查询、更换密码、预约、资料检索等功效。有些系统还能提供读者自助服务,能够开放部分用户机让读者自行管理密码、查询自己借阅史、预约资料、检索资料等。
在结构系统时,首先从需求出发结构数据库表,然后再由数据库结合需求划分系统功效模块。这么,就把一个大系统分解成了多个小系统。这里把系统层次划分为了两个部分:一个是通常见户态:即图书有服务子系统;另一个是管理员界面:提供图书管理和维护功效。对于不一样子系统之间功换,采取了登录功效和用户注销功效。
系统划分了子系统后,下一步工作是继续划分子系统小模块。先考虑在进入子系统时应该做什么,进入系统以后又应该做什么,提供那些服务等。比如,对于图书信息服务子系统,在用户进入时首先得调用相关数据库表,找出用户图书借阅情况;进入系统后,子系统得提供图书查询、图书借阅和还书功效。另外,针对本系统特殊情况,同时也考虑系统可移植性,在系统中增加了数据库路径维护部分。
但因为本人技术有限,下面只做了部分设计
3设计和实现(包含:前台页面、数据库、业务逻辑等设计)
3.1数据库结构设计
3.1.1 概念结构设计(E-R图)
概念结构设计是将分析得到用户需求抽象为概念模型过程,即在需求分析基础上,设计出能够满足用户需求多种实体和它们之间相互关系模型。这么才能愈加好地、更正确地用某一DBMS实现这些需求,它是整个数据库设计关键。概念结构关键特点是能真实、充足地反应现实世界,易于了解,易于更改,易于向关系、网状、层次等多种数据模型转换。描述概念模型有力工具是E-R模型。
Er图:
图书类型
管理
借阅信息
属于
管理
管理员
图书
管理
管理
属于
管理
图书馆信息
书架
部分实体ER图:
借阅次数
图书编号
图书
价格
书架号
书类
书名
作者
管理员
管理员号
密码
管理员名
3.1.2 逻辑结构设计
逻辑结构设计任务就是把概念结构设计阶段设计好基础E-R图转换为和选择DBMS产品所支持数据模型相符合逻辑结构。设计逻辑结构时通常要分三步进行,首先是将概念结构转换为通常关系、网状、层次模型,其次是将转换来关系、网状、层次模型向特定DBMS支持下数据模型转换,最终是对数据模型进行优化。
基于B/S简易图书借阅管理系统采取是将E-R图向关系数据模型转换。以下是由概念模型向逻辑模型转化关系模式:
管理员(管理员编号,管理员名称,管理员密码)
图书(图书编码,图书名称,图书类别,书架,作者,价格,借阅次数)
3.2.1物理结构设计
数据库物理结构设计是对于给定逻辑数据模型,选择一个最适宜应用环境物理结构。数据库物理结构指是数据库在物理设备上存放结构和存取方法,它依靠于给定计算机系统
表2.2管理员信息表(new_userlist)
字段名
注释
类型
长度
许可空
默认值
userId
管理员编号
int
4
自动增加(1,1)
userName
管理员名称
varchar
50
Null
userPwd
管理员密码
varchar
50
Null
表2.3图书信息表(new_booklist)
字段名
注释
类型
长度
许可空
默认值
bookid
图书编码
varchar
50
bookName
图书名称
varchar
50
null
bookType
图书类别
int
4
null
bookcase
书架
int
100
null
auother
作者
varchar
80
null
price
价格
money
8
null
borrowSum
借阅次数
int
4
null
数据库表:
3.3.1系统功效设计图书管理模块功效(时间技术有限现在只有此功效)
图书类型管理:是对图书进行分类管理,对图书类型添加、删除、修改等功效。
图书信息管理:管理员对图书信息具体录入,修改图书信息和删除图书信息等功效。
3.4系统界面设计和实现
3.4.1系统登录界面
系统首页,同时也是登录界面,在此界面中,管理能够依据本身情况登录到系统中 ,管理员登录界面以下图所表示:
相关代码:
<!—JSPdl-0-->
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>用户登陆界面</title>
</head>
<body>
<%
if(!session.isNew()){
String name=(String)session.getAttribute("username");
if(name==null) name="";
}
out.println("Session ID:"+session.getId());//输出会话编号
%>
<p align="center">
<table border="1">
<caption>
管理员登陆:
</caption>
<form action="JSPdl-1.jsp" method="post">
<tr>
<td>管理员姓名</td>
<td><input type="text" name="username"/></td>
</tr>
<tr>
<td>管理员密码</td>
<td><input type="password" name="password"/></td>
</tr>
<tr>
<td><input type="submit" value="提交"/>
</tr>
</form>
</table>
</p>
</body>
</html>
<! —JSPdl-1- ->
<%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %>
<%@ page import="java.sql.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>用户身份验证</title>
</head>
<body>
<%
String username=request.getParameter("username");
String password=request.getParameter("password");
if(username==null) username="";
if(password==null) password="";
try{
//装载驱动程序
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
//连接字符串
String url ="jdbc:mysql://localhost/new_library";
//建立连接
Connection conn= DriverManager.getConnection(url,"root","123456");
//建立Statement
Statement stmt=conn.createStatement();
//实施查询建立ResultSet
ResultSet rs=stmt.executeQuery("select userName,userPw from new_userlist");
//输出查询结果
String uname=rs.getString("userName");
String upass=rs.getString("userPw");
if(username.equals(uname)&&password.equals(upass)){//验证用户信息
response.sendRedirect("JSPdl-2.jsp");//进入欢迎页面
}
else{
response.sendRedirect("JSPdl-0.jsp");//进入登陆页面
}//关闭连接、释放资源
rs.close();
stmt.close();
conn.close();
}catch(ClassNotFoundException cnfe){
out.print(cnfe);
}catch(SQLException sqle){
out.print(sqle);
}catch(Exception e){
out.print(e);
}
%>
</body>
</html>
<!- -JSPdl-0à
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="beans.*,java.sql.*" errorPage="error.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>显示图书列表</title>
</head>
<body>
<jsp:useBean id="conn" scope="session" class="beans.new_libraryDBean"/>
<table border="1">
<caption>图书列表</caption>
<tr>
<th>图书编号</th>
<th>书名</th>
<th>作者</th>
<th>书类</th>
<th>书架号</th>
<th>价格</th>
<th>借阅次数</th>
</tr>
<%
new_booklistBean[] records=conn.getAllRecords();
if(records!=null){
for(int i=0;i<records.length;i++){
out.println("<tr>");
out.println("<td>"+records[i].getbookID()+"</td>");
out.println("<td>"+records[i].getbookName()+"</td>");
out.println("<td>"+records[i].getauother()+"</td>");
out.println("<td>"+records[i].getbookType()+"</td>");
out.println("<td>"+records[i].getbookCase()+"</td>");
out.println("<td>"+records[i].getprice()+"</td>");
out.println("<td>"+records[i].getborrowSum()+"</td>");
out.println("</tr>");
}
}
%>
</table>
<p>
<a name="url">更多操作:</a><br>
<a href="JSPdl-3.jsp" target="_self">添加图书</a>
<a href="#url">返回</a><br>
<a href="JSPdl-4.jsp" target="_self">删除图书</a>
</p>
</body>
</html>
管理员添加图书统计:
相关代码:
ßJSPdl-3à
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="beans.new_booklistBean,beans.ConnBean"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>添加图书统计</title>
</head>
<body>
<p>
<table>
<form action="" method="post">
<caption>添加新统计</caption>
<tr>
<td>图书编号</td>
<td><input type="text" name="bookID"/>*</td>
</tr>
<tr>
<td>书名</td>
<td><input type="text" name="bookName"/>*</td>
</tr>
<tr>
<td>作者</td>
<td><input type="text" name="auother"/></td>
</tr>
<tr>
<td>书类</td>
<td><textarea name="bookType" cols="20" rows="5"></textarea></td>
</tr>
<tr>
<td>书架号</td>
<td><input type="text" name="bookCase"/>*</td>
</tr>
<tr>
<td>价格</td>
<td><input type="text" name="price"/>*</td>
</tr>
<tr>
<td>借阅次数</td>
<td><input type="text" name="borrowSum"/>*</td>
</tr>
<tr>
<td/>
<td><input type="submit" value="增加"/>
<input type="reset" value="重写"/>
</td>
</tr>
</form>
</table>
<jsp:useBean id="book" scope="request" class="beans.new_booklistBean"/>
<jsp:setProperty name="book" property="*"/>
<jsp:useBean id="conn" scope="session" class="beans.new_libraryDBean"/>
<%
if(book.getbookID()!=0&&conn.insertRecord(book))
out.println("<hr>添加统计成功");
%>
</p>
</body>
</html>
ßJSPdl-4à
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="beans.new_booklistBean,beans.ConnBean"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>删除图书统计</title>
</head>
<body>
<p>
<jsp:useBean id="conn" scope="session" class="beans.new_libraryDBean"/>
<form action="" method="post">
<table border="1">
<caption>图书列表</caption>
<tr>
<th>图书编号</th>
<th>书名</th>
<th>作者</th>
<th>书类</th>
<th>书架号</th>
<th>价格</th>
<th>借阅次数</th>
<th>选择</th>
</tr>
<%
new_booklistBean[] records=conn.getAllRecords();
if(records!=null){
for(int i=0;i<records.length;i++){
out.println("<tr>");
out.println("<td>"+records[i].getbookID()+"</td>");
out.println("<td>"+records[i].getbookName()+"</td>");
out.println("<td>"+records[i].getauother()+"</td>");
out.println("<td>"+records[i].getbookType()+"</td>");
out.println("<td>"+records[i].getbookCase()+"</td>");
out.println("<td>"+records[i].getprice()+"</td>");
out.println("<td>"+records[i].getborrowSum()+"</td>");
%>
<td>
<input type="checkbox" name="<%="check"+i%>" value="<%=i%>" />
</td>
<%
out.println("</tr>");
}
}
%>
</table>
<input type="submit" value="提交"/>
</form>
<%
String[] check=new String[records.length];
for(int i=0;i<check.length;i++){
check[i]=request.getParameter("check"+i);
if(check[i]==null)
check[i]="";
if(check[i].equals(""+i)){
if(conn.deleteRecord(records[i])){
out.println("<hr>删除成功");
response.setHeader("refresh","1");
}
}
}
%>
</p>
</body>
</html>
和系统相关bean代码:
New_booklistBean
package beans;
public class new_booklistBean {
private String bookID;//表示书编号;
private String bookName;//书名;
private String auother;//作者名;
private int bookType;//书类;
private int bookCase;//书架号;
private int price;//书价;
private int borrowSum;//书被借次数;
public String getbookID() {
return bookID;
}
public void setbookID(String bookID) {
this.bookID = bookID;
}
public String getbookName() {
return bookName;
}
public void setbookName(String bookName) {
this.bookName = bookName;
}
public String getauother() {
return auother;
}
public void setauother(String auother) {
this.auother = auother;
}
public int getbookType() {
return bookType;
}
public void setbookType(int bookType) {
this.bookType = bookType;
}
public int getbookCase() {
return bookCase;
}
public void setbookCase(int bookCase) {
this.bookCase = bookCase;
}
public int getprice() {
return price;
}
public void setprice(int price) {
this.price = price;
}
public int getborrowSum() {
return borrowSum;
}
public void setborrowSum(int borrowSum) {
this.borrowSum = borrowSum;
}
}
ConnBean
package beans;
import java.sql.*; //导入jdbc;
public class ConnBean {
private String driver="sun.jdbc.odbc.JdbcOdbcDriver";//默认驱动程序为jdbc-odbc驱动;
private String jdbcurl="jdbc:odbc:";//jdbcurl
private String database="new_booklist";//数据库或数据源
private String userName="root";//用户名
private String password="123456";//密码
private Connection connection=null;
public Connection getConnection() {
try{
Class.forName(driver);//注册驱动程序;
connection=DriverManager.getConnection("jdbc:odbc:new_booklist","","");//建立连接;
}catch(ClassNotFoundException e1){
e1.printStackTrace();
}catch(SQLException e2){
e2.printStackTrace();
}
return connection;
}
public void closeConnection(Connection connection){//关闭连接;
try{
if(connection!=null)
connection.close();
connection=null;
}catch(SQLException e3){
e3.printStackTrace();
}
}
public void closePstmt(PreparedStatement pstmt){//关闭实施语句;
try{
if(pstmt!=null)
pstmt.close();
pstmt=null;
}catch(SQLException e){
e.printStackTrace();
}
}
public void closeResultSet(ResultSet rs){//关闭结果集语句;
try{
if(rs!=null)
rs.close();
rs=null;
}catch(SQLException e){
e.printStackTrace();
}
}
public String getDriver() {//获取驱动程序
return driver;
}
public void setDriver(String driver) {
this.driver = driver;
}
public String getDatabase() {
return database;
}
public void setDatabase(String database) {
this.database = database;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getJdbcurl() {
return jdbcurl;
}
public void setJdbcurl(String url) {
this.jdbcurl = url;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
New_libraryBean
package beans;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
public class new_libraryDBean extends ConnBean{
private Connection connection=null;
public new_booklistBean[] getAllRecords(){//获取全部统计
ResultSet rs=null;
PreparedStatement pstmt=null;
Collection list=new ArrayList();
try{
connection=getConnection();
pstmt=connection.prepareStatement("select * from new_booklist");//数据表new_booklist
rs=pstmt.executeQuery();
while(rs.next()){
new_booklistBean new_booklist=new new_booklistBean();
new_booklist.setbookID(rs.getString(1));
new_booklist.setbookName(rs.getStr
展开阅读全文