zhubaomin
2025-04-03 317dabcf4901fced12e75c0d3b442607fb479bec
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mybatis/PrintSqlInterceptor.java
@@ -8,6 +8,7 @@
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Signature;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
@@ -49,13 +50,14 @@
        if (args != null && args.length > 1) {
            MappedStatement mappedStatement = (MappedStatement) args[0];
            Object parameter = args[1];
            BoundSql boundSql = mappedStatement.getBoundSql(parameter);
            String sql = boundSql.getSql();
            log.info("\n\nSQL:\n" + sql + "\n");
            //System.out.println("SQL语句:" + sql);
            String sqlId = mappedStatement.getId();
            BoundSql boundSql = mappedStatement.getBoundSql(parameter);
            Configuration configuration = mappedStatement.getConfiguration();
            log.info("\nSQL Id: " + sqlId + "\nSQL Parameters: " + boundSql.getParameterObject() + "\nSQL: " + PrintSqlHelp.getFullSql(configuration, boundSql) + "\n");
        }
        return invocation.proceed();
    }
}