1.
Principle : interceptors.
Instructions:
RowBounds: Incoming RowBounds object mapper.java in method
//接口方法 public List<Honor> getHonorList(HashMap<String, Object> maps,RowBounds rowBounds); // call the method RowBounds RowBounds = new new RowBounds (offset, page.getPageSize ()); // offset start line // limit is this page show how many data RowBounds RowBounds = new new RowBounds (2, 2 ); List<Honor> honors = studentMapper.getHonorList(maps,rowBounds);
Mybatis RowBounds objects using paging, which is set for paging ResultSet execution result, rather than the physical page can be directly written with the parameters of the physical pages in the physical page is accomplished sql function may be used to complete the physical page tab widget .
The basic principle is to use the plug-in tab Mybatis plugin interface provided, to achieve a custom plug-ins, sql intercept interception to be performed within the insert method, and then rewrite the sql, according dialect dialect, add statements and physical page corresponding to the physical paging parameters.
For example: select * from overwriting the student, to intercept sql: select t * from (select * from student) t limit 0,10.
2.Mybatis plug PageHelper use paging query
https://blog.csdn.net/maoyuanming0806/article/details/77720754
Mybatis of a plug-in, PageHelper, very convenient mybatis paging query. Domestic cattle in an open source project, are interested can look at the source code, there are Chinese translations (ps: some source a lot of English, burst into tears!)
On github repository address: Mybatis-PageHelper
It supports basic mainstream and common database, which can be seen on its documentation. The basic method used here to record what
0. view the document prepared with the use of
development documentation in Chinese documents are also available in English Document
PageHelper official documents
The official address
https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/zh/HowToUse.md
Maven relies