HashMap<String, SomExam> mapOfGuoJia = new HashMap<String, SomExam>();
HashMap<String, SomExam> mapOfTaoGuang = new HashMap<String, SomExam>();
try {
Connection conn = DataSourceUtils.getConnection(jdbcTemplate.getDataSource());
CallableStatement cs = conn.prepareCall(sql.toString());
try {
//赋值参数
cs.setInt(1, fid.intValue());
cs.setString(2, stime.getTime());
cs.setString(3, etime.getTime());
ResultSet r = cs.executeQuery();
while (r.next()) {
SomExam temp = new SomExam();
temp.setname1(r.getString("name1"));
temp.setName(r.getString("name"));
if (){
mapOfGuoJia.put(temp.getName, temp); //key值需要自己去定义
}else{
mapOfTaoGuang.put(temp.getName, temp); //key值需要自己去定义
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
cs.close();
DataSourceUtils.releaseConnection(conn,
jdbcTemplate.getDataSource());
}
} catch (Exception e) {
e.printStackTrace();
}