@Signature(type=org.apache.ibatis.executor.statement.StatementHandler.class,method="query",args={java.sql.Statement.class,org.apache.ibatis.session.ResultHandler.class}) @Signature(type=org.apache.ibatis.executor.statement.StatementHandler.class,method="update",args=java.sql.Statement.class) @Signature(type=org.apache.ibatis.executor.statement.StatementHandler.class,method="batch",args=java.sql.Statement.class)
public class MybatisSqlCompletePrintInterceptor
extends Object
implements org.apache.ibatis.plugin.Interceptor, org.springframework.core.Ordered
主要是因为PageHelp处理的时候,直接调用Executor的方法进行处理,没有调用invocation.proceed() 下一个拦截器处理,直接处理SQL
的修改,因此,将这个拦截设置到最后的查询阶段去处理哦
executor.query(ms, parameter, rowBounds, resultHandler, cacheKey, boundSql)
因此拦截StatementHandler 肯定不会错误【StatementHandler,语句处理器负责和JDBC层具体交互,包括prepare语句,执行语句,以及调用ParameterHandler.parameterize()设置参数】
| 构造器和说明 |
|---|
MybatisSqlCompletePrintInterceptor(org.apache.ibatis.session.Configuration configuration) |
public MybatisSqlCompletePrintInterceptor(org.apache.ibatis.session.Configuration configuration)
public Object intercept(org.apache.ibatis.plugin.Invocation invocation) throws Throwable
intercept 在接口中 org.apache.ibatis.plugin.InterceptorThrowablepublic void setProperties(Properties properties)
setProperties 在接口中 org.apache.ibatis.plugin.Interceptorpublic int getOrder()
getOrder 在接口中 org.springframework.core.OrderedCopyright © 2024. All rights reserved.