pagehelper use
Enter the official website to download jar package:
https://oss.sonatype.org/content/repositories/releases/com/github/pagehelper/pagehelper/
pagehelper-5.1.10.jar
http://repo1.maven.org/maven2/com/github/jsqlparser/jsqlparser/
jsqlparser-2.0.jar
Because the use of the process often jar package conflicts, it is recommended to download the two versions.
- The introduction of relevant jar.
2. Add pagehelper plug (mybatis profile )
! <- plugins position in the configuration file must meet the requirements, otherwise it will error, in the following order: the Properties , Settings?? , TypeAliases , typeHandlers?? , ObjectFactory , objectWrapperFactory?? , Plugins ? , Environments , databaseIdProvider ?, mappers? ? -> <plugins> <-! com.github.pagehelper to PageHelper class where the package name -> <plugin Interceptor = " com.github.pagehelper.PageInterceptor " > <-! use the following way configuration parameters, All parameters will be described later -> <Property name = " the param1 " value = "value1"/> </plugin> </plugins>
3. In the test code in the test unit
PageInfo contains all paging properties
// The current page
private int pageNum
private int pageNum
// page number of
private int pageSize
private int pageSize
// first element of the current page in the database line numbers
private int startRow
private int startRow
// the last element of the current page in the database line numbers
private int endRow
private int endRow
// total number of records
private long total
private long total
// total number of pages
private int pages
private int pages
// set the result (the data per page)
Private List <T> List
Private List <T> List
// First
private int firstPage
private int firstPage
// a former
private int prePage
private int prePage
// whether the first page of the
private boolean isFirstPage = false
private boolean isFirstPage = false
// is the last one
private boolean isLastPage = false
private boolean isLastPage = false
// Is there a previous
private boolean hasPreviousPage = false
private boolean hasPreviousPage = false
// Is there Next
private boolean hasNextPage = false
private boolean hasNextPage = false
// navigation page number of
private int navigatePages
private int navigatePages
All navigation page number //
private int [] navigatepageNums
private int [] navigatepageNums
The following Web site has more detailed insights. (reference)
https://www.cnblogs.com/kangoroo/p/7998433.html