表结构
查出list后,用工具类转换。工具类代码如下:
下面展示一些 内联代码片
。
public static List<JSONObject> toTreeList(List tList, String oidkey, Stripspidkey)
List<JSONObject> jsonObjectList = JSONArray. parseArray (JSON. toJSONString(tLIst), JSONobjHass)List<JSONObject) treeList = new ArrayListO:if (json0bjectList != null && json0bjectList.sizeO !=o) 1Iterator var5 = jsonObjectList. iteratorO:while(var5. hasNext 0) {JSONObject obj = (SONObject)var5.nextO;String pidValue = obj. getString(pidKey):if(!isTreeDotExist(json0bjectList, oidKey, pidvalue))fJSONOb ject tTreeEntity = getTreeDotByT(json0bjectList, obj, oidKey, pidKey).treelist. add(tTreeBntity);return treelist,
查询结果如图: