• 大小: 117KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2022-08-14
  • 语言: Java
  • 标签:

资源简介

java+JFrame+sqlServer 图书管理系统

资源截图

代码片段和文件信息

package com.ZL.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import org.omg.CORBA.FloatHolder;

import com.ZL.model.Book;
import com.ZL.util.StringUtil;

public class BookDao {

//添加操作
public int bookAdd(Connection conBook book) throws Exception{
String sql=“insert into t_book values(??????)“;
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setString(1 book.getBookName());
pstmt.setString(2 book.getAuthor());
pstmt.setString(3 book.getBookPublish());
pstmt.setFloat(4 book.getPrice());
pstmt.setString(5 book.getBookDesc());
pstmt.setInt(6 book.getBookTypeId());
return pstmt.executeUpdate();
}


//查找遍历
public ResultSet bookList(Connection conBook book)throws Exception{
//关联查询

StringBuffer sb=new StringBuffer(“select * from t_book bt_bookType bt where b.bookTypeId=bt.id“);
if(StringUtil.isNotEmpty(book.getBookName())){
sb.append(“ and b.bookName like ‘%“+book.getBookName()+“%‘“);
}
if(StringUtil.isNotEmpty(book.getAuthor())){
sb.append(“ and b.author like ‘%“+book.getAuthor()+“%‘“);
}
if(StringUtil.isNotEmpty(book.getBookPublish())){
sb.append(“ and b.bookPublish = ‘%“+book.getBookPublish()+“%‘“);
}
if(book.getBookTypeId()!=-1){
sb.append(“ and b.bookTypeId = “+book.getBookTypeId());
}
PreparedStatement pstmt=con.prepareStatement(sb.toString());
return pstmt.executeQuery();
}


//删除
public int bookDelete(Connection conString 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 bookModify(Connection con Book book) throws Exception{
String sql = “Update t_book set bookName=? author=?bookPublish=?price=?bookDesc=?bookTypeId=? where id=?“;
PreparedStatement pstmt = con.prepareStatement(sql);

pstmt.setString(1 book.getBookName());
pstmt.setString(2 book.getAuthor());
pstmt.setString(3 book.getBookPublish());
pstmt.setFloat(4 book.getPrice());
pstmt.setString(5 book.getBookDesc());
pstmt.setInt(6 book.getBookTypeId());
pstmt.setInt(7 book.getId());
return pstmt.executeUpdate();
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-12-09 20:16  BookManger\
     文件         388  2016-12-09 20:36  BookManger\.classpath
     文件         386  2016-12-09 20:17  BookManger\.project
     目录           0  2016-12-09 20:16  BookManger\.settings\
     文件         598  2016-12-09 20:16  BookManger\.settings\org.eclipse.jdt.core.prefs
     目录           0  2016-12-21 18:27  BookManger\bin\
     目录           0  2016-12-21 18:27  BookManger\bin\com\
     目录           0  2016-12-21 18:27  BookManger\bin\com\ZL\
     目录           0  2016-12-21 18:28  BookManger\bin\com\ZL\dao\
     文件        2919  2016-12-21 18:28  BookManger\bin\com\ZL\dao\BookDao.class
     文件        2527  2016-12-21 18:27  BookManger\bin\com\ZL\dao\BookTypeDao.class
     文件        2183  2016-12-21 18:27  BookManger\bin\com\ZL\dao\BorrowDao.class
     文件        2026  2016-12-21 18:27  BookManger\bin\com\ZL\dao\StudentDao.class
     文件        1573  2016-12-21 18:27  BookManger\bin\com\ZL\dao\UserDao.class
     目录           0  2016-12-21 18:27  BookManger\bin\com\ZL\model\
     文件        2634  2016-12-21 18:27  BookManger\bin\com\ZL\model\Book.class
     文件        1344  2016-12-21 18:27  BookManger\bin\com\ZL\model\BookType.class
     文件        1618  2016-12-21 18:27  BookManger\bin\com\ZL\model\Student.class
     文件        1061  2016-12-21 18:27  BookManger\bin\com\ZL\model\User.class
     目录           0  2016-12-21 18:27  BookManger\bin\com\ZL\util\
     文件        1694  2016-12-21 18:27  BookManger\bin\com\ZL\util\DButil.class
     文件         667  2016-12-21 18:27  BookManger\bin\com\ZL\util\StringUtil.class
     目录           0  2016-12-21 18:27  BookManger\bin\com\ZL\view\
     文件         745  2016-12-21 18:27  BookManger\bin\com\ZL\view\BookAddFrm$1.class
     文件        3266  2016-12-21 18:27  BookManger\bin\com\ZL\view\BookAddFrm$2.class
     文件         708  2016-12-21 18:27  BookManger\bin\com\ZL\view\BookAddFrm$3.class
     文件        7554  2016-12-21 18:27  BookManger\bin\com\ZL\view\BookAddFrm.class
     文件         913  2016-12-21 18:27  BookManger\bin\com\ZL\view\BookManageInterFrm$1.class
     文件         741  2016-12-21 18:27  BookManger\bin\com\ZL\view\BookManageInterFrm$2.class
     文件         825  2016-12-21 18:27  BookManger\bin\com\ZL\view\BookManageInterFrm$3.class
     文件         775  2016-12-21 18:27  BookManger\bin\com\ZL\view\BookManageInterFrm$4.class
............此处省略75个文件信息

评论

共有 条评论