public Object[][] selectDetailsV1(Long recordId) {
List<Map<String, Object>> list = selectMap(recordId);
int size = list.size();
/*BudgetMonthly 查询的对象*/
Field[] declaredFields = BudgetMonthly.class.getDeclaredFields();
if (CollectionUtils.isEmpty(list)) {
return new Object[0][];
}
Object[][] array = new Object[size + 1][declaredFields.length];
for (int i = 0; i < size + 1; i++) {
//循环遍历所有行
if (i == 0) {
Map<String, Object> stringObjectMap = list.get(i);
Set<String> strings = stringObjectMap.keySet();
array[i] = strings.toArray();
} else {
//每行的列数
array[i] = list.get(i-1).values().toArray();
}
}
return array;
}
网友评论