商品列表 分组排序
This commit is contained in:
@@ -922,49 +922,51 @@
|
||||
select min( sku.suit ) as suit,tb.*
|
||||
from tb_product tb
|
||||
LEFT JOIN tb_product_sku sku ON tb.id = sku.product_id
|
||||
where tb.id in (${ids}) and is_show_mall =1 and sku.is_del = 0
|
||||
where tb.id in (${ids}) and sku.is_del = 0
|
||||
group by tb.id
|
||||
order by tb.sort asc
|
||||
</select>
|
||||
|
||||
<select id="selectByIdInAndCheck" resultMap="BaseResultMap">
|
||||
select min( sku.suit ) as suit,tb.*
|
||||
select min( sku.suit ) as suit,tb.*,sum(sku.real_sales_number) as stockNumber
|
||||
from tb_product tb
|
||||
LEFT JOIN tb_product_sku sku ON tb.id = sku.product_id
|
||||
where tb.id in (${ids}) and is_show_mall =1 and sku.is_del = 0 and sku.is_grounding=1 and tb.type_enum!='group' and tb.status = 1
|
||||
LEFT JOIN tb_product_sku sku ON tb.id = sku.product_id and sku.is_del = 0
|
||||
where tb.id in (${ids}) and tb.is_grounding=1 and tb.type_enum!='group' and tb.status = 1
|
||||
group by tb.id
|
||||
order by tb.sort asc
|
||||
</select>
|
||||
|
||||
<select id="selectHot" resultMap="BaseResultMap">
|
||||
select min(sku.suit) as suit, tb.*
|
||||
select min(sku.suit) as suit, tb.* ,realSalesNumber as stockNumber
|
||||
from tb_product tb
|
||||
LEFT JOIN tb_product_sku sku ON tb.id = sku.product_id
|
||||
JOIN (SELECT product_id
|
||||
JOIN (SELECT product_id ,SUM(real_sales_number) as realSalesNumber
|
||||
FROM tb_product_sku
|
||||
WHERE shop_id = #{shopId}
|
||||
and is_del = 0
|
||||
AND product_id IN
|
||||
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
GROUP BY product_id
|
||||
ORDER BY SUM(real_sales_number) DESC LIMIT 3) AS top_products ON tb.id = top_products.product_id
|
||||
where is_show_mall = 1
|
||||
and tb.status = 1
|
||||
ORDER BY stockNumber DESC LIMIT 3) AS top_products ON tb.id = top_products.product_id
|
||||
where
|
||||
tb.status = 1
|
||||
and tb.type_enum != 'group'
|
||||
and sku.is_del = 0
|
||||
and sku.is_grounding = 1
|
||||
and tb.is_grounding = 1
|
||||
group by tb.id
|
||||
order by tb.sort asc
|
||||
order by stockNumber desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectIsSpecialty" resultMap="BaseResultMap">
|
||||
select min(sku.suit) as suit, tb.*
|
||||
from tb_product tb
|
||||
LEFT JOIN tb_product_sku sku ON tb.id = sku.product_id
|
||||
LEFT JOIN tb_product_sku sku ON tb.id = sku.product_id and sku.is_del = 0
|
||||
where is_hot = 1
|
||||
and is_show_mall = 1
|
||||
and tb.shop_id = #{shopId}
|
||||
and tb.status = 1
|
||||
and sku.is_del = 0
|
||||
and sku.is_grounding = 1
|
||||
and tb.is_grounding = 1
|
||||
and tb.type_enum != 'group'
|
||||
group by tb.id
|
||||
order by tb.sort asc
|
||||
|
||||
Reference in New Issue
Block a user