抽取结果集的实现 ResultSetExtractor接口的extractData方法时间:2022-09-08 20:53:14public List<Map> extractData(ResultSet rs) throws SQLException, DataAccessException { List<Map> objList = new ArrayList<Map>(20); try { while (rs.next()) { Map<String, Object> map = new HashMap<String, Object>(); ResultSetMetaData rsMetaData = rs.getMetaData(); int columnCount = rsMetaData.getColumnCount(); for(int colIndex = 1; colIndex <= columnCount; colIndex ++){ String colName = rsMetaData.getColumnName(colIndex); Object value = JdbcUtils.getResultSetValue(rs, colIndex); map.put(colName, value); } objList.add(map); } } catch (Throwable e) { throw new ObjectRetrievalFailureException("拼装Map对象出错!", e); } return objList; } ResultSetExtractor接口的extractData方法