I am developing an stateless API that needs to support pagination.
I use an Oracle database. I use Spring with MyBatis for database access.
From the docume
I tested on Postgres database and pagination from AngularUI. The first page is N°1, if you call page N°0, the services return all datas.
java Service:
public List selectAll(int currentPage, int itemsPerPage);
int offset = (currentPage - 1) * itemsPerPage;
RowBounds rowbounds;
if(currentPage == 0){
rowBounds = new RowBounds();
} else {
rowBounds = new RowBounds(currentPage, itemsPerPage);
}
return fooMapper.selectAll(rowBounds);
}
java Mapper:
public List selectAll(RowBounds rowbounds);
xml Mapper: