当前位置:首页>> >>


唐国鹏_图书管理系统_源代码.rar

收藏

资源目录
    文档预览:
    编号:20181030003659118    类型:共享资源    大小:1.13MB    格式:RAR    上传时间:2018-10-30
    尺寸:148x200像素    分辨率:72dpi   颜色:RGB    工具:   
    35
    金币
    关 键 词:
    唐国鹏 图书 管理 系统 源代码
    资源描述:
    课 程 设 计 报 告 书(理工类)课程名称 Java 基础实训 姓 名 唐国鹏 班 级 17 软嵌 2 班 ______ 学 号 1712011040 指导教师 濮宏伟____________ 金陵科技学院2018.71题目:图书管理系统设计的目的和要求:目的:本次课程设计目的是使学生结合ArrayList、Vector集合和Java swing可视化编程以及所学的Java知识,熟练使用Eclipse工具系统模块开发,通过真实的工作任务(项目需求)和规范,使学生能设计并开发出具有一定水平的系统模块,并培养解决实际问题和培养团队合作的能力。掌握系统模块开发流程和开发技巧,按要求提交规范的交付物。具体的课程设计应达到以下目的:1.提高学生在现实生活中收集需求信息,对需求进行评估,进行需求整理、加工的能力。2.在实际的项目任务中培养系统模块开发的技能。3.在实际的项目任务中编程、调试、测试能力得到提高。4. 在实际的项目任务中使学生的编码规范性得到提高。5.培养学生团队协作和人际交往方面的能力。设计的软件环境:奔腾以上计算机,Windows7 操作系统,装有 JDK1.8和 Eclipse软件。2功能模块设计:登陆页面:登陆者输入信息来匹配数据库预存信息,成功登陆,失败提示。关于我们:开发者可以根据需要添加需要使用者了解的信息。基础数据维护:分为三个模块(1)安全退出:使用者可以通过点击安全退出来销毁页面结束程序;(2)图书类别管理:(A)图书类别添加:使用者可以根据需要添加图书的类别;(B)图书类别维护:使用者在此页面可以对已有的图书类别进行增减和描述补充;(3)图书管理:(A)图书添加:使用者可以在已知类别下添加相应的图书信息,如书名,作者,作者性别,图书类别等;(B)图书维护:使用者在此页面可以对添加的图书进行增减和修正。3设计过程和内容:package com.java1234.dao;import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;import com.java1234.model.Book;import com.java1234.util.StringUtil;/*** 图书 Dao类* @author tangg**/public class BookDao {/*** 图书添加* @param con* @param book* @return* @throws Exception*/public int add(Connection con,Book book)throws Exception{String sql=“insert into t_book values(null,?,?,?,?,?,?)“;PreparedStatement pstmt=con.prepareStatement(sql);pstmt.setString(1, book.getBookName());pstmt.setString(2, book.getAuthor());pstmt.setString(3, book.getSex());pstmt.setFloat(4, book.getPrice());pstmt.setInt(5, book.getBookTypeId());pstmt.setString(6, book.getBookDesc());return pstmt.executeUpdate();}/*** 图书信息查询* @param con* @param book* @return* @throws Exception*/public ResultSet list(Connection con,Book book)throws Exception{56StringBuffer sb=new StringBuffer(“select * from t_book b,t_bookType bt where b.bookTypeId=bt.id“);if(!StringUtil.isEmpty(book.getBookName())){sb.append(“ and b.bookName like '%“+book.getBookName()+“%'“);}if(!StringUtil.isEmpty(book.getAuthor())){sb.append(“ and b.author like '%“+book.getAuthor()+“%'“);}if(book.getBookTypeId()!=null }PreparedStatement pstmt=con.prepareStatement(sb.toString());return pstmt.executeQuery();}/*** 图书信息删除* @param con* @param id* @return* @throws Exception*/public int delete(Connection con,String id)throws Exception{String sql=“delete from t_book where id=?“;PreparedStatement pstmt=con.prepareStatement(sql);pstmt.setString(1, id);return pstmt.executeUpdate();}public int update(Connection con,Book book)throws Exception{String sql=“update t_book set bookName=?,author=?,sex=?,price=?,bookDesc=?,bookTypeId=? where id=?“;PreparedStatement pstmt=con.prepareStatement(sql);pstmt.setString(1, book.getBookName());pstmt.setString(2, book.getAuthor());pstmt.setString(3, book.getSex());pstmt.setFloat(4, book.getPrice());pstmt.setString(5, book.getBookDesc());pstmt.setInt(6, book.getBookTypeId());pstmt.setInt(7, book.getId());return pstmt.executeUpdate();}/*** 指定图书类别下是否存在图书57* @param con* @param bookTypeId* @return* @throws Exception*/public boolean existBookByBookTypeId(Connection con,String bookTypeId)throws Exception{String sql=“select * from t_book where bookTypeId=?“;PreparedStatement pstmt=con.prepareStatement(sql);pstmt.setString(1, bookTypeId);ResultSet rs=pstmt.executeQuery();return rs.next();}}package com.java1234.dao;import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;import com.java1234.model.BookType;import com.java1234.util.StringUtil;/*** 图书类别 Dao类* @author tangg**/public class BookTypeDao {/*** 图书类别添加* @param con* @param bookType* @return* @throws Exception*/public int add(Connection con,BookType bookType)throws Exception{String sql=“insert into t_bookType values(null,?,?)“;PreparedStatement pstmt=con.prepareStatement(sql);pstmt.setString(1, bookType.getBookTypeName());pstmt.setString(2, bookType.getBookTypeDesc());58return pstmt.executeUpdate();}/*** 查询图书类别集合* @param con* @param bookType* @return* @throws Exception*/public ResultSet list(Connection con,BookType bookType)throws Exception{StringBuffer sb=new StringBuffer(“select * from t_bookType “);if(!StringUtil.isEmpty(bookType.getBookTypeName())){sb.append(“and bookTypeName like '%“+bookType.getBookTypeName()+“%'“);}PreparedStatement pstmt=con.prepareStatement(sb.toString().replaceFirst(“and“,“where“));return pstmt.executeQuery();}/*** 删除图书类别* @param con* @param id* @return* @throws Exception*/public int delete(Connection con,String id)throws Exception{String sql=“delete from t_bookType where id=?“;PreparedStatement pstmt=con.prepareStatement(sql);pstmt.setString(1, id);return pstmt.executeUpdate();}/*** 更新图书类别* @param con* @param bookType* @return* @throws Exception*/public int update(Connection con,BookType bookType)throws Exception{String sql=“update t_bookType set bookTypeName=?,bookTypeDesc=? where id=?“;PreparedStatement pstmt=con.prepareStatement(sql);pstmt.setString(1, bookType.getBookTypeName());pstmt.setString(2, bookType.getBookTypeDesc());;59pstmt.setInt(3, bookType.getId());return pstmt.executeUpdate();}}package com.java1234.dao;import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;import com.java1234.model.User;/*** 用户 Dao类* @author**/public class UserDao {/*** 登陆验证* @param con* @param user* @return* @throws Exception*/public User login(Connection con,User user)throws Exception{User resultUser=null;String sql=“select * from t_user where userName=? and password=?“;PreparedStatement pstmt=con.prepareStatement(sql);pstmt.setString(1, user.getUserName());pstmt.setString(2, user.getPassword());ResultSet rs=pstmt.executeQuery();if(rs.next()){resultUser=new User();resultUser.setId(rs.getInt(“id“));resultUser.setUserName(rs.getString(“userName“));resultUser.setPassword(rs.getString(“password“));}return resultUser;}}60package com.java1234.model;/*** 图书实体* @author tangg**/public class Book {private int id;private String bookName;private String author;private String sex;private Float price;private Integer bookTypeId;private String bookTypeName;private String bookDesc;public Book(int id, String bookName, String author, String sex, Float price, Integer bookTypeId, String bookDesc) {super();this.id = id;this.bookName = bookName;this.author = author;this.sex = sex;this.price = price;this.bookTypeId = bookTypeId;this.bookDesc = bookDesc;}public Book() {super();// TODO Auto-generated constructor stub}public Book(String bookName, String author, String sex, Float price, Integer bookTypeId, String bookDesc) {61super();this.bookName = bookName;this.author = author;this.sex = sex;this.price = price;this.bookTypeId = bookTypeId;this.bookDesc = bookDesc;}public Book(String bookName, String author, Integer bookTypeId) {super();this.bookName = bookName;this.author = author;this.bookTypeId = bookTypeId;}public int getId() {return id;}public void setId(int id) {this.id = id;}public String getBookName() {return bookName;}public void setBookName(String bookName) {this.bookName = bookName;}public String getAuthor() {return author;}public void setAuthor(String author) {this.author = author;}public String getSex() {return sex;}public void setSex(String sex) {this.sex = sex;}public Float getPrice() {return price;
    展开阅读全文
    1
      金牌文库所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
    0条评论

    还可以输入200字符

    暂无评论,赶快抢占沙发吧。

    关于本文
    本文标题:唐国鹏_图书管理系统_源代码.rar
    链接地址:http://www.gold-doc.com/p-255345.html
    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服客服 - 联系我们
    [email protected] 2014-2018 金牌文库网站版权所有
    经营许可证编号:浙ICP备15046084号-3
    收起
    展开