我想獲得關系排序的用戶資料,但使用此代碼它只是對用戶進行排序,但我想對與我正在使用的用戶相關的資料進行排序,有人可以幫助我嗎?
getUerWithId(pramas: string): Observable<userEntity[]> {
return from(this.userRepository.find({
where: [
{ id: pramas }
],
order:{
id:'DESC'
}
}))
}
uj5u.com熱心網友回復:
對于存盤庫,我不知道是否可行,但您可以嘗試使用查詢構建器來獲取有序關系。按照下面的例子:
this.userRepository.createQueryBuilder()
.innerJoinAndSelect("User.notification", "Notification")
.orderBy({'Notification.createdAt': 'DESC'})
.where("User.id = :id", {
id: Number(id),
})
.getOne();
請記住為您的物體放置正確的關系,并為您的屬性放置正確的名稱。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/360563.html
標籤:PostgreSQL的 嵌套 打字机
上一篇:PostgreSQL一種使用IN和OR進行選擇的有效方法
下一篇:如何將資料合并為一行
