har*_*rry 7 sql database node.js typescript typeorm
我如何将下面的代码转换为 typeorm querybuilder?我正在尝试遵循文档。
this.repository.manager.query(`
SELECT item.name, item.id
FROM item_location
INNER JOIN item ON item.id = item_location.itemId
WHERE item_location.locationId = ${queryObject.filter};
`)
Run Code Online (Sandbox Code Playgroud)
谢谢。
我想到了。
await getManager()
.createQueryBuilder(Item, 'item')
.select(['item.id', 'item.name'])
.innerJoin('item.location', 'location')
.where('location.id = :id', { id: queryObject.filter });
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7006 次 |
| 最近记录: |