public void update(purchaseList list) {
    try {
      Connection con = initDB();
      // 创建SQL命令对象
      Statement stmt = con.createStatement();
      // 创建SQL命令字符串
      String query =
          "update purchaseList set purch_date='"
              + list.getPurch_date()
              + "',purch_totalPrice='"
              + list.getPurch_totalPrice()
              + "',unitId='"
              + list.getUnit_id()
              + "',acc_id='"
              + list.getAcc_id()
              + "' where purch_id ='"
              + list.getPurch_id()
              + "'";

      // 执行SQL语句
      stmt.execute(query);

      // 关闭命令对象连接
      stmt.close();

      // 关闭数据库连接
      con.close();
    } catch (Exception e) {
      System.out.println("更新数据失败!");
      e.printStackTrace();
    }
  }
  // 增加进货单
  public void add(purchaseList list) {

    try {
      Connection con = initDB();

      Statement stmt = con.createStatement();

      String query =
          "insert into purchaseList(purch_id,purch_date,purch_totalPrice,unitId,acc_id) values ('"
              + list.getPurch_id()
              + "','"
              + list.getPurch_date()
              + "','"
              + list.getPurch_totalPrice()
              + "','"
              + list.getUnit_id()
              + "','"
              + list.getAcc_id()
              + "')";
      stmt.execute(query);

      // 关闭命令对象连接
      stmt.close();
      // 关闭数据库连接
      con.close();
    } catch (SQLException e) {
      System.out.println("添加数据失败!");
      e.printStackTrace();
    }
  }