ace-tree数据格式。只是检单拼串

Posted stum

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ace-tree数据格式。只是检单拼串相关的知识,希望对你有一定的参考价值。

@ResponseBody
@RequestMapping("treeData")
public Map<String, Object> treeData(@RequestParam(required=false) String extId)
 
Map<String, Object> mapList = new HashMap<String, Object>();
StringBuffer sb=new StringBuffer();
sb.append("");
List<PlmBasService> list = plmBasServiceService.getByUpServiceId("100");
for (int i = 0; i < list.size(); i++)
PlmBasService e=list.get(i);
String childtree=childData(e.getId());
if(!childtree.equals(""))
sb.append("\‘" + e.getId() + "\‘ : name: \‘"
+ e.getServiceName() + "\‘,type:\‘folder\‘ ,\‘additionalParameters\‘:"+childtree+",");
else
sb.append("\‘" + e.getId() + "\‘ : name: \‘"
+ e.getServiceName() + "\‘,type:\‘folder\‘,");


sb.append("");
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
mapList.put("tree_data",jsonObject);
return mapList;


public String childData(String UpServiceId)

StringBuffer sb=new StringBuffer();
sb.append("\‘children\‘:");
List<PlmBasService> list = plmBasServiceService.getByUpServiceId(UpServiceId);
for (int i = 0; i < list.size(); i++)
PlmBasService e=list.get(i);
if(!childData(e.getId()).equals(""))
sb.append("\‘" + e.getId() + "\‘ : name: \‘"
+ e.getServiceName() + "\‘,type:\‘folder\‘,\‘additionalParameters\‘:"+childData(e.getId())+",");
else
sb.append("\‘" + e.getId() + "\‘ : name: \‘"
+ e.getServiceName() + "\‘,type:\‘folder\‘,");


sb.append("");
return sb.toString();

以上是关于ace-tree数据格式。只是检单拼串的主要内容,如果未能解决你的问题,请参考以下文章

C#将datatable生成easyui的绑定tree 的json数据格式

python 字符串格式化

Ajax json 数据格式

读取无格式数据

C# 把list中的数据转成规定格式的json格式

如何从handsontable返回JSON格式的数据?