该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
public List getHoust(String title,int priceid){
List list=new ArrayList();
try {
String sql="select a.*,b.name,c.telephone,d.name as name2,e.name as name3 from house a,types b,users c,street d,district e where a.type_id=b.id and a.user_id=c.id and a.street_id=d.id and d.district_id=e.id and a.title like ?";
if(priceid==1){
sql+=sql+" and a.price<100";
}
if(priceid==2){
sql+=sql+" and a.price>100 and a.price <200";
}
if(priceid==3){
sql+=sql+" and a.price>200";
}
conn=getConn();
ps=conn.prepareStatement(sql);
ps.setString(1, null == title ? "%" : "%"+title+"%");
rs=ps.executeQuery();
while(rs.next()){
Houst h=new Houst();
h.setContact(rs.getInt("contact"));
h.setDescription(rs.getString("description"));
h.setFloorage(rs.getInt("floorage"));
h.setId(rs.getInt("id"));
h.setPrice(rs.getInt("price"));
h.setPubdate(rs.getDate("pubdate"));
h.setStreet_id(rs.getInt("street_id"));
h.setTitle(rs.getString("title"));
h.setType_id(rs.getInt("type_id"));
h.setUser_id(rs.getInt("user_id"));
h.setTypename(rs.getString("name"));
h.setUserphone(rs.getString("telephone"));
h.setDistrict(rs.getString("name2"));
h.setStreet(rs.getString("name3"));
list.add(h);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
closeAll();
}
return list;
}
我只有一个参数为什么会报这个错呢