public static List<Map<String, Object>> toListMap(ResultSet ret) throws SQLException{
List<Map<String, Object>> list = new ArrayList();
ResultSetMetaData meta = ret.getMetaData();
int cot = meta.getColumnCount();
while(ret.next()) {
Map<String, Object> map = new HashMap();
for(int i = 0; i < cot; i++) {
map.put(meta.getColumnName(i + 1), ret.getObject(i + 1));
}
list.add(map);
}
return list;
}
ResultSet 转List<Map>
最新推荐文章于 2022-03-26 18:37:13 发布