第一种方式:
List<Map<String,Object>> locationInfo=null;
locationInfo=(List<Map<String, Object>>) jdbcTemplate.execute("exec PROC_TaoBAO_State ?", new PreparedStatementCallback(){
public Object doInPreparedStatement(PreparedStatement stmt) throws SQLException, DataAccessException {
List<HashMap<String,Object>> infoList=new ArrayList<HashMap<String,Object>>();
stmt.setString(1,mailNo);
ResultSet rs = stmt.executeQuery();
while(rs.next()){
Map<String,Object> infoMap=new HashMap<String,Object>();
infoMap.put("acceptAddress",getString(rs.getString("位置")));
infoMap.put("remark",rs.getString("状态"));
infoMap.put("acceptTime",getString(rs.getString("跟踪时间")));
infoList.add((HashMap<String, Object>) infoMap);
}
return infoList;
}});
return locationInfo;
第二种方式:
DataSource dataSource = jdbcTemplate.getDataSource();
Connection conn=null;
Map ddMap=new HashMap();
conn=dataSource.getConnection();
CallableStatement cs = conn.prepareCall("{call Proc_AlibabaOther (?)}");
cs.setString(1, txLogisticId);
cs.execute();
ResultSet rs = cs.getResultSet();
while(rs.next()){
ddMap.put("txLogisticId",txLogisticId);
ddMap.put("mailNo",getString(rs.getString("mailNo")));
ddMap.put("remark",getString(rs.getString("remark")));
ddMap.put("acceptTime",getString(rs.getString("gmtCommit")));
ddMap.put("acceptAddress",getString(rs.getString("senderaddress")));
ddMap.put("status", "true");
}
return ddMap;