来看看呗

2019-06-22 15:21:56
  1. {
  2. "data": [{
  3. "id": 1,
  4. "name": "企业主体信用得分",
  5. "pid": null,
  6. "childrens": [{
  7. "id": 2,
  8. "name": "企业素质",
  9. "pid": 1,
  10. "childrens": [{
  11. "id": 5,
  12. "name": "基本信息",
  13. "pid": 2,
  14. "childrens": [{
  15. "id": 10,
  16. "name": "企业主体信息识别",
  17. "pid": 5,
  18. "childrens": []
  19. },
  20. {
  21. "id": 11,
  22. "name": "企业持续注册时间",
  23. "pid": 5,
  24. "childrens": []
  25. },
  26. {
  27. "id": 12,
  28. "name": "注册资本",
  29. "pid": 5,
  30. "childrens": []
  31. }
  32. ]
  33. },
  34. {
  35. "id": 6,
  36. "name": "管理认证",
  37. "pid": 2,
  38. "childrens": [{
  39. "id": 13,
  40. "name": "国际性管理认证",
  41. "pid": 6,
  42. "childrens": []
  43. }]
  44. }
  45. ]
  46. },
  47. {
  48. "id": 3,
  49. "name": "履约记录",
  50. "pid": 1,
  51. "childrens": [{
  52. "id": 7,
  53. "name": "税务执行情况",
  54. "pid": 3,
  55. "childrens": [{
  56. "id": 14,
  57. "name": "是否按时缴纳税款",
  58. "pid": 7,
  59. "childrens": []
  60. }]
  61. },
  62. {
  63. "id": 8,
  64. "name": "网贷情况",
  65. "pid": 3,
  66. "childrens": [{
  67. "id": 15,
  68. "name": "网贷逾期",
  69. "pid": 8,
  70. "childrens": []
  71. }]
  72. }
  73. ]
  74. },
  75. {
  76. "id": 4,
  77. "name": "公共监督",
  78. "pid": 1,
  79. "childrens": [{
  80. "id": 9,
  81. "name": "行政处罚",
  82. "pid": 4,
  83. "childrens": [{
  84. "id": 16,
  85. "name": "处罚信息",
  86. "pid": 9,
  87. "childrens": []
  88. }]
  89. }]
  90. }
  91. ]
  92. }]
  93. }

数据有张机构表,里面有id(机构id),name(机构名称),pid(上级机构)字段,请问后台把数据查出来怎么构造成这种json数据。


0
0
0

添加评论

正在回复:
取消
2
0
0
0