1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 |
public class Pager { private int pageIndex; private int pageSize; private int pageStart; private String orderField; private String orderDirection; //提供getter,setter public enum OrderDriection{ ASC,DESC } public Pager(){} public Pager( int pageIndex, int pageSize){ this .pageIndex=pageIndex; this .pageSize=pageSize; this .pageStart= this .pageIndex* this .pageSize; } public Pager( int pageIndex, int pageSize,String orderField,String orderDirection){ this (pageIndex,pageSize); this .orderField=orderField; this .orderDirection=orderDirection; } } |
1 |
public List<Posts> getListByPage(Pager pager); |
1
2
3 |
<select id= "getListByPage" parameterType= "Pager" resultMap= "postList" > select * from posts limit #{pageStart},#{pageSize} </select> |