|
|
@ -843,6 +843,30 @@ |
|
|
|
ORDER BY (f.number + a.fictitious_number) DESC LIMIT 4 |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="findAllSimilarProducts" parameterType="java.lang.Object" resultType="com.shop.cereshop.app.page.index.Product"> |
|
|
|
SELECT a.shop_id,d.shop_name,a.product_id,a.product_name,c.product_image image, |
|
|
|
b.price,b.sku_id,b.original_price,a.product_brief,g.users from cere_shop_product a |
|
|
|
LEFT JOIN (SELECT a.product_id,a.price,a.sku_id,a.original_price from cere_product_sku a,cere_shop_product b |
|
|
|
where a.product_id=b.product_id GROUP BY a.product_id) b ON a.product_id=b.product_id |
|
|
|
LEFT JOIN (SELECT a.product_id,a.product_image from cere_product_image a,cere_shop_product b |
|
|
|
where a.product_id=b.product_id GROUP BY a.product_id) c ON a.product_id=c.product_id |
|
|
|
LEFT JOIN cere_platform_shop d ON a.shop_id=d.shop_id |
|
|
|
LEFT JOIN (SELECT IF(SUM(number) IS NULL,0,SUM(number)) number,sku_id,order_id from cere_order_product GROUP BY sku_id) f ON b.sku_id=f.sku_id |
|
|
|
LEFT JOIN (SELECT COUNT(a.buyer_user_id) users,a.product_id FROM (SELECT b.buyer_user_id,a.product_id FROM cere_order_product a,cere_shop_order b |
|
|
|
where a.order_id=b.order_id and b.state in (2,3,4) GROUP BY a.product_id,b.buyer_user_id) a GROUP BY a.product_id) g ON a.product_id=g.product_id |
|
|
|
where d.state=1 |
|
|
|
<if test="project == 0"> |
|
|
|
and a.plat_shelve_state=1 |
|
|
|
</if> |
|
|
|
<if test="project!=0 and project != ''"> |
|
|
|
and a.shelve_state=1 |
|
|
|
</if> |
|
|
|
<if test="classifyId!=null"> |
|
|
|
and (a.classify_id=#{classifyId} OR a.classify_business_id=#{classifyId}) |
|
|
|
</if> |
|
|
|
ORDER BY (f.number + a.fictitious_number) DESC |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="getRandomSortProduct" resultType="com.shop.cereshop.app.page.index.Product"> |
|
|
|
SELECT a.shop_id, |
|
|
|
d.shop_name, |
|
|
|