mybatis 一对多 pagelper 分页问题

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 查询主表的时候

具体的详细等后面有时间了再写吧

这里做一个简单记录

后面有时间写写原因啥的

看懒不懒了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值