源数据格式:

{"code": 10000,"msg": "SUCCESS","data": [{"child": [{"child": [{"child": null,"file": null,"resKnowledgeMenu": null,"pointName": "字母","menuId": 6,"seq": 0,"id": 1635},{"child": null,"file": null,"resKnowledgeMenu": null,"pointName": "查字典","menuId": 6,"seq": 19,"id": 1654}],"file": null,"resKnowledgeMenu": null,"pointName": "字词","menuId": 6,"seq": 0,"id": 1634},{"child": [{"child": null,"file": null,"resKnowledgeMenu": null,"pointName": "造句","menuId": 6,"seq": 0,"id": 1656},{"child": null,"file": null,"resKnowledgeMenu": null,"pointName": "语气","menuId": 6,"seq": 20,"id": 1676}],"file": null,"resKnowledgeMenu": null,"pointName": "句子","menuId": 6,"seq": 1,"id": 1655},{"child": [{"child": null,"file": null,"resKnowledgeMenu": null,"pointName": "诗词默写","menuId": 6,"seq": 0,"id": 1678}],"file": null,"resKnowledgeMenu": null,"pointName": "识字","menuId": 6,"seq": 2,"id": 1677},{"child": [{"child": null,"file": null,"resKnowledgeMenu": null,"pointName": "口语交际,情景写话","menuId": 6,"seq": 0,"id": 1683},{"child": null,"file": null,"resKnowledgeMenu": null,"pointName": "综合读写","menuId": 6,"seq": 2,"id": 1685}],"file": null,"resKnowledgeMenu": null,"pointName": "语言表达及应用","menuId": 6,"seq": 3,"id": 1682},{"child": [{"child": null,"file": null,"resKnowledgeMenu": null,"pointName": "诗词鉴赏","menuId": 6,"seq": 0,"id": 1687},{"child": null,"file": null,"resKnowledgeMenu": null,"pointName": "现代文阅读","menuId": 6,"seq": 2,"id": 1689}],"file": null,"resKnowledgeMenu": null,"pointName": "阅读理解及鉴赏","menuId": 6,"seq": 4,"id": 1686},{"child": [{"child": null,"file": null,"resKnowledgeMenu": null,"pointName": "看图写话","menuId": 6,"seq": 0,"id": 1691},{"child": null,"file": null,"resKnowledgeMenu": null,"pointName": "大作文","menuId": 6,"seq": 3,"id": 1694}],"file": null,"resKnowledgeMenu": null,"pointName": "写作","menuId": 6,"seq": 5,"id": 1690}],"file": null,"resKnowledgeMenu": null,"pointName": "基础知识积累与运用","menuId": 6,"seq": 29,"id": 1633}]
}

目标数据格式:

{"data": [{"checked": false,"id": 2742,"name": "基础知识","open": true,"pId": 0,"seq": 62},{"checked": false,"id": 2743,"name": "词汇","open": true,"pId": 2742,"seq": 0},{"checked": false,"id": 2797,"name": "其他作文","open": true,"pId": 2793,"seq": 3}],"msg": {"message": "查询成功!","status": 0}
}

程序代码入口:

