私は、次のエンティティがあります複雑なフィルタsequelize JS
Product [id, name]
Properties [id, name, product_id]
Values [id, name, property_id]
Offer [id, product_id]
OfferDetail [offer_id, property_id, value_id]
私はsequelizeで、次のフィルタをしたい:
対応する値を持つすべての製品を返しますproduct_id
[property_1, value_1], [property_2, value_2], ...
を。
例:
Products
[{1, Potato}, {2, Tomato}]
Properties
[{1, Color, 1}, {2, Size, 1}, {3, Size, 2}]
Values
[{1, White, 1}, {2, Red, 1}, {3, Small, 2}, {4, Big, 2}, {5, Medium, 2}, {6, Small, 3}, {7, Big, 3}]
Offer
[{1, 1}, {2, 1}, {3, 2}] (I have 3 offers, 2 for potato and 1 for tomato)
OfferDetail
[{1, 1, 1}, {1, 2, 3}, {2, 1, 2}, {3, 3, 6}]
meaning:
Potato: {Color White}, {Size Small}
Potato: {Color Red}
Tomato: {Size Small}
I want to be able to filter:
Potato Small
Potato (White or Red)
or a mix of them.
おかげで複雑なクエリのこのタイプの
私は実際に結果を理解していません、あなたはそれをさらに説明したり、例を見せたりできますか? –