• 大小: 13.29MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-14
  • 语言: Java
  • 标签:

资源简介

java GUI图书管理系统,mysql,可以运行,代码齐全,有问题欢迎联系

资源截图

代码片段和文件信息

package com.hellozepp.dao;

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

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

public class BookDao {

    /**
     * 添加图书
     *
     * @param con
     * @param book
     * @return
     * @throws Exception
     */
    public int bookAdd(Connection con Book book) throws Exception {
        String sql = “insert into t_book values(null?????????0)“;
        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.setString(7 book.getPress());
        pstmt.setInt(8 book.getCopies());
        pstmt.setFloat(9 book.getPurchasePrice());
        return pstmt.executeUpdate();
    }

    public ResultSet bookList(Connection con Book book) throws Exception {
        StringBuffer sb = new StringBuffer(“select * from t_book bt_bookType bt where b.bookTypeId=bt.id and b.deleted =‘0‘ “);
        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.getSex())) {
            sb.append(“ and b.sex = ‘“ + book.getSex() + “‘“);
        }
        if (book.getBookTypeId() != -1) {
            sb.append(“ and b.bookTypeId = “ + book.getBookTypeId());
        }

        PreparedStatement pstmt = con.prepareStatement(sb.toString());
        return pstmt.executeQuery();
    }

    public int bookDelete(Connection con String id) throws Exception {
        String sql = “update t_book set deleted = ‘1‘ 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=?sex=?price=?bookDesc=?bookTypeId=?press=?copies=?purchasePrice=? 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(10 book.getId());
        pstmt.setString(7 book.getPress());
        pstmt.setInt(8 book.getCopies()==null?0:book.getCopies());
        pstmt.setFloat(9 book.getPurchasePrice());
        return pstmt.executeUpdate();
    }

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-12-28 19:44  BookManger\
     文件        6148  2018-12-26 01:21  BookManger\.DS_Store
     目录           0  2019-01-04 19:09  __MACOSX\
     目录           0  2019-01-04 19:09  __MACOSX\BookManger\
     文件         120  2018-12-26 01:21  __MACOSX\BookManger\._.DS_Store
     目录           0  2018-12-27 12:51  BookManger\sqlFile\
     文件        5044  2018-12-27 12:50  BookManger\sqlFile\book.sql
     文件       51712  2018-12-24 22:43  BookManger\Java璇捐(缃戠粶).doc
     文件         494  2018-12-24 22:43  __MACOSX\BookManger\._Java璇捐(缃戠粶).doc
     目录           0  2018-12-26 23:00  BookManger\bin\
     文件        6148  2018-12-26 01:21  BookManger\bin\.DS_Store
     目录           0  2018-12-26 23:00  BookManger\bin\sqlFile\
     文件        4986  2018-12-26 10:39  BookManger\bin\sqlFile\book.sql
     目录           0  2018-12-26 23:00  BookManger\bin\out\
     目录           0  2018-12-26 23:00  BookManger\bin\out\production\
     目录           0  2018-12-26 23:00  BookManger\bin\out\production\BookManger\
     目录           0  2018-12-26 23:00  BookManger\bin\out\production\BookManger\com\
     目录           0  2018-12-26 23:00  BookManger\bin\out\production\BookManger\com\hellozepp\
     目录           0  2018-12-26 23:00  BookManger\bin\out\production\BookManger\com\hellozepp\util\
     目录           0  2018-12-26 23:00  BookManger\bin\out\production\BookManger\com\hellozepp\dao\
     目录           0  2018-12-26 23:00  BookManger\bin\out\production\BookManger\com\hellozepp\model\
     目录           0  2018-12-26 23:00  BookManger\bin\out\production\BookManger\com\hellozepp\model\Enum\
     目录           0  2018-12-26 23:00  BookManger\bin\out\production\BookManger\com\hellozepp\view\
     目录           0  2018-12-26 23:00  BookManger\bin\out\production\BookManger\com\hellozepp\view\image\
     文件         676  2018-12-26 12:59  BookManger\bin\out\production\BookManger\com\hellozepp\view\image\me.png
     文件         805  2018-12-26 12:59  BookManger\bin\out\production\BookManger\com\hellozepp\view\image\add.png
     文件         646  2018-12-26 12:59  BookManger\bin\out\production\BookManger\com\hellozepp\view\image\bookManager.png
     文件         644  2018-12-26 12:59  BookManger\bin\out\production\BookManger\com\hellozepp\view\image\login.png
     文件      892457  2018-12-26 12:59  BookManger\bin\out\production\BookManger\com\hellozepp\view\image\136913011440900.jpg
     文件         618  2018-12-26 12:59  BookManger\bin\out\production\BookManger\com\hellozepp\view\image\bookTypeManager.png
     文件         575  2018-12-26 12:59  BookManger\bin\out\production\BookManger\com\hellozepp\view\image\userName.png
............此处省略918个文件信息

评论

共有 条评论