<iftest="query.belong != null"> and (`goods_sku`.`belong` = #{query.belong} or goods_sku.special_flag=1) </if>
<iftest="query.selectSpecialFlag != null and query.selectSpecialFlag == 1">
and `goods_sku`.`special_flag` = 1
and `goods_sku`.id = goods_spu.special_sku_id
</if>
<iftest="query.selectSpecialFlag != null and query.selectSpecialFlag == 0">
and `goods_sku`.`special_flag` = 0
and `goods_sku`.`special_flag` = #{query.selectSpecialFlag}
</if>
<iftest="query.orderFlag != null"> and `goods_sku`.`order_flag` = #{query.orderFlag}</if>
<iftest="query.orderFlag != null ">
and (`goods_sku`.`order_flag` = #{query.orderFlag} or `goods_sku`.`special_flag` = 1)
</if>
<iftest="query.keyword != null and query.keyword != '' ">
and (
@ -98,7 +97,9 @@
<iftest="query.cateSecondLabel != null and query.cateSecondLabel != ''"> and `cate2`.`name` like concat('%',#{query.cateSecondLabel},'%') </if>
<iftest="query.cateThirdLabel != null and query.cateThirdLabel != ''"> and `cate3`.`name` like concat('%',#{query.cateThirdLabel},'%') </if>
<iftest="query.categoryLast != null"> and `goods_spu`.`category_last` = #{query.categoryLast}</if>
<iftest="query.shelf != null and query.shelf != ''"> and `goods_spu`.`shelf` = #{query.shelf}</if>
<iftest="query.shelf != null"> and `goods_spu`.`shelf` = #{query.shelf}</if>
<iftest="query.costFlag != null"> and `goods_spu`.`cost_flag` = #{query.costFlag}</if>
<iftest="query.orderFlag != null"> and `goods_spu`.`order_flag` = #{query.orderFlag}</if>
<iftest="query.sort != null"> and `goods_spu`.`sort` = #{query.sort}</if>
<iftest="query.saleNum != null"> and `goods_spu`.`sale_num` = #{query.saleNum}</if>
<iftest="query.tasteValue != null and query.tasteValue != ''"> and `goods_spu`.`taste_value` like concat('%',#{query.tasteValue},'%') </if>
@ -163,7 +164,7 @@
FROM (
(SELECT sku.*,ROW_NUMBER() OVER(PARTITION BY sku.spu_id ORDER BY sku.belong_sort) AS rn FROM goods_sku sku WHERE sku.order_flag = 1 AND sku.special_flag = 0)
UNION ALL
SELECT sku.*,1 as rn FROM goods_sku sku WHERE sku.order_flag = 1 AND sku.special_flag = 1
SELECT sku.*,1 as rn FROM goods_sku sku WHERE sku.special_flag = 1
) AS goods_sku
left join goods_spu on goods_sku.spu_id = goods_spu.id
LEFT JOIN `goods_category` `cate1` ON `cate1`.`id` = `goods_spu`.`category_first`
@ -183,7 +184,7 @@
FROM (
(SELECT sku.*,ROW_NUMBER() OVER(PARTITION BY sku.spu_id ORDER BY sku.belong_sort) AS rn FROM goods_sku sku WHERE sku.order_flag = 1 AND sku.special_flag = 0)
UNION ALL
SELECT sku.*,1 as rn FROM goods_sku sku WHERE sku.order_flag = 1 AND sku.special_flag = 1
SELECT sku.*,1 as rn FROM goods_sku sku WHERE sku.special_flag = 1
) AS goods_sku
left join goods_spu on goods_sku.spu_id = goods_spu.id