SELECT
goods.id,
goods.goods_no,
goods.goods_img,
goods.goods_sale,
goods.goods_title,
goods.create_time,
goods.update_time,
goods.category_one,
goods.category_two,
goods.goods_content,
goods.goods_sort,
goods.goods_state,
goods.goods_recommend,
goods.version,
banner.id AS banner_id,
banner.goods_id AS banner_goods_id,
banner_uri,
spec.id AS spec_id,
spec.goods_id AS spec_goods_id,
spec.spec_img,
spec.spec_name,
spec.spec_title,
spec.spec_price,
spec.spec_stock,
ca. NAME AS category_one_name,
two. NAME AS category_two_name
FROM
(
SELECT
*
FROM
goods_info
LIMIT 0,
10
) goods
LEFT JOIN goods_banner banner ON goods.id = banner.goods_id
LEFT JOIN goods_spec spec ON goods.id = spec.goods_id
LEFT JOIN goods_category ca ON goods.category_one = ca.id
LEFT JOIN goods_category two ON goods.category_two = two.id
ORDER BY
goods.goods_sort DESC
简单来说,不推荐使用collection里面的select查询会造成n+1性能以及内存问题
难么就不使用pagehleper插件了
自己写limit 查询主表的时候
具体的详细等后面有时间了再写吧
这里做一个简单记录
后面有时间写写原因啥的
看懒不懒了