JAVA设计文档-图书管理系统(共19页).doc

上传人:飞****2 文档编号:16633693 上传时间:2022-05-18 格式:DOC 页数:19 大小:263KB
返回 下载 相关 举报
JAVA设计文档-图书管理系统(共19页).doc_第1页
第1页 / 共19页
JAVA设计文档-图书管理系统(共19页).doc_第2页
第2页 / 共19页
点击查看更多>>
资源描述

《JAVA设计文档-图书管理系统(共19页).doc》由会员分享,可在线阅读,更多相关《JAVA设计文档-图书管理系统(共19页).doc(19页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、精选优质文档-倾情为你奉上目 录1 绪论1.1课题背景 图书管理系统以方便、快捷、费用低的优点正慢慢地进入人们的生活,将传统的图书管理方式彻底地解脱出来,提高效率,减轻工作人员以往繁忙的工作,减小出错的概率,使读者可以花更多的时间在选择书和看书上。从而使人们有更多时间来获取信息、了解信息和掌握信息。一个好的图书馆不仅仅看它的藏书的种类和数量是否齐全,还要看它的管理机制是否健全。本系统根据图书馆的日常业务运作而设计,更好的管理借书,还书,统计图书类别等业务,系统操作流程与图书馆的业务流程相一致。界面友好、操作容易、维护简单;系统数据库稳定、安全,有图书管理业务操作知识的人皆能方便操作。1.2系统

2、开发关键技术介绍此模型具有架构清晰、模块独立性强、以及易维护和扩展等优点,采用Eclipse作为前端开发工具,后台用SQL Server 2000实现数据存取,另外还通过存储过程的实现把一些处理放在数据库端执行,使的数据存取效率大大提高,系统的性能也得以提升。通过Java 类连接数据库,为各种常用数据库提供无缝联接的技术。2 系统分析2.1 图书管理工作流程系统完成就图书借阅管理的借书、还书、操作;书籍、学生、借阅记录的查阅、添加、更新及删除等功能,此外系统还具备管理员注册管理等功能。能更好的对图书进行分类管理,提高了利用率,为读者借阅提供方便。2.2 图书管理需求图书馆要求能随时查询书库中图

3、书的库存量,以便及时准确、及时、方便地为读者提供借阅信息,但不能修改数据,无信息处理权,即可以打印清单、浏览数据等,管理权限由系统管理员掌握和分配。图书管理系统以方便、快捷、费用低的优点正慢慢地进入人们的生活,将传统的图书管理方式彻底的解脱出来,提高效率,减轻工作人员以往繁忙的工作,减小出错的概率,使读者可以花更多的时间在选择书和看书上。从而使人们有更多时间来获取信息、了解信息、掌握信息。图书馆作为提供学习的场所,不仅要求便于管理,而且要求对读者和借阅者提供方便快速的查找,借阅和登记手续。3 系统设计3.1 设计思想(1) 进行合理的需求分析,用Eclipse实现前台的应用程序框架。(2) 详

4、细的数据库系统设计,用SQL Server 2000实现数据存取。(3) 选择合理的数据库连接。3.2 系统功能结构图3.3模块功能设计 (1)管理员注册模块:填写注册的用户名和密码,就可以完成注册,主要是为了管理的方便,添加了该模块。(2)图书查询模块:完成以图书名称,索引号,图书编号,模糊查询,分类名,出版社进行查询,考虑到用户的方便性,本查询,除了索引号和图书编号进行查询外,全部采用模糊查询。大大的方便了借阅者的查询。 (3)读者查询模块:通过输入要查询读者的借阅证号或者姓名,将符合其一要求的信息查询并显示在下面的图标中。采用图标显示的方式,在查到的信息内容之上显示相应的数据的标题,便于

5、用户的理解。4 系统数据库设计4.1系统数据库的建立该系统采用C/S模式设计,数据库部分同应用程序一样起着至关重要的作用,因此必须对数据库进行详细的设计。该系统使用SQL Server 2000数据库,首先应以保证数据的独立性和一致性作为出发点,避免数据冗余,在设计方面,把数据库分模块相应内容存在相应的数据库中。 4.2 系统E-R图 E-R模型分类号绍图书数量入库日期分类名图书名称管理图书用户名作者借还ISBN码密码管理人员出版社姓名读者有效日期性别注册日期读者类别读者单位借阅证号读者编号4.3 各个数据表的创建数据库共有六个表,分别包括:书籍表(book),借书表 (borrow),登陆表

6、 (login),读者信息表 (reader),图书分类信息表(index),读者类别表(reader_class)4.3.1、书籍表(book)列名数据类型长度允许为空默认值字段名说明Bannercodevarchar30图书编号唯一约束Booknamevarchar30图书名称自动增长Searchcodevarchar30索书号ISBNunm varchar30ISBN号Kindnumvarchar3分类号kindnamevarchar30分类名positionnumvarchar30排架号publishingcompanyvarchar30出版社publishtimeDate出版日期YY

7、YY-MM_DDstateVarchar4在架状态BooknumInt4图书数量authorvarchar30作者4.3.2、登陆表 (login)列名数据类型长度允许为空默认值字段名说明usernamevarchar30用户名主键,自动增长pswVarchar30密码4.3.3、图书分类信息表(index)列名数据类型长度允许为空默认值字段名说明kindnumvarchar30分类号kindbookvarchar30图书种类4.4 数据库的连接DBAccess.javapackage com.book.Dbconn; import java.sql.Connection;import jav

8、a.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement; public class DBAccess private Connection m_conn; private Statement m_stmt; private String driver = com.microsoft.jdbc.sqlserver.SQLServerDriver; private String url = jdbc:microsoft:sqlserver:/localh

9、ost:1433;databasename=bookmanage; private String uName = sa; private String uPwd = sa; public DBAccess() this.setDriver(driver); this.setConnection(url, uName, uPwd); public DBAccess(String driver, String url, String userName, String userPWD) try m_conn = DriverManager.getConnection(url, userName, u

10、serPWD); m_stmt = m_conn.createStatement(); catch (SQLException e) e.printStackTrace(); public boolean setDriver(String driver) try Class.forName(driver); return true; catch (Exception e) e.printStackTrace(); return false; public boolean setConnection(String url, String userName, String userPWD) try

11、 m_conn = DriverManager.getConnection(url, userName, userPWD); m_stmt = m_conn.createStatement(); return true; catch (Exception e) e.printStackTrace(); return false; public ResultSet sendQuery(String sql) try ResultSet m_rs = m_stmt.executeQuery(sql); return m_rs; catch (SQLException e) e.printStack

12、Trace(); return null; public int sendUpdate(String sql) try return m_stmt.executeUpdate(sql); catch (SQLException e) e.printStackTrace(); return -1; public static void main(String arg) DBAccess db = new DBAccess(); String sql = select * from book; ResultSet rs = db.sendQuery(sql); try if (rs != null

13、) while (rs.next() System.out.println(rs.getString(Bookname); catch (SQLException e) e.printStackTrace(); 5 系统实现5.1 系统实现工具与支持平台(1) 用户界面本系统采用Eclipse设计,用户交互界面采用的是基于Windows的窗口界面。(2) 硬件接口运行本系统的硬件基本要求如下:CPU:Intel P4及以上;内存:512MB及以上;硬盘:80GB及以上。(3) 软件接口数据库服务器:SQL Server 2000。5.2系统界面及其实现方法1.下面为运行后的界面图: 实现如下:

14、 Mainwin.java public class mainwin private ButtonGroup buttonGroup = new ButtonGroup();private JFrame frame; public static void main(String args) try mainwin window = new mainwin();window.frame.setVisible(true); catch (Exception e) e.printStackTrace();public mainwin() createContents();private void c

15、reateContents() frame = new JFrame();frame.setTitle(欢迎访问图书管理系统);frame.getContentPane().setLayout(null);frame.setBounds(100, 100, 700, 500);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);final JLabel label = new JLabel();label.setForeground(new Color(0, 128, 0);label.setFont(new Font(仿宋_GB2312,

16、 Font.PLAIN, 14);label.setText(用户名:);label.setBounds(38, 76, 58, 18);frame.getContentPane().add(label);final JTextField textField = new JTextField();textField.setBounds(92, 75, 92, 20);frame.getContentPane().add(textField);final JLabel label_1 = new JLabel();label_1.setForeground(new Color(0, 128, 0

17、);label_1.setFont(new Font(仿宋_GB2312, Font.PLAIN, 14);label_1.setText(密 码:);label_1.setBounds(225, 76, 59, 18);frame.getContentPane().add(label_1);final JPasswordField passwordField = new JPasswordField();passwordField.setBounds(290, 77, 92, 18);frame.getContentPane().add(passwordField);final JButto

18、n button = new JButton();button.addActionListener(new ActionListener() public void actionPerformed(final ActionEvent arg0) if(textField.getText().equals() |passwordField.getText().equals()JOptionPane.showMessageDialog(null, 请输入用户名和密码!);elseString sql = select count(*) from login where username=+text

19、Field.getText()+ and psw=+passwordField.getText()+;DBAccess db = new DBAccess();ResultSet rs = db.sendQuery(sql);try if(rs != null)if(rs.next() & rs.getInt(1)0)ManageMain manageMain = new ManageMain();manageMain.getFrame().setVisible(true);getFrame().setVisible(false);elseJOptionPane.showMessageDial

20、og(null, 用户名或密码错误!); catch (SQLException e) / TODO Auto-generated catch blocke.printStackTrace();finallytry rs.close(); catch (SQLException e) / TODO Auto-generated catch blocke.printStackTrace(););button.setText(登陆);button.setBounds(429, 76, 66, 18);frame.getContentPane().add(button);final JButton

21、button_1 = new JButton();button_1.addActionListener(new ActionListener() public void actionPerformed(final ActionEvent arg0) ManagerAdd managerAdd = new ManagerAdd();managerAdd.getFrame().setVisible(true); getFrame().setVisible(false););button_1.setText(注册);button_1.setBounds(560, 76, 66, 18);frame.

22、getContentPane().add(button_1);final JRadioButton radioButton = new JRadioButton();radioButton.setForeground(new Color(0, 128, 0);radioButton.setFont(new Font(仿宋_GB2312, Font.PLAIN, 14);radioButton.setText(图书名称);buttonGroup.add(radioButton);radioButton.setBounds(35, 125, 84, 26);frame.getContentPane

23、().add(radioButton);final JRadioButton radioButton_1 = new JRadioButton();radioButton_1.setForeground(new Color(0, 128, 0);radioButton_1.setFont(new Font(仿宋_GB2312, Font.PLAIN, 14);buttonGroup.add(radioButton_1);radioButton_1.setText(索引号);radioButton_1.setBounds(141, 125, 77, 26);frame.getContentPan

24、e().add(radioButton_1);final JRadioButton radioButton_2 = new JRadioButton();radioButton_2.setForeground(new Color(0, 128, 0);radioButton_2.setFont(new Font(仿宋_GB2312, Font.PLAIN, 14);buttonGroup.add(radioButton_2);radioButton_2.setText(图书编号);radioButton_2.setBounds(246, 125, 92, 26);frame.getConten

25、tPane().add(radioButton_2);final JRadioButton radioButton_3 = new JRadioButton();radioButton_3.setForeground(new Color(0, 128, 0);radioButton_3.setFont(new Font(仿宋_GB2312, Font.PLAIN, 14);buttonGroup.add(radioButton_3);radioButton_3.setText(模糊查询);radioButton_3.setBounds(352, 125, 92, 26);frame.getCo

26、ntentPane().add(radioButton_3);final JRadioButton radioButton_4 = new JRadioButton();radioButton_4.setForeground(new Color(0, 128, 0);radioButton_4.setFont(new Font(仿宋_GB2312, Font.PLAIN, 14);buttonGroup.add(radioButton_4);radioButton_4.setText(分类名);radioButton_4.setBounds(462, 125, 77, 26);frame.ge

27、tContentPane().add(radioButton_4);final JRadioButton radioButton_5 = new JRadioButton();radioButton_5.setForeground(new Color(0, 128, 0);radioButton_5.setFont(new Font(仿宋_GB2312, Font.PLAIN, 14);buttonGroup.add(radioButton_5);radioButton_5.setText(出版社);radioButton_5.setBounds(569, 125, 77, 26);frame

28、.getContentPane().add(radioButton_5);final JTextField textField_1 = new JTextField();textField_1.setBounds(45, 162, 270, 22);frame.getContentPane().add(textField_1);final JLabel label_2 = new JLabel();label_2.setForeground(new Color(0, 0, 255);label_2.setFont(new Font(仿宋_GB2312, Font.PLAIN, 15);labe

29、l_2.setText(请选择查询);label_2.setBounds(25, 105, 84, 18);frame.getContentPane().add(label_2);final JTable table = new JTable();table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);table.setName(图书管理系统);table.setBounds(10, 219, 676, 247);frame.getContentPane().add(table);final JLabel label_5 = new JLabel();l

30、abel_5.setForeground(new Color(255, 0, 255);label_5.setFont(new Font(仿宋_GB2312, Font.PLAIN, 36);label_5.setText(欢迎使用本图书管理系统);label_5.setBounds(133, 9, 406, 60);frame.getContentPane().add(label_5);final JButton button_2 = new JButton();button_2.setAutoscrolls(true);button_2.addActionListener(new Acti

31、onListener() public void actionPerformed(final ActionEvent arg0) Stringsql = null;if(textField_1.getText().equals()JOptionPane.showMessageDialog(null, 请输入查询内容!);elseif(radioButton.isSelected()sql = select * from book where bookname like %+textField_1.getText()+%;else if(radioButton_1.isSelected()sql

32、 = select * from book where searchcode = +textField_1.getText()+;else if(radioButton_2.isSelected()sql = select * from book where bannercode = +textField_1.getText()+;else if(radioButton_3.isSelected()sql = select * from book where bookname like %+textField_1.getText()+%;else if(radioButton_4.isSele

33、cted()sql = select * from book where kindname like %+textField_1.getText()+%;else if(radioButton_5.isSelected()sql = select * from book where publishingcompany like %+textField_1.getText()+%;elseJOptionPane.showMessageDialog(null, 请选择查询方法!);return;DBAccess db = new DBAccess();ResultSet rs = db.sendQ

34、uery(sql);/*/boolean hasRecords;try hasRecords = rs.next(); if (!hasRecords) / 记录集为空,提示一条消息 JOptionPane.showMessageDialog(table, 无相关记录,请检查输入!, ,JOptionPane.ERROR_MESSAGE); return; catch (SQLException e) e.printStackTrace();Vector columnHeads = new Vector(); Vector rows = new Vector();/ 用于存储记录行 try R

35、esultSetMetaData rsmd = rs.getMetaData(); for (int i = 1; i = rsmd.getColumnCount(); +i) columnHeads.addElement(rsmd.getColumnName(i); do / 获取记录集 rows.addElement(getNextRow(rs, rsmd); while (rs.next(); / 建立相应的TableModel,并将TableModel应用到Table中显示出来 DefaultTableModel model = new DefaultTableModel(rows,

36、columnHeads); table.setModel(model); return; catch (SQLException exc) JOptionPane.showMessageDialog(table, exc.toString(),查询失败!, JOptionPane.ERROR_MESSAGE); return; );button_2.setText(查询);button_2.setBounds(532, 162, 92, 22);frame.getContentPane().add(button_2);2.下图为查询读者的信息图实现代码如下:UserInfo .javapubl

37、ic class UserInfo private JFrame frame;public static void main(String args) try UserInfo window = new UserInfo();window.frame.setVisible(true); catch (Exception e) e.printStackTrace();public UserInfo() createContents();private void createContents() frame = new JFrame();frame.getContentPane().setLayo

38、ut(null);frame.setBounds(100, 100, 700, 500);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);final JLabel label = new JLabel();label.setForeground(new Color(255, 0, 255);label.setFont(new Font(仿宋_GB2312, Font.BOLD, 36);label.setText(查 询 借 阅 者 信 息);label.setBounds(125, 24, 412, 47);frame.getCont

39、entPane().add(label);final JLabel label_7 = new JLabel();label_7.setForeground(new Color(0, 0, 255);label_7.setFont(new Font(仿宋_GB2312, Font.PLAIN, 12);label_7.setText(请输入借阅证号和姓名);label_7.setBounds(377, 77, 135, 28);frame.getContentPane().add(label_7);final JLabel label_1 = new JLabel();label_1.setForeground(new Color(0, 128, 0);label_1.setFont(new Font(仿宋_GB2312, Font.PLAIN, 14);label_1.setText(借阅证号*:);label_1.setBounds(77, 155, 77, 18);frame.getContentPane().add(label_1);final JLabel label_2 = new JLabel();label_2.setForeground(new Color(0, 128, 0);label_2.setFont(new Font

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 教案示例

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