-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
提供自定义分页的能力 #45
Comments
可通过@query注解关闭自动生成limit sql @Query(useAutoLimitSqlIfPagination=false)
Page<LotteryJoinerResponse> findJoinerWihtResouceListPage(Page<LotteryJoinerResponse> toPage, GetJoinerPageRequest request); 在sql文件里,自定义分页…… /**
* @name: findJoinerWihtResouceListPage
*/
select
t.*,
li.title as lottery_name,
res.res_path as res_value
from (
SELECT
lj.id,
lj.draw_count,
lj.`status`,
lj.joiner_address,
lj.joiner_id,
lj.joiner_user_name,
lj.joiner_nick_name,
lj.joiner_mobile,
lj.joiner_head_url,
lj.lottery_id
FROM
lottery_joiner lj
WHERE
lj.lottery_id = 100
ORDER BY
lj.update_at
limit :DbmQueryFirstResult, :DbmQueryMaxResult
) t
LEFT JOIN lottery_info li ON t.lottery_id = li.id
left JOIN cm_resource res on res.biz_id = t.id
/**
* @name: findJoinerWihtResouceListPage
* @property: countSql
*/
SELECT
count(1)
FROM
lottery_joiner lj
WHERE
lj.lottery_id = :request.lotteryId |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
现在的分页只能使用dbm内置的自动生成limit sql的方式分页。
有时候需要自定义分页,比如left join一对多查询分页时,这种自动分页的方式通常都是错的。
The text was updated successfully, but these errors were encountered: