示例#1
0
 @Override
 public List<Supplier> findAll(String keyWord) throws Exception {
   List<Supplier> result = new ArrayList<Supplier>();
   String sql =
       "SELECT * FROM t_supplier WHERE supplier_userid  LIKE ?  OR supplier_jingyingaddr  LIKE ?";
   this.pstmt = this.conn.prepareStatement(sql);
   this.pstmt.setString(1, "%" + keyWord + "%");
   this.pstmt.setString(2, "%" + keyWord + "%");
   ResultSet rs = this.pstmt.executeQuery();
   Supplier Supplier = null;
   while (rs.next()) {
     Supplier = new Supplier();
     Supplier.setSupplier_id(rs.getInt("supplier_id"));
     Supplier.setSupplier_userid(rs.getInt("supplier_userid"));
     Supplier.setSupplier_yingyezhizhao(rs.getString("supplier_yingyezhizhao"));
     Supplier.setSupplier_shuiwu(rs.getString("supplier_shuiwu"));
     Supplier.setSupplier_jigou(rs.getString("supplier_jigou"));
     Supplier.setSupplier_liutong(rs.getString("supplier_liutong"));
     Supplier.setSupplier_anquan(rs.getString("supplier_anquan"));
     Supplier.setSupplier_renzheng(rs.getString("supplier_renzheng"));
     Supplier.setSupplier_jingyingaddr(rs.getString("supplier_jingyingaddr"));
     Supplier.setSupplier_shengchanaddr(rs.getString("supplier_shengchanaddr"));
     result.add(Supplier);
   }
   this.pstmt.close();
   return result;
 }
示例#2
0
 @Override
 public Supplier findById(int supplier_id) throws Exception {
   Supplier Supplier = null;
   String sql = "SELECT * FROM t_supplier WHERE supplier_id=?";
   this.pstmt = this.conn.prepareStatement(sql);
   this.pstmt.setInt(1, supplier_id);
   ResultSet rs = this.pstmt.executeQuery();
   if (rs.next()) {
     Supplier = new Supplier();
     Supplier.setSupplier_id(rs.getInt("supplier_id"));
     Supplier.setSupplier_userid(rs.getInt("supplier_userid"));
     Supplier.setSupplier_yingyezhizhao(rs.getString("supplier_yingyezhizhao"));
     Supplier.setSupplier_shuiwu(rs.getString("supplier_shuiwu"));
     Supplier.setSupplier_jigou(rs.getString("supplier_jigou"));
     Supplier.setSupplier_liutong(rs.getString("supplier_liutong"));
     Supplier.setSupplier_anquan(rs.getString("supplier_anquan"));
     Supplier.setSupplier_renzheng(rs.getString("supplier_renzheng"));
     Supplier.setSupplier_jingyingaddr(rs.getString("supplier_jingyingaddr"));
     Supplier.setSupplier_shengchanaddr(rs.getString("supplier_shengchanaddr"));
   }
   this.pstmt.close();
   return Supplier;
 }