Pagination is commonly used in daily development design. Today's tutorial will introduce two methods to help us achieve pagination in Mybatis.
One: RowBounds method inside Mybatis.
There is a default Class in Mybatis package called RowBounds that can help us paginate our pages automatically.
public class RowBounds {
public static final int NO_ROW_OFFSET = 0;
public static final int NO_ROW_LIMIT = 2147483647;
public static final RowBounds DEFAULT = new RowBounds();
private final int offset;
private final int limit;
public RowBounds() {
this.offset = 0;
this.limit = 2147483647;
}
public RowBounds(int offset, int limit) {
this.offset = offset;
this.limit = limit;
}
public int getOffset() {
return this.offset;
}
public int getLimit() {
return this.limit;
}
}
Here is the RowBounds c