赞
踩
-
- @Slf4j
-
- @Intercepts({
- @Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})
- })
- public class MyPlugin implements Interceptor {
- Transaction transaction;
- //方法拦截
- @Override
- public Object intercept(Invocation invocation) throws Throwable {
- //通过StatementHandler获取执行的sql
- StatementHandler executor = (StatementHandler) invocation.getTarget();
- ParameterHandler parameterHandler = executor.getParameterHandler();
- parameterHandler.getParameterObject();
- BoundSql boundSql = executor.getBoundSql();
- List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
-
- if (!CollectionUtils.isEmpty(parameterMappings)) {
- ParameterMapping parameterMapping = parameterMappings.get(0);
- Class clazz = parameterMapping.getClass();
- Field field

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。