| | |
| | | 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; |
| | | |
| | |
| | | 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(); |
| | | } |
| | | |
| | | } |