@SuppressWarnings("unchecked")
public static <T> List<Map<String, Object>> listConvert(List<T> list) {
List<Map<String, Object>> list_map = new ArrayList<Map<String, Object>>(); // 定义List<Map<String, Object>>数组<br> // list为外部传进来的list集合
if (list != null && list.size() > 0) {
list.forEach(item ->{
// PropertyUtils.describe(Object)转换
Map<String, Object> map = new HashMap<String, Object>();;
try {
map = (Map<String, Object>) PropertyUtils.describe(item);
} catch (Exception e) {
e.printStackTrace();
}
list_map.add(map);
});
}
return list_map;
}