您的位置:首页 > 其它

关于查找算法-

2014-03-03 19:58 169 查看
public ResultSet equipmentList(Connection con,EquipmentType equipmentType) throws Exception{
StringBuffer sb=new StringBuffer("select * from t_equipmenttype");
//System.out.print(equipmentType.getEquipmentTypeName());
if(StringUtil.isNotEmpty(equipmentType.getEquipmentTypeName())){
sb.append(" and equipmentTypeName like '%"+equipmentType.getEquipmentTypeName()+"%'");

}
PreparedStatement pstmt=con.prepareStatement(sb.toString().replaceFirst("and", "where"));
System.out.print(pstmt);
return pstmt.executeQuery();
}


挺好,学习到了.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: