實現思路:
List list = new ArrayList(); Map map = new HashMap(); for(i=0;i<list.size;i++){ map=list.get(i); for (String key : map.keySet()){ System.out.println("key:"+key+",value:"+map.get(key) ); } }
//數據庫中的數據
List<Map<String, Object>> list = economicMappers.selectKsqyData();
for (int i = 0; i < list.size(); i++) {
//獲取單挑數據
Map<String, object> map = list.get(i);
//遍歷單挑的數據
for (String key : map.keySet()) {
if ("Id".equals(key)) {
sout(map.get(key));
}
if ("name".equals(key)) {
sout(map.get(key));
}
if ("age".equals(key)) {
sout(map.get(key));
}
}
}