SELECT DISTINCT product.id
FROM productinfo product
LEFT JOIN tagproduct tp
ON tp.productid = product.id
LEFT JOIN tags
ON tags.id = tp.tagid
WHERE product.status = 1
AND ( product.deletedat IS NULL
OR product.deletedat > Now() )
AND EXISTS
(
SELECT Count(1)
FROM tagproduct
WHERE tagid IN (${tags})
AND productid = product.id
GROUP BY productid
HAVING count(1) >= ${tags.length} )
标签是标签表的id
,我不知道如何将其转换为orm.find