List<bean> 转换成List<Map>
//将listmap转换成list实体类 List<OaAttachment>list=new ArrayList<OaAttachment>(); if(Func.isNotEmpty(attachments)){ for(Map<String,Object> map:attachments){ OaAttachment fileInfo=new OaAttachment(); fileInfo= JSONObject.parseObject(JSONObject.toJSONString(map),OaAttachment.class); list.add(fileInfo); } }
//将list实体类转换成list map
List<Map<String,Object>>mapList=new ArrayList<>(); for(OaAttachmentContract files:bean.getAttachments()){ Map<String,Object>map=new HashMap<String,Object>(); map=JSONObject.parseObject(JSONObject.toJSONString(files),Map.class); mapList.add(map); }