有所有字段信息的数据,需要重新组织出表和字段的关系,并且字段是按照要求排序的。
原始数据中
“table_name”:字段所属表
“field_name“ : 字段名
“field_col_num":字段排序号
期待输出的结果是
{
"table_name" : [
"field_name",
"field_name",
....
]
}
测试数据如下:
原始数据:
[
{
"table_name": "dp",
"field_name": "dpcryptfeat",
"field_col_num": "6"
},
{
"table_name": "dp",
"field_name": "dppath",
"field_col_num": "4"
},
{
"table_name": "dp",
"field_name": "dpauthfeat",
"field_col_num": "5"
},
{
"table_name": "dp",
"field_name": "dpnick",
"field_col_num": "3"
},
{
"table_name": "icc",
"field_name": "iccbufsizeprot",
"field_col_num": "13"
},
{
"table_name": "icc",
"field_name": "iccmech",
"field_col_num": "5"
},
{
"table_name": "icc",
"field_name": "iccnick",
"field_col_num": "3"
},
{
"table_name": "icc",
"field_name": "iccprocmanager",
"field_col_num": "8"
},
{
"table_name": "icc",
"field_name": "iccdesc",
"field_col_num": "4"
},
{
"table_name": "icc",
"field_name": "iccprot",
"field_col_num": "6"
},
{
"table_name": "icc",
"field_name": "iccformatprot",
"field_col_num": "14"
}
]
输出结果:
{
"dp": [
"dpnick",
"dppath",
"dpauthfeat",
"dpcryptfeat"
],
"icc": [
"iccnick",
"iccdesc",
"iccmech",
"iccprot",
"iccprocmanager",
"iccbufsizeprot",
"iccformatprot"
]
}