コード例 #1
0
  @Override
  public List<TransferView> getAccount(TransferView transferV) {
    // TODO Auto-generated method stub
    Connection conn = DBUtil.getConnection();
    PreparedStatement pstm = null;
    ResultSet rs = null;
    List<TransferView> list = new ArrayList<TransferView>();
    String sql =
        "select goods_id,goods_name,goods_unit,goods_spft,goods_num,goods_manufacture from transfer_account"
            + " where warehouse_id=?";
    try {
      pstm = conn.prepareStatement(sql);
      WarehouseBeans housb = transferV.getWarehouseb();
      pstm.setString(1, housb.getWarehouse_id());
      System.out.println(housb.getWarehouse_id());
      rs = pstm.executeQuery();
      TransferView transV = null;
      while (rs.next()) {
        transV = new TransferView();
        GoodsBeans goodsb = new GoodsBeans();
        HouseCapacityBeans houseb = new HouseCapacityBeans();
        goodsb.setGoods_id(rs.getString("goods_id"));
        goodsb.setGoods_name(rs.getString("goods_name"));
        goodsb.setGoods_unit(rs.getString("goods_unit"));
        goodsb.setGoods_spft(rs.getString("goods_spft"));
        houseb.setGoods_num(rs.getInt("goods_num"));
        goodsb.setGoods_manufacture(rs.getString("goods_manufacture"));

        transV.setGoodsb(goodsb);
        transV.setHousecapb(houseb);

        list.add(transV);
      }
    } catch (SQLException e) {
      // TODO: handle exception
      e.printStackTrace();
    } finally {
      DBUtil.free(rs, pstm, conn);
    }

    return list;
  }
コード例 #2
0
  @Override
  public TransferView getChoose(TransferView transferV) {
    // TODO Auto-generated method stub
    Connection conn = DBUtil.getConnection();
    PreparedStatement pstm = null;
    ResultSet rs = null;
    TransferView transV = null;
    String sql =
        "select goods_id,goods_name,goods_unit,goods_spft,goods_apvlunm,goods_num,goods_manufacture from transfer_account "
            + "where goods_id=? and warehouse_id=?";
    try {
      WarehouseBeans warehouseb = transferV.getWarehouseb();
      GoodsBeans godsb = transferV.getGoodsb();
      pstm = conn.prepareStatement(sql);
      pstm.setString(1, godsb.getGoods_id());
      pstm.setString(2, warehouseb.getWarehouse_id());
      rs = pstm.executeQuery();
      transV = new TransferView();
      GoodsBeans goodsb = new GoodsBeans();
      HouseCapacityBeans houseb = new HouseCapacityBeans();
      while (rs.next()) {
        goodsb.setGoods_id(rs.getString("goods_id"));
        goodsb.setGoods_name(rs.getString("goods_name"));
        goodsb.setGoods_unit(rs.getString("goods_unit"));
        goodsb.setGoods_spft(rs.getString("goods_spft"));
        goodsb.setGoods_apvlnum(rs.getString("goods_apvlunm"));
        houseb.setGoods_num(rs.getInt("goods_num"));
        goodsb.setGoods_manufacture(rs.getString("goods_manufacture"));

        transV.setGoodsb(goodsb);
        transV.setHousecapb(houseb);
      }

    } catch (SQLException e) {
      // TODO: handle exception
      e.printStackTrace();
    } finally {
      DBUtil.free(rs, pstm, conn);
    }
    return transV;
  }