• 项目解析- JspLibrary


    CRUD

    read:

    String sql = "select b.*,c.name as bookcaseName,p.pubname as publishing,t.typename from tb_bookinfo b left join tb_bookcase c on b.bookcase=c.id join tb_publishing p on b.ISBN=p.ISBN join tb_booktype t on b.typeid=t.id where b."
                    + f + "='" + key + "'";
            System.out.println("查询借阅信息时的SQL:" + sql);
            ResultSet rs = conn.executeQuery(sql);
            try {
                if (rs.next()) {
                    bookForm = new BookForm();
                    bookForm.setBarcode(rs.getString(1));
    }

    insert:

    sql = "Insert into tb_bookinfo (barcode,bookname,typeid,author,translator,isbn,price,page,bookcase,inTime,operator) values('"
                            + bookForm.getBarcode()
                            + "','"
                            + bookForm.getBookName()+ "')";
                    falg = conn.executeUpdate(sql);
                    System.out.println("添加图书的SQL:" + sql);

    update:

    String sql = "Update tb_bookinfo set typeid=" + bookForm.getTypeId()
                    + ",author='" + bookForm.getAuthor() + "',translator='"
                    + bookForm.getTranslator() + "',isbn='" + bookForm.getIsbn()
                    + "',price=" + bookForm.getPrice() + ",page="
                    + bookForm.getPage() + ",bookcase=" + bookForm.getBookcaseid()
                    + " where id=" + bookForm.getId() + "";
            int falg = conn.executeUpdate(sql);

    delete:

    String sql = "UPDATE tb_bookinfo SET del=1 where id="
                    + bookForm.getId() + "";
            int falg = conn.executeUpdate(sql);
            System.out.println("删除时的SQL:" + sql);
  • 相关阅读:
    二分查找法
    AES算法工具类
    SHA加密算法工具类
    使用SQL创建唯一索引
    springboot 启动类CommandLineRunner(转载)
    MD5加密算法工具类
    Android 通过Socket 和服务器通讯
    android 网络连接判断
    android 文件上传,中文utf-8编码
    github打不开问题
  • 原文地址:https://www.cnblogs.com/kakaisgood/p/5620289.html
Copyright © 2020-2023  润新知