pagination - Select records by first row and page size -
i'm trying implement lazy loading , pagination in front end. i've been supplied following 2 variables front end:
firstrow
- index of first record return in results of select query.pagesize
- total size of records select query must return, starting @firstrow
.
how can use them in select query in mybatis in order return desired subset of records?
there not magic pagination in mybatis write query subset using row number. pagination syntax vary depending on database, here oracle example.
select * ( select r.*, rownum rnum, (# base query goes here #) r ) rnum >= (#{firstrow}) , rnum < #{firstrow} + #{pagesize}
Comments
Post a Comment