1
我需要給我的Angular JS應用程序提供一個JSON,它表示表格的父子關係。 母公司(集團):使用PlayFramework的JSON中的父母 - 孩子關係
+----+---------------+-------------+----------------+
| id | external_code | supplier_id | notes |
+----+---------------+-------------+----------------+
| 19 | asdfas | 3 | sadfa |
| 23 | 454 | 1 | groupa1 |
| 24 | sadfas221 | 2 | asfd |
| 25 | dsafas | 2 | NULL |
| 21 | 4545 | 1 | asdfasf |
+----+---------------+-------------+----------------+
兒童(GroupItems):
+----------+---------+--------+
| group_id | item_id | status |
+----------+---------+--------+
| 19 | 1 | 0 |
| 19 | 2 | 0 |
| 19 | 3 | 0 |
| 25 | 2 | 0 |
+----------+---------+--------+
我期望的JSON應該是這樣的:
[
{"groupId":"19",
"notes":"sadfa",
"extenalCode":"asdfas",
"supplierId":"2",
"itemCount":3
"items":[{"itemId": "1","status":"Created", "weight":23},
{"itemId": "2","status":"Created", "weight":23}
{"itemId": "3","status":"Created", "weight":23}
]
},
....
]
的問題是如何插入和綁定子項父代表使用MySQL和PlayFramework2.0(Slick)的JSON語義?
地圖嵌套文檔的順序爲文件數序列,每個嵌套levenl並添加父標識。然後使用insertAll來插入每個這些序列的頂級項目? – cvogt 2014-09-25 05:21:57
@cvogt你能詳細解釋一下嗎?我對scala和流暢的API非常陌生。 – 2014-09-25 06:04:47
誤讀你的問題,你不是在詢問數據庫插入,對吧? – cvogt 2014-10-02 23:49:49