• 项目解析- 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);
  • 相关阅读:
    动态字节码技术Javassist
    自己实现简单版的注解Mybatis
    AOP实现事务和记录日志
    自己实现简单版SpringMVC
    静态变量
    docker安装nginx , 安装mysql5.6,安装redis3.2
    Worker Thread模式
    linux 安装jdk
    dockfile构建自己的tomcat
    docker使用2
  • 原文地址:https://www.cnblogs.com/kakaisgood/p/5620289.html
Copyright © 2020-2023  润新知