May 16, 2021 MyBatis
1. The original method, using limit, needs to handle the plying logic yourself:
For mysql databases you can use limit, such as:
select * from table limit 5; --返回前5行
select * from table limit 0,5; --同上,返回前5行
select * from table limit 5,10; --返回6-15行
Rownum can be used for oracle databases, such as:
-- For example, 20 records Sys_option be retrieved from the table sys_id (the primary key is sys_id), as follows
SELECT * FROM (SELECT ROWNUM R,t1.* From Sys_option where rownum < 30 ) t2
Where t2.R >= 10
2.
Intercept StateHandler, whose
essence is to generate a limit statement at the end
See: www.cnblogs.com/jcli/archive/2011/08/09/2132222.html
3.
Using the PageHelper plug-in
is a more common approach today:
Because the length is too long and detailed process to read the original text: www.cnblogs.com/digdeep/p/4608933.html