SELECT b.shop_id,d.shop_name,d.shop_logo,a.product_id,b.product_name, ifnull(x.users, 0) + b.fictitious_number as users, h.start_time,h.end_time,h.state,
SELECT b.shop_id,d.shop_name,d.shop_logo,
a.product_id,b.product_name,
ifnull(x.users, 0) + b.fictitious_number as users,
h.start_time,h.end_time,h.state,
IF(m.image IS NULL OR m.image='',c.product_image,m.image) image,h.if_enable,h.enable_time,
a.price,a.sku_id,n.price original_price,IF(f.number IS NULL, b.fictitious_number, f.number + b.fictitious_number) number,n.stock_number FROM cere_shop_group_work_detail a
LEFT JOIN cere_shop_product b ON a.product_id=b.product_id
a.price,a.sku_id,n.price original_price,IF(f.number IS NULL, b.fictitious_number, f.number + b.fictitious_number) number,
n.stock_number
FROM cere_shop_group_work_detail a
INNER JOIN cere_shop_product 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 b.shop_id=d.shop_id
INNER JOIN cere_platform_shop d ON b.shop_id=d.shop_id
LEFT JOIN cere_product_classify e ON b.classify_id=e.classify_id
LEFT JOIN cere_product_classify cpcb ON b.classify_business_id=cpcb.classify_id
LEFT JOIN (SELECT SUM(number) number,sku_id,order_id from cere_order_product GROUP BY sku_id) f ON a.sku_id=f.sku_id
LEFT JOIN cere_shop_order g ON f.order_id=g.order_id and g.state in (2,3,4)
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
@ -617,7 +629,8 @@
and b.shelve_state=#{shelveState}
</if>
<iftest="classifyId!=null">
and (b.classify_id=#{classifyId} OR e.classify_level_hierarchy like concat('%/',#{classifyId},'%'))
and (b.classify_id=#{classifyId} OR e.classify_level_hierarchy like concat('%/',#{classifyId},'%')
OR b.classify_business_id=#{classifyId} OR cpcb.classify_level_hierarchy like concat('%/',#{classifyId},'%'))
</if>
<iftest="ids!=null and ids.size()>0">
and a.product_id in (
@ -639,6 +652,7 @@
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 b.shop_id=d.shop_id
LEFT JOIN cere_product_classify e ON b.classify_id=e.classify_id
LEFT JOIN cere_product_classify cpcb ON b.classify_business_id=cpcb.classify_id
LEFT JOIN (SELECT SUM(number) number,sku_id,order_id from cere_order_product GROUP BY sku_id) f ON a.sku_id=f.sku_id
LEFT JOIN cere_shop_order g ON f.order_id=g.order_id and g.state in (2,3,4)
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
@ -659,7 +673,8 @@
and b.shelve_state=#{shelveState}
</if>
<iftest="classifyId!=null">
and (b.classify_id=#{classifyId} OR e.classify_level_hierarchy like concat('%/',#{classifyId},'%'))
and (b.classify_id=#{classifyId} OR e.classify_level_hierarchy like concat('%/',#{classifyId},'%')
OR b.classify_business_id=#{classifyId} OR cpcb.classify_level_hierarchy like concat('%/',#{classifyId},'%'))
</if>
<iftest="ids!=null and ids.size()>0">
and a.product_id in (
@ -681,6 +696,7 @@
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 b.shop_id=d.shop_id
LEFT JOIN cere_product_classify e ON b.classify_id=e.classify_id
LEFT JOIN cere_product_classify cpcb ON b.classify_business_id=cpcb.classify_id
LEFT JOIN (SELECT SUM(number) number,sku_id,order_id from cere_order_product GROUP BY sku_id) f ON a.sku_id=f.sku_id
LEFT JOIN cere_shop_order g ON f.order_id=g.order_id and g.state in (2,3,4)
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
@ -701,7 +717,8 @@
and b.shelve_state=#{shelveState}
</if>
<iftest="classifyId!=null">
and (b.classify_id=#{classifyId} OR e.classify_level_hierarchy like concat('%/',#{classifyId},'%'))
and (b.classify_id=#{classifyId} OR e.classify_level_hierarchy like concat('%/',#{classifyId},'%')
OR b.classify_business_id=#{classifyId} OR cpcb.classify_level_hierarchy like concat('%/',#{classifyId},'%'))