我有一个复杂的递归查询,需要使用带有 myrespository.query()
的原始 SQL 来执行。 typeORM 如何使用query
方法填充实体关系?
我尝试了很多不同的东西,但都没有成功。我终于解决了使用 .query() 方法获取用户 ID 然后使用的解决方法:
return await myrepository.findByIds(ids, {
relations: [
'referredUsers',
'referredUsers.productAccounts',
'productAccounts',
'productAccounts.product',
],
});
}