mybatis获取数据库表字段名+数据

dao:
List> getTest();


map.xml:


bo:

List> allList = new ArrayList>();
List> map = dao.getTest();
int index = 0;
for (Map kv : map) {
	List key = new ArrayList();
	List value = new ArrayList();
	for (Map.Entry entry : kv.entrySet()) {
		if (index == 0) { 
			key.add(entry.getKey());
		}
		value.add(entry.getValue());
	}
	if (index == 0) {
		allList.add(key);
	}
	allList.add(value);
	index++;
} 
  


你可能感兴趣的:(JAVA)