【发布时间】:2021-02-21 09:22:07
【问题描述】:
我有三张桌子:
1.视图表:
id type created_at status action_id
-----------------------------------------
1 page_1 2020-01-01 1 2
2。项目表:
id view_id image action_id
-------------------------------------
1 1 thumb.png 1
3.动作表:
id message
------------------------------------
1 this is a test
2 this an action for header view
我期待的结果是:
{
"status": 1,
"action": {
"message": "this an action for header view"
},
"items": [
{
"id": 1,
"description": "Comments",
"image": "comment.png",
"status": 1,
"action": {
message: "this is test"
}
}
]
}
另外,我已经通过one-to-one 和one-to-many 装饰器创建了所有具有所需关系的Entities。
那么如何在ViewRepository 中使用this.createQueryBuilder('view') 获得结果?
【问题讨论】:
标签: mysql node.js mariadb typeorm