Mybatis-plus性能分析插件—PerformanceInterceptor

#性能分析插件
性能分析拦截器,用于显示每条 SQL 语句及其执行时间

使用如下:


 ....


    
    
    
    



@SpringBootApplication
@MapperScan("com.aiyi.springbootplus.dao")
public class SpringbootPlusApplication {
  /**
 * SQL执行效率插件
 */
@Bean
public PerformanceInterceptor performanceInterceptor() {
    PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
    return new PerformanceInterceptor();
}
}

如果该性能分析插件是3.2.0 以上版本移除推荐使用第三方扩展 执行 SQL 分析打印 功能

使用如下:

@SpringBootApplication
@MapperScan("com.aiyi.springbootplus.dao")
public class SpringbootPlusApplication {
/**
 * SQL执行效率插件
 */
@Bean
public PerformanceInterceptor performanceInterceptor() {
    PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
    // maxTime 指的是 sql 最大执行时长 
    performanceInterceptor.setMaxTime(5000);
    //SQL是否格式化 默认false 
    performanceInterceptor.setFormat(true);
    return new PerformanceInterceptor();
}
}

控制台:
Mybatis-plus性能分析插件—PerformanceInterceptor_第1张图片

你可能感兴趣的:(Mybatis-plus性能分析插件—PerformanceInterceptor)