[功能改进]: Interceptor支持afterUpdate/afterQuery操作
Author: itinychengCreated Jul 27, 2026Updated Jul 27, 2026
确认
- 我的版本是最新版本, 我的版本号与 version 相同, 并且项目里无依赖冲突
- 我已经在 issue 中搜索过, 确认问题没有被提出过
- 我已经修改标题, 将标题中的 描述 替换为你的想法(不得删除 描述 前面的部分)
功能改进
应用场景:audit log
- 需要对insert / update / delete操作进行记录,以备后续日志审计功能使用;
问题描述:
- DataChangeRecorderInnerInterceptor 已经deprecated 且容易出问题;
- 针对PK类型是
IdType.AUTO的表的 insert 操作,在beforeUpdate时拿不到id,无法记录保存;
需求:
- 可以直接使用mybatis本身的Interceptor实现afterUpdate,但有点割裂;
- 是否能扩展现有的MybatisPlusInterceptor 和 InnerInterceptor 添加afterUpdate; 哪怕只是一个hook,将内部实现留给user侧自己实现也行;
- 或是有其他更合理的设计,感觉功能确实有点缺失;
参考资料
No response
Source: baomidou/mybatis-plus