用集合输出怎么报错了?Unknown column '?€??§‘????–??€?' in 'where clause'
public List<Goddes> query(List<Map<String, Object>>params) throws Exception{
List<Goddes>result=new ArrayList<Goddes>();
Connection cnn=DbUtil.getConnection();
StringBuilder sb=new StringBuilder();
sb.append(" select*from yingxiong where 1=1 ");
if(params!=null&¶ms.size()>0){
for (int i = 0; i < params.size(); i++) {
Map<String, Object>map=params.get(i);
sb.append(" and "+map.get("name")+" "+map.get("rela")+" "+map.get("value")+" ");
}
}
PreparedStatement ptmt=cnn.prepareStatement(sb.toString());
System.out.println(sb.toString());
ResultSet rs=ptmt.executeQuery();
Goddes g=null;
while(rs.next()){
g=new Goddes();
g.setId(rs.getInt("id"));
g.setname(rs.getString("name"));
g.setSex(rs.getString("sex"));
g.setAge(rs.getInt("age"));
result.add(g);
}
return result;
}