package com.sdzn.util;import com.alibaba.fastjson.JSON;
import com.sdzn.enums.MsgCode;
import com.sdzn.thrift.dubbo.vo.Msg;
import com.sdzn.vo.tree.*;import java.util.ArrayList;
import java.util.List;/*** TreeUtil 功能描述:树的格式转换,转换为zTree适合的格式** @author RickyLee【lsr@sdzn.com.cn】* @date 2017/4/13 9:42*/
public class TreeUtil {/*** 将资源平台返回的数据转换为本平台需要的数据格式* @param data 资源平台的json数据* @return*/public zTreeResult parseTree(String data){zTreeResult result=new zTreeResult();Msg msg=new Msg();ZyptTree tree= JSON.parseObject(data,ZyptTree.class);if(tree.getCode()==10000){msg.setStatus(MsgCode.SUCCESS);msg.setMessage("查询成功!");result.setMsg(msg);result.setData(convertZyptTreeToZTree(tree.getData()));}else{msg.setStatus(MsgCode.FAIL);msg.setMessage("资源平台数据查询出错!");result.setMsg(msg);}return result;}/*** 转换资源平台树的数据部分* @param datas* @return*/private List<zTreeVO> convertZyptTreeToZTree(List<Data> datas) {List<zTreeVO> list=new ArrayList<zTreeVO>();for(Data data:datas){zTreeVO vo=new zTreeVO();vo.setId(data.getId());vo.setName(data.getPointName());vo.setPId(0);vo.setSeq(data.getSeq());list.add(vo);if(data.getChild()!=null){list=putChildToList(vo.getId(),data.getChild(),list);}}return list;}/*** 递归转换子节点* @param pId 父节点* @param child 子节点集合* @param list 存放ztree节点集合的全局list* @return*/private List<zTreeVO> putChildToList(Integer pId, List<Child> child, List<zTreeVO> list) {for(Child data:child){zTreeVO vo=new zTreeVO();vo.setId(data.getId());vo.setName(data.getPointName());vo.setPId(pId);vo.setSeq(data.getSeq());list.add(vo);if(data.getChild()!=null){list=putChildToList(vo.getId(),data.getChild(),list);}}return list;}public static void main(String[] args) {String data="{\n" +"    \"code\": 10000,\n" +"    \"msg\": \"SUCCESS\",\n" +"    \"data\": [\n" +"        {\n" +"            \"child\": [\n" +"                {\n" +"                    \"child\": [\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"字音\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 0,\n" +"                            \"id\": 2744\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"字形\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 1,\n" +"                            \"id\": 2745\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"词性\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 2,\n" +"                            \"id\": 2747\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"辨析解释字义、词义\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 3,\n" +"                            \"id\": 2746\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"感情色彩\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 4,\n" +"                            \"id\": 2748\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"构词方式\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 5,\n" +"                            \"id\": 2749\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"短语的结构\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 6,\n" +"                            \"id\": 2750\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"成语\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 7,\n" +"                            \"id\": 2751\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"正确使用词语、熟语\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 8,\n" +"                            \"id\": 2752\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"歇后语,谚语\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 9,\n" +"                            \"id\": 2753\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"关联词语\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 10,\n" +"                            \"id\": 2754\n" +"                        }\n" +"                    ],\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"词汇\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 0,\n" +"                    \"id\": 2743\n" +"                },\n" +"                {\n" +"                    \"child\": [\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"标点符号\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 0,\n" +"                            \"id\": 2756\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"语句停顿\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 1,\n" +"                            \"id\": 2757\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"语气\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 2,\n" +"                            \"id\": 2758\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"修辞方法\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 3,\n" +"                            \"id\": 2759\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"连词成句\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 4,\n" +"                            \"id\": 2760\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"排列句子顺序\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 5,\n" +"                            \"id\": 2761\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"病句辨析\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 6,\n" +"                            \"id\": 2762\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"选用,仿用,变换句式\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 7,\n" +"                            \"id\": 2763\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"划分句子成分及复句关系\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 8,\n" +"                            \"id\": 2764\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"对联\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 9,\n" +"                            \"id\": 2765\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"补充句子\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 10,\n" +"                            \"id\": 2766\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"句式\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 11,\n" +"                            \"id\": 2767\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"说明方法\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 12,\n" +"                            \"id\": 2768\n" +"                        }\n" +"                    ],\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"句子\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 1,\n" +"                    \"id\": 2755\n" +"                },\n" +"                {\n" +"                    \"child\": [\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"文言实词\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 0,\n" +"                            \"id\": 2770\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"文言虚词\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 1,\n" +"                            \"id\": 2771\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"词类活用\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 2,\n" +"                            \"id\": 2772\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"古今异义\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 3,\n" +"                            \"id\": 2773\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"通假字\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 4,\n" +"                            \"id\": 2774\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"一词多义\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 5,\n" +"                            \"id\": 2775\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"文言句式\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 6,\n" +"                            \"id\": 2776\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"翻译句子\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 7,\n" +"                            \"id\": 2777\n" +"                        }\n" +"                    ],\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"古代汉语知识\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 2,\n" +"                    \"id\": 2769\n" +"                },\n" +"                {\n" +"                    \"child\": [\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"文学常识\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 0,\n" +"                            \"id\": 2779\n" +"                        },\n" +"                        {\n" +"                            \"child\": null,\n" +"                            \"file\": null,\n" +"                            \"resKnowledgeMenu\": null,\n" +"                            \"pointName\": \"诗文默写\",\n" +"                            \"menuId\": 10,\n" +"                            \"seq\": 1,\n" +"                            \"id\": 2780\n" +"                        }\n" +"                    ],\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"识记\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 3,\n" +"                    \"id\": 2778\n" +"                }\n" +"            ],\n" +"            \"file\": null,\n" +"            \"resKnowledgeMenu\": null,\n" +"            \"pointName\": \"基础知识\",\n" +"            \"menuId\": 10,\n" +"            \"seq\": 62,\n" +"            \"id\": 2742\n" +"        },\n" +"        {\n" +"            \"child\": [\n" +"                {\n" +"                    \"child\": null,\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"文言文阅读\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 0,\n" +"                    \"id\": 2782\n" +"                },\n" +"                {\n" +"                    \"child\": null,\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"古诗词阅读\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 1,\n" +"                    \"id\": 2783\n" +"                },\n" +"                {\n" +"                    \"child\": null,\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"现代文阅读\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 2,\n" +"                    \"id\": 2784\n" +"                },\n" +"                {\n" +"                    \"child\": null,\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"现代诗歌阅读\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 3,\n" +"                    \"id\": 2785\n" +"                }\n" +"            ],\n" +"            \"file\": null,\n" +"            \"resKnowledgeMenu\": null,\n" +"            \"pointName\": \"阅读理解及鉴赏\",\n" +"            \"menuId\": 10,\n" +"            \"seq\": 63,\n" +"            \"id\": 2781\n" +"        },\n" +"        {\n" +"            \"child\": [\n" +"                {\n" +"                    \"child\": null,\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"综合读写\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 0,\n" +"                    \"id\": 2787\n" +"                },\n" +"                {\n" +"                    \"child\": null,\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"口语交际\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 1,\n" +"                    \"id\": 2788\n" +"                },\n" +"                {\n" +"                    \"child\": null,\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"扩展语段\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 2,\n" +"                    \"id\": 2789\n" +"                },\n" +"                {\n" +"                    \"child\": null,\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"压缩语段\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 3,\n" +"                    \"id\": 2790\n" +"                },\n" +"                {\n" +"                    \"child\": null,\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"理解句子\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 4,\n" +"                    \"id\": 2791\n" +"                },\n" +"                {\n" +"                    \"child\": null,\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"课文理解,名著阅读\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 5,\n" +"                    \"id\": 2792\n" +"                }\n" +"            ],\n" +"            \"file\": null,\n" +"            \"resKnowledgeMenu\": null,\n" +"            \"pointName\": \"语言表达及应用\",\n" +"            \"menuId\": 10,\n" +"            \"seq\": 64,\n" +"            \"id\": 2786\n" +"        },\n" +"        {\n" +"            \"child\": [\n" +"                {\n" +"                    \"child\": null,\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"材料作文\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 0,\n" +"                    \"id\": 2794\n" +"                },\n" +"                {\n" +"                    \"child\": null,\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"话题作文\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 1,\n" +"                    \"id\": 2795\n" +"                },\n" +"                {\n" +"                    \"child\": null,\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"命题作文、半命题作文\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 2,\n" +"                    \"id\": 2796\n" +"                },\n" +"                {\n" +"                    \"child\": null,\n" +"                    \"file\": null,\n" +"                    \"resKnowledgeMenu\": null,\n" +"                    \"pointName\": \"其他作文\",\n" +"                    \"menuId\": 10,\n" +"                    \"seq\": 3,\n" +"                    \"id\": 2797\n" +"                }\n" +"            ],\n" +"            \"file\": null,\n" +"            \"resKnowledgeMenu\": null,\n" +"            \"pointName\": \"写作\",\n" +"            \"menuId\": 10,\n" +"            \"seq\": 65,\n" +"            \"id\": 2793\n" +"        }\n" +"    ]\n" +"}";zTreeResult result=new TreeUtil().parseTree(data);System.out.println(JSON.toJSONString(result));}}

相关vo:

/*** Copyright 2017 bejson.com*/
package com.sdzn.vo.tree;import java.util.List;import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;/*** Auto-generated: 2017-04-13 9:49:28** @author bejson.com (i@bejson.com)* @website http://www.bejson.com/java2pojo/*/
public class Child {private List<Child> child;private String file;private String resKnowledgeMenu;private String pointName;private int menuId;private int seq;private int id;public List<Child> getChild() {return child;}public void setChild(List<Child> child) {this.child = child;}public String getFile() {return file;}public void setFile(String file) {this.file = file;}public String getResKnowledgeMenu() {return resKnowledgeMenu;}public void setResKnowledgeMenu(String resKnowledgeMenu) {this.resKnowledgeMenu = resKnowledgeMenu;}public String getPointName() {return pointName;}public void setPointName(String pointName) {this.pointName = pointName;}public int getMenuId() {return menuId;}public void setMenuId(int menuId) {this.menuId = menuId;}public int getSeq() {return seq;}public void setSeq(int seq) {this.seq = seq;}public int getId() {return id;}public void setId(int id) {this.id = id;}
}
/*** Copyright 2017 bejson.com */
package com.sdzn.vo.tree;
import java.util.List;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
/*** Auto-generated: 2017-04-13 9:49:28** @author bejson.com (i@bejson.com)* @website http://www.bejson.com/java2pojo/*/
public class Data {private List<Child> child;private String file;private String resKnowledgeMenu;private String pointName;private int menuId;private int seq;private int id;public List<Child> getChild() {return child;}public void setChild(List<Child> child) {this.child = child;}public String getFile() {return file;}public void setFile(String file) {this.file = file;}public String getResKnowledgeMenu() {return resKnowledgeMenu;}public void setResKnowledgeMenu(String resKnowledgeMenu) {this.resKnowledgeMenu = resKnowledgeMenu;}public String getPointName() {return pointName;}public void setPointName(String pointName) {this.pointName = pointName;}public int getMenuId() {return menuId;}public void setMenuId(int menuId) {this.menuId = menuId;}public int getSeq() {return seq;}public void setSeq(int seq) {this.seq = seq;}public int getId() {return id;}public void setId(int id) {this.id = id;}
}
package com.sdzn.vo.tree;import com.sdzn.thrift.dubbo.vo.Msg;import java.io.Serializable;
import java.util.List;/*** zTreeResult 功能描述:zTree返回信息** @author RickyLee【lsr@sdzn.com.cn】* @date 2017/4/13 9:59*/
public class zTreeResult implements Serializable{private Msg msg;private List<zTreeVO> data;public Msg getMsg() {return msg;}public void setMsg(Msg msg) {this.msg = msg;}public List<zTreeVO> getData() {return data;}public void setData(List<zTreeVO> data) {this.data = data;}
}
package com.sdzn.vo.tree;import java.io.Serializable;/*** zTreeVO 功能描述:zTree树节点属性信息** @author RickyLee【lsr@sdzn.com.cn】* @date 2017/4/13 9:57*/
public class zTreeVO implements Serializable{private Integer id;private Integer PId;private String name;private Integer seq;private boolean checked=false;private boolean open=true;public Integer getId() {return id;}public void setId(Integer id) {this.id = id;}public Integer getPId() {return PId;}public Integer getSeq() {return seq;}public void setSeq(Integer seq) {this.seq = seq;}public void setPId(Integer PId) {this.PId = PId;}public String getName() {return name;}public void setName(String name) {this.name = name;}public boolean isChecked() {return checked;}public void setChecked(boolean checked) {this.checked = checked;}public boolean isOpen() {return open;}public void setOpen(boolean open) {this.open = open;}
}
/*** Copyright 2017 bejson.com */
package com.sdzn.vo.tree;
import java.util.List;/*** Auto-generated: 2017-04-13 9:49:28** @author bejson.com (i@bejson.com)* @website http://www.bejson.com/java2pojo/*/
public class ZyptTree {private int code;private String msg;private List<Data> data;public void setCode(int code) {this.code = code;}public int getCode() {return code;}public void setMsg(String msg) {this.msg = msg;}public String getMsg() {return msg;}public void setData(List<Data> data) {this.data = data;}public List<Data> getData() {return data;}}
package com.sdzn.enums;/*** MsgCode 功能描述:返回状态码枚举** @author RickyLee【lsr@sdzn.com.cn】* @date 2016/11/21 13:02*/
public class MsgCode {//成功public final static int SUCCESS =0;//失败public final static int FAIL =-1;}
package com.sdzn.thrift.dubbo.vo;import java.io.Serializable;/*** Msg 功能描述:接口调用返回状态说明** @author RickyLee【lsr@sdzn.com.cn】* @date 2016/11/21 12:57*/
public class Msg implements Serializable{private Integer status=null;private String message=null;public Integer getStatus() {return status;}public void setStatus(Integer status) {this.status = status;}public String getMessage() {return message;}public void setMessage(String message) {this.message = message;}
}

将子节点中含子节点的json数据转换成ztree适合的json数据格式相关推荐

  1. Activiti中的关于子流程中的并发节点标记处理

    最近在研究一个轻量级的工作流引擎Activiti,就遇到了子流程中无法标记其并发节点的问题,经过几天的研究,想到了一个简单易懂的方法,总结如下,希望对你们能有所帮助,有写的不对的地方,还希望大家多提宝 ...

  2. cms 移动根节点到根节点中的子节点,根节点消失解决办法

    cms 移动根节点到根节点中的子节点,根节点消失解决办法 cms使用对应有个NetCMS数据库,找到其中NT_News_Class表,这个表就是保存栏目名称的表 select * from dbo.N ...

  3. zTree实现单独选中根节点中第一个节点

    zTree实现单独选中根节点中第一个节点 1.实现源代码 <!DOCTYPE html> <html> <head><title>zTree实现基本树& ...

  4. jasper report 子报表中嵌套子报表

    上篇记录了主报表中嵌套子报表,用json数据源设计报表,没有问题了. 本篇记录下子报表中再嵌套子报表(即孙报表)怎么实现. 思路:把需要再嵌套孙报表的子报表sub_report3,当做主报表设计,内嵌 ...

  5. oracle sql 转换成 hive sql -子查询转关联查询(三).子查询中嵌套子查询

    其他sql格式也在更新中,可直接查看俺的这个系列,要是没有你需要的格式,可在评论或私信我,俺现在一天一看 Oracle转换hive 其他sql格式也在更新中,可直接查看俺的这个系列,要是没有你需要的格 ...

  6. Vue获取div节点中的子节点出现的坑(childNodes, nextTick)

    今天遇到了一个比较邪门的问题,就是我在mounted中使用 var oUl = document.getElementById("tbody"); console.log(oUl. ...

  7. Oracle子查询中含group by 和order by,排序字段为聚合列的别名+数值函数,外层count统计出错

    该问题猜测是个bug,19c版本执行结果正常,11g版本错误 建议:如果子查询中有group by 和order by,排序字段还需用数值函数处理,避免直接用别名 Oracle版本:11g 原始SQL ...

  8. ZooKeeper基础知识笔记(含3节点伪分布式安装配置流程)

    本笔记涉及代码:https://github.com/hackeryang/Hadoop-Exercises/tree/master/src/main/java/ZooKeeper 一.ZooKeep ...

  9. Qt对话框的事件循环分析(子线程中不能创建UI窗体分析)

    重要: GUI线程和辅助线程 如前所述,每个程序在启动时都有一个线程.这个线程被称为"主线程"(在Qt应用程序中也称为"GUI线程").Qt GUI必须在这个线 ...

  10. Qt对话框的事件循环分析(子线程中不能创建UI窗体分析2)

    Qt事件机制 QT-UI 后端 重要: GUI线程和辅助线程 如前所述,每个程序在启动时都有一个线程.这个线程被称为"主线程"(在Qt应用程序中也称为"GUI线程&quo ...

最新文章

  1. 页面缓存 ehcache(简单的)
  2. leetCode刷题第一天--求两数之和
  3. ASP.NET Core微服务(六)——【redis操作】
  4. qt中继承pushbutton自定义控件设置按钮样式
  5. Erlang/Elixir 社区摘要: 2016-05-21
  6. 4乘4方格走的路线_苏州周边4个冷门自驾游路线景点推荐
  7. Linux常用命令笔记---创建私有YUM源
  8. 员工出错处罚通知_员工被罚款50元!理由是用了单位公厕的厕纸…
  9. 2018.12.27|区块链技术头条
  10. You must depend on an EXACT version of electron-prebuilt-compile not a range (got ^4.0.0)
  11. 机器学习和模式识别怎么区分?
  12. L1-064 估值一亿的AI核心代码 (20 分)
  13. 16岁的雅虎问答,因“不再受欢迎”将永久关闭
  14. URP——后期处理特效——通道混合器Channel Mixer
  15. linux中国共享文件,linux上的文件共享服务详解
  16. 访问国内网站提示无法访问
  17. 用通道法抠出外国MM的头发 - PS通道抠图教程
  18. javascript判断浏览器当前运行环境
  19. IPD解读—需求管理(OR)流程方法论
  20. 针对乐视网的主页无法打开的解决办法

热门文章

  1. matlab系统辨识尝试之详细过程1,系统辨识工具箱教程
  2. 使用MATLAB绘制Smith圆图
  3. 企业数字化转型战略权威指南
  4. 2022-2027年中国电动汽车充电站及充电桩行业市场深度分析及投资战略规划报告
  5. python3 词频统计代码_Python词频统计代码,python
  6. 生物信息学数据库及在线工具汇总 (更新)
  7. JAVA 同步方法和同步代码块的区别是什么?
  8. STM32F4 使用 JFlash 加密后无法再擦除了
  9. 未雨绸缪——理解软件配置管理(第2版)
  10. 百度网盘下载神器度盘下载器