Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How MyBatis realizes MySQL dynamic paging
How MyBatis realizes MySQL dynamic paging
In order to achieve the paging effect in these controls, two parameters are generally passed, the first is the reference of the current page (usually starting from 0), and the second is how many business records are displayed on the current page, and then the corresponding parameters are passed to the list.

In view of the above ideas, firstly, a new paging parameter entity class named PagenateArgs and an enumeration class named SortDirectionEnum are created under demo.mybatis.model, which contains the current pageIndex pageSize, and the current page displays the number of business records, and the pageStart property indicates which entry to start with. (pageStart=pageIndex*pageSize) Because the usage of the limit keyword means the initial number of articles (not included), take a few articles, orderFieldStr sort field, and orderDirectionStr sort direction, so the specific creation is as follows:

Package David.mybatis.model;

/*

* Paging parameter entity class

*/

Public class PagenateArgs {

private int pageIndex

private int pageSize

private int pageStart

Private string orderFieldStr

Private string orderDirectionStr

Public PagenateArgs() {

// TODO automatically generated constructor stub

}