| | |
| | | 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); |
| | | //BoundSql boundSql = mappedStatement.getBoundSql(parameter); |
| | | //String sql = boundSql.getSql(); |
| | | //log.info("\n\nSQL:\n" + sql + "\n"); |
| | | |
| | | String sqlId = mappedStatement.getId(); |
| | | BoundSql boundSql = mappedStatement.getBoundSql(parameter); |
| | | Configuration configuration = mappedStatement.getConfiguration(); |
| | | log.info("SQL Parameters: {}", boundSql.getParameterObject()); |
| | | log.info("SQL Id: {}", sqlId); |
| | | log.info("SQL: {}", PrintSqlHelp.getFullSql(configuration, boundSql)); |
| | | } |
| | | |
| | | return invocation.proceed(); |
| | | } |
| | | |
| | | } |