类 DataChangeRecorderInnerInterceptor
java.lang.Object
com.baomidou.mybatisplus.extension.plugins.inner.DataChangeRecorderInnerInterceptor
- 所有已实现的接口:
com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor
public class DataChangeRecorderInnerInterceptor
extends Object
implements com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor
数据变动记录插件 默认会生成一条log,格式: ----------------------INSERT LOG------------------------------
{ "tableName": "h2user", "operation": "insert", "recordStatus": "true", "changedData": [ { "LAST_UPDATED_DT": "null->2022-08-22 18:49:16.512", "TEST_ID": "null->1561666810058739714", "AGE": "null->THREE" } ], "cost(ms)": 0 }
* ----------------------UPDATE LOG------------------------------
{ "tableName": "h2user", "operation": "update", "recordStatus": "true", "changedData": [ { "TEST_ID": "102", "AGE": "2->THREE", "FIRSTNAME": "DOU.HAO->{\"json\":\"abc\"}", "LAST_UPDATED_DT": "null->2022-08-22 18:49:16.512" } ], "cost(ms)": 0 }
- 作者:
- yuxiaobin
-
嵌套类概要
嵌套类修饰符和类型类说明static classstatic classstatic classstatic classstatic classstatic class -
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected booleanallowProcess(String sql) 判断哪些SQL需要处理 默认INSERT/UPDATE/DELETE语句voidbeforePrepare(org.apache.ibatis.executor.statement.StatementHandler sh, Connection connection, Integer transactionTimeout) configTableLimitation(String tableName, int limit) protected voiddealOperationResult(DataChangeRecorderInnerInterceptor.OperationResult operationResult) 处理数据更新结果,默认打印getUpdatedColumnDatas(String tableName, org.apache.ibatis.mapping.BoundSql updateSql, net.sf.jsqlparser.statement.Statement statement) processDelete(net.sf.jsqlparser.statement.delete.Delete deleteStmt, org.apache.ibatis.mapping.MappedStatement mappedStatement, org.apache.ibatis.mapping.BoundSql boundSql, Connection connection) processInsert(net.sf.jsqlparser.statement.insert.Insert insertStmt, org.apache.ibatis.mapping.BoundSql boundSql) processUpdate(net.sf.jsqlparser.statement.update.Update updateStmt, org.apache.ibatis.mapping.MappedStatement mappedStatement, org.apache.ibatis.mapping.BoundSql boundSql, Connection connection) setBatchUpdateLimit(int limit) 设置批量更新记录条数上限voidsetProperties(Properties properties) ignoredColumns = TABLE_NAME1.COLUMN1,COLUMN2; TABLE2.COLUMN1,COLUMN2; TABLE3.*; *.COLUMN1,COLUMN2 多个表用分号分隔 TABLE_NAME1.COLUMN1,COLUMN2 : 表示忽略这个表的这2个字段 TABLE3.*: 表示忽略这张表的INSERT/UPDATE,delete暂时还保留 *.COLUMN1,COLUMN2:表示所有表的这个2个字段名都忽略从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor
beforeGetBoundSql, beforeQuery, beforeUpdate, willDoQuery, willDoUpdate
-
字段详细资料
-
logger
protected final org.slf4j.Logger logger -
IGNORED_TABLE_COLUMN_PROPERTIES
- 另请参阅:
-
-
构造器详细资料
-
DataChangeRecorderInnerInterceptor
public DataChangeRecorderInnerInterceptor()
-
-
方法详细资料
-
beforePrepare
public void beforePrepare(org.apache.ibatis.executor.statement.StatementHandler sh, Connection connection, Integer transactionTimeout) - 指定者:
beforePrepare在接口中com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor
-
allowProcess
判断哪些SQL需要处理 默认INSERT/UPDATE/DELETE语句- 参数:
sql-- 返回:
-
dealOperationResult
protected void dealOperationResult(DataChangeRecorderInnerInterceptor.OperationResult operationResult) 处理数据更新结果,默认打印- 参数:
operationResult-
-
processInsert
public DataChangeRecorderInnerInterceptor.OperationResult processInsert(net.sf.jsqlparser.statement.insert.Insert insertStmt, org.apache.ibatis.mapping.BoundSql boundSql) -
processUpdate
public DataChangeRecorderInnerInterceptor.OperationResult processUpdate(net.sf.jsqlparser.statement.update.Update updateStmt, org.apache.ibatis.mapping.MappedStatement mappedStatement, org.apache.ibatis.mapping.BoundSql boundSql, Connection connection) -
getUpdatedColumnDatas
-
processDelete
public DataChangeRecorderInnerInterceptor.OperationResult processDelete(net.sf.jsqlparser.statement.delete.Delete deleteStmt, org.apache.ibatis.mapping.MappedStatement mappedStatement, org.apache.ibatis.mapping.BoundSql boundSql, Connection connection) -
setBatchUpdateLimit
设置批量更新记录条数上限- 参数:
limit-- 返回:
-
openBatchUpdateLimitation
-
configTableLimitation
-
setProperties
ignoredColumns = TABLE_NAME1.COLUMN1,COLUMN2; TABLE2.COLUMN1,COLUMN2; TABLE3.*; *.COLUMN1,COLUMN2 多个表用分号分隔 TABLE_NAME1.COLUMN1,COLUMN2 : 表示忽略这个表的这2个字段 TABLE3.*: 表示忽略这张表的INSERT/UPDATE,delete暂时还保留 *.COLUMN1,COLUMN2:表示所有表的这个2个字段名都忽略- 指定者:
setProperties在接口中com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor- 参数:
properties-
-