private Connection conn = null;
private PreparedStatement pstmt = null;
private ResultSet rs = null;
public List supplierfindbyname(Supplierlocation su) {
// TODO Auto-generated method stub
List sulist = new ArrayList();
String sql = "select * from fanwe_supplier_location where name = ?";
try {
conn = getConnection();
pstmt = conn.prepareStatement(sql);
System.out.println("su.getSuppname()----"+su.getSuppname());
pstmt.setString(1,"'%"+su.getSuppname()+"%'");
rs = pstmt.executeQuery();
System.out.println("sql----"+sql);
while(rs.next())
{
System.out.println("结果集中取出来的name----"+rs.getString("name"));
Supplierlocation supp = new Supplierlocation();
supp.setSuppname(rs.getString("name"));
supp.setPreview(rs.getString("preview"));
supp.setAvgpoint(rs.getFloat("avg_point"));
supp.setTakeawayprice(rs.getFloat("takeaway_price"));
supp.setTakeawaytime(rs.getInt("takeaway_time"));
supp.setShopcount(rs.getInt("shop_count"));
supp.setDeal_cate_match_row(rs.getString("deal_cate_match_row"));
supp.setXpoint(rs.getString("xpoint"));
supp.setYpoint(rs.getString("ypoint"));
sulist.add(supp);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally
{
closeConnection(conn, pstmt, rs);
}
return sulist;
}