目前我有 3 个模型User:Collection和Item。
AUser有很多Items通过Collections
AnItem有很多Users通过Collections
要获得User' 的集合,我可以做user.items相应的显示。
我想要做的是聚合这个列表的重复项。
说一个User添加Item 1,然后Item 2再另一个Item 1。
清单应该是:
User
-Item 1 Name - Item 1 Description - Item 1 Category - Qty 2
-Item 2 Name - Item 2 Description - Item 2 Category - Qty 1