1、执行sql语句,根据商品销量来进行分页查询
SELECT
goods_spu.*
FROM
goods_spu goods_spu
WHERE goods_spu.`shop_id` = '1450999734971478018'
AND goods_spu.`shelf` = 1
AND goods_spu.tenant_id = '1'
ORDER BY goods_spu.sale_num DESC
LIMIT 0,10
当所有商品销量都为0或者都一样的情况下就会出现不同分页参数情况下会出现重复的商品
2、解决办法
增加排序条件
可改成:
SELECT
goods_spu.*
FROM
goods_spu goods_spu
WHERE goods_spu.`shop_id` = '1450999734971478018'
AND goods_spu.`shelf` = 1
AND goods_spu.tenant_id = '1'
ORDER BY goods_spu.sale_num DESC,goods_spu.id
LIMIT 0,10