双重嵌套的json怎么玩???
例如
表a
id username ip
1 admin 178
2 lj 123
表b
nectid command
1 rmdir
1 cp
现在List<map<string,object>> list = jdbctemplate.queryforlist('select * from a');
接下来要怎么遍历list,并通过a.id作为查询条件从b表中查询对应的command(select * from b where b.nectid = a.id),
关键还要以嵌套json格式返回。就是这种格式:
[{"id":"1","username ":admin","ip":"178","command":[{"nectid":"1","command":"rmdir"},{"nectid":"1","command":"cp"}]},
{"id":"2","username ":"lj","ip":"123"}]