public Map statisticsByProcedure(final java.sql.Date date) {
return (Map) jdbcDao.getJdbcTemplate().execute(
"{call STATISTICS_FOR_SHITANG(?)}",
new CallableStatementCallback() {
public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
cs.setDate(1, date);
ResultSet rs = cs.executeQuery();
Map statisticsMap = new HashMap(); // map<PIC,map<WEEKDAY,COUNT>>
while (rs.next()) {
String C_PID = rs.getString("C_PID");
Integer N_WEEKDAY = new Integer(rs.getInt("N_WEEKDAY"));
Integer N_COUNT = new Integer(rs.getInt("N_COUNT"));
Map countMap = new HashMap(); // map<WEEKDAY,COUNT>
countMap.put(N_WEEKDAY, N_COUNT);
Map _map = (Map) statisticsMap.get(C_PID); // map<WEEKDAY,COUNT>
if (_map == null) {
_map = countMap;
} else {
_map.putAll(countMap);
}
statisticsMap.put(C_PID, _map);
}
return statisticsMap;
}
});
}