public List<UserInfo> searchUserInfo(int user_id, int user_name, int user_locked) {
// TODO Auto-generated method stub
StringBuffer sql = new StringBuffer();
List params = new ArrayList();
sql.append("select * from user_info where 1 = 1 ");
if(user_id != 0){
sql.append(" and reader_id = ? ");
params.add("%" + user_id + "%");
}
if(user_name != 0){
sql.append(" and user_name = ? ");
params.add( user_name );
}
if(user_locked != 0){
sql.append(" and user_locked = ? ");
params.add( user_locked );
}
/* 当前获取的params为Object对象数组,不知道怎么变成具体的参数
* 目前没办法拼接sql语句
*/
List<UserInfo> query = template.query(sql.toString(), new BeanPropertyRowMapper<UserInfo>(UserInfo.class),params);
return query;
}
目前没办法拼接sql语句,当前获取的参数为Object对象数组,不知道怎么变成具体的参数,望大佬解惑,不胜感激!!!