格式转换

List<Record> list = topicsalesservice.getreply(planid,empcd);

返回的数据是

[{

    "id": 7510,

    "parentid": 0,

    "createemployeecd": 1014,

    "createemployeename": "张三",

    "comment": "大体了解",

    "createtime": "2018-11-13 16:37:46.387231"

},{

    "id": 7511,

    "parentid": 7510,

    "createemployeecd": 1015,

    "createemployeename": "李四",

    "comment": "大体了解",

    "createtime": "2018-11-13 16:37:46.387231"

},{

    "id": 7512,

    "parentid": 0,

    "createemployeecd": 1016,

    "createemployeename": "王五",

    "comment": "大体了解",

    "createtime": "2018-11-13 16:37:46.387231"

},{

    "id": 7513,

    "parentid": 7511,

    "createemployeecd": 1017,

    "createemployeename": "陈小六",

    "comment": "大体了解",

    "createtime": "2018-11-13 16:37:46.387231"

},{

    "id": 7514,

    "parentid": 7510,

    "createemployeecd": 1018,

    "createemployeename": "刘九",

    "comment": "大体了解",

    "createtime": "2018-11-13 16:37:46.387231"

}]

想根据id和parentid处理成下面这样的

[{

"main": {

"id": 7510,

"parentid": 0,

"createemployeecd": 1014,

"createemployeename": "张三",

"comment": "大体了解",

"createtime": "2018-11-13 16:37:46.387231"

},

"reply": [{

"id": 7511,

"parentid": 7510,

"createemployeecd": 1015,

"createemployeename": "李四",

"comment": "大体了解",

"createtime": "2018-11-13 16:37:46.387231"

}, {

"id": 7513,

"parentid": 7511,

"createemployeecd": 1017,

"createemployeename": "陈小六",

"comment": "大体了解",

"createtime": "2018-11-13 16:37:46.387231"

}, {

"id": 7514,

"parentid": 7510,

"createemployeecd": 1018,

"createemployeename": "刘九",

"comment": "大体了解",

"createtime": "2018-11-13 16:37:46.387231"

}]


}, {

"main": {

"id": 7512,

"parentid": 0,

"createemployeecd": 1016,

"createemployeename": "王五",

"comment": "大体了解",

"createtime": "2018-11-13 16:37:46.387231"

}

}]


评论区

sixmillions

2018-11-21 18:07

想问一下jfinal 有没有自带的方法?进行处理

热门反馈

扫码入社