求大佬帮忙看看
hooman2019-08-16 13:32:41

根据报错,返回应该是MetadataBean对象,你把Map<String, Object>改为MetadataBean试试

List metadataList = metadataService.getAllMeatadata(send_parentid);

List> treeList = new ArrayList>();

Map treeMap = null;

for (MetadataBean bean : metadataList) {

String metadata_id = String.valueOf(bean.get("metadata_id"));

String metadata_name = String.valueOf(bean.get("metadata_name")).trim();

String parent_id = String.valueOf(bean.get("parent_id"));

String isLeaf = String.valueOf(bean.get("isleaf"));

String grade = String.valueOf(bean.get("grade"));

String metadata_type = String.valueOf(bean.get("metadata_type"));

//JOptionPane.showMessageDialog(null, isLeaf);treeMap =newHashMap(); treeMap.put("id", metadata_id); treeMap.put("pId", parent_id); treeMap.put("name", metadata_name); treeMap.put("grade", grade); treeMap.put("isleaf", isLeaf); treeMap.put("metadata_type", metadata_type);if(isLeaf.equals("0")) { treeMap.put("isParent",true); } treeList.add(treeMap);}

0
0
lgchen: 根据报错,返回应该是MetadataBean对象,你把Map<String, Object>改为MetadataBean试试 List<MetadataBean> metadataList = metadataService.getAllMeatadata(send_parentid); List<Map<String, Object>> treeList = new ArrayList<Map<String, Object>>(); Map<String, Object> treeMap = null; for (MetadataBean bean : metadataList) { String metadata_id = String.valueOf(bean.get("metadata_id")); String metadata_name = String.valueOf(bean.get("metadata_name")).trim(); String parent_id = String.valueOf(bean.get("parent_id")); String isLeaf = String.valueOf(bean.get("isleaf")); String grade = String.valueOf(bean.get("grade")); String metadata_type = String.valueOf(bean.get("metadata_type")); //JOptionPane.showMessageDialog(null, isLeaf); treeMap = new HashMap<String, Object>(); treeMap.put("id", metadata_id); treeMap.put("pId", parent_id); treeMap.put("name", metadata_name); treeMap.put("grade", grade); treeMap.put("isleaf", isLeaf); treeMap.put("metadata_type", metadata_type); if (isLeaf.equals("0")) { treeMap.put("isParent", true); } treeList.add(treeMap); }
2019-08-16 13:36:40
0
写文章
戳我,来吐槽~