public class PageInterceptorPlugin extends Object implements SqlInterceptor, PagePluginType
| 构造器和说明 |
|---|
PageInterceptorPlugin() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
afterExecution(PreparedSql preparedSql,
Object applyResult,
Exception exception)
在 SQL 执行完成或发生异常后执行的拦截逻辑。
|
ExecutionControl |
beforeExecution(SqlStatementWrapper sqlStatementWrapper,
Connection connection)
在 SQL 执行之前的拦截逻辑。
|
String |
getPluginName() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetOrder, retrieveSkippedResultpublic ExecutionControl beforeExecution(SqlStatementWrapper sqlStatementWrapper, Connection connection)
SqlInterceptor此方法允许开发者在 SQL 被真正执行之前介入,进行检查、修改或控制。 通过返回值控制后续行为,包括继续执行、跳过执行或终止执行。
beforeExecution 在接口中 SqlInterceptorsqlStatementWrapper - 包含原始 SQL、解析后的参数及上下文信息的包装对象,
可用作 SQL 检查或动态修改的依据。connection - 数据库连接,允许拦截器基于连接执行必要的前置逻辑(如连接状态检查)。ExecutionControl 枚举值:
PROCEED 表示继续执行 SQL 或后续拦截器。SKIP 表示跳过 SQL 的实际执行,但仍会进入 SqlInterceptor.afterExecution(com.dynamic.sql.core.database.PreparedSql, java.lang.Object, java.lang.Exception) 逻辑。public void afterExecution(PreparedSql preparedSql, Object applyResult, Exception exception)
SqlInterceptor此方法提供一个统一的回调,无论 SQL 正常执行完成或因异常中断均会触发。 可用于记录日志、清理资源或统计执行结果等操作。
afterExecution 在接口中 SqlInterceptorpreparedSql - 执行的 SQL 语句及其参数的预处理对象。可以用于记录或分析 SQL。applyResult - SQL 执行后的返回结果。如果 SQL 未实际执行,可能为 null。exception - 执行过程中可能抛出的异常。如果没有异常则为 null。public String getPluginName()
getPluginName 在接口中 PagePluginTypeCopyright © 2024–2025 Dynamic-SQL. All rights reserved.