String sql = "select v_username from t_user where v_userid=?";
public String getUserNameById(String v_uid) {
sql = sql.replaceAll("//?", "'"+v_uid+"'");
List list = jdbcTemplate.queryForList(sql);
Iterator ite = list.iterator();
if(ite.hasNext()){
Map user = (Map)ite.next();
//字段名称需要大写,否则空指针异常
return user.get("V_USERNAME").toString();
}
return "";
}