@Signature(type=org.apache.ibatis.executor.statement.StatementHandler.class,method="prepare",args={java.sql.Connection.class,java.lang.Integer.class}) @Signature(type=org.apache.ibatis.executor.resultset.ResultSetHandler.class,method="handleResultSets",args=java.sql.Statement.class) public class PageHelper extends Object implements org.apache.ibatis.plugin.Interceptor
Modifier and Type | Field and Description |
---|---|
static ThreadLocal<Page> |
localPage |
Constructor and Description |
---|
PageHelper() |
Modifier and Type | Method and Description |
---|---|
static Page |
endPage()
结束分页并返回结果,该方法必须被调用,否则localPage会一直保存下去,直到下一次startPage
|
Object |
intercept(org.apache.ibatis.plugin.Invocation invocation) |
Object |
plugin(Object target)
只拦截这两种类型的
StatementHandler ResultSetHandler |
void |
setProperties(Properties properties) |
static void |
startPage(int pageNum,
int pageSize)
开始分页
|
public static final ThreadLocal<Page> localPage
public static void startPage(int pageNum, int pageSize)
pageNum
- pageSize
- public static Page endPage()
public Object intercept(org.apache.ibatis.plugin.Invocation invocation) throws Throwable
intercept
in interface org.apache.ibatis.plugin.Interceptor
Throwable
public Object plugin(Object target)
plugin
in interface org.apache.ibatis.plugin.Interceptor
target
- public void setProperties(Properties properties)
setProperties
in interface org.apache.ibatis.plugin.Interceptor
Copyright © 2021. All rights reserved.