Search in sources :

Example 1 with PerformanceInterceptor

use of com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor in project dynamic_dataSource by tianliuzhen.

the class MybatisPlusConfig method performanceInterceptor.

/**
 * 性能优化  复杂查询可能会报错 建议关掉
 * @return
 */
@Bean
public PerformanceInterceptor performanceInterceptor() {
    PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
    /*<!-- SQL 执行性能分析,开发环境使用,线上不推荐。 maxTime 指的是 sql 最大执行时长 -->*/
    performanceInterceptor.setMaxTime(1000);
    /*<!--SQL是否格式化 默认false-->*/
    performanceInterceptor.setFormat(false);
    return performanceInterceptor;
}
Also used : PerformanceInterceptor(com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor) Bean(org.springframework.context.annotation.Bean)

Example 2 with PerformanceInterceptor

use of com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor in project springboot-learning by lyb-geek.

the class MybatisPlusConfig method performanceInterceptor.

/**
 * 性能分析插件
 *
 * @return
 */
@Bean
public PerformanceInterceptor performanceInterceptor() {
    PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
    performanceInterceptor.setFormat(true);
    return performanceInterceptor;
}
Also used : PerformanceInterceptor(com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor) Bean(org.springframework.context.annotation.Bean)

Example 3 with PerformanceInterceptor

use of com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor in project spring-boot-web by wangchengming666.

the class MybatisPlusConfig method performanceInterceptor.

/**
 * plus 的性能优化,日志打印,开发环境使用
 *
 * @return
 */
@Bean
@ConditionalOnProperty(prefix = "spring.profiles", name = "active", havingValue = "dev")
public PerformanceInterceptor performanceInterceptor() {
    PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
    /**
     * <!-- SQL 执行性能分析,开发环境使用,线上不推荐。 maxTime 指的是 sql 最大执行时长 -->
     */
    performanceInterceptor.setMaxTime(200);
    /**
     * <!--SQL是否格式化 默认false-->
     */
    performanceInterceptor.setFormat(true);
    return performanceInterceptor;
}
Also used : PerformanceInterceptor(com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor) MybatisSqlSessionFactoryBean(com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean) Bean(org.springframework.context.annotation.Bean) ConditionalOnProperty(org.springframework.boot.autoconfigure.condition.ConditionalOnProperty)

Example 4 with PerformanceInterceptor

use of com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor in project springboot-learning by lyb-geek.

the class MybatisPlusConfig method performanceInterceptor.

/**
 * 性能分析插件
 *
 * @return
 */
@Bean
public PerformanceInterceptor performanceInterceptor() {
    PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
    performanceInterceptor.setFormat(true);
    return performanceInterceptor;
}
Also used : PerformanceInterceptor(com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor) Bean(org.springframework.context.annotation.Bean)

Example 5 with PerformanceInterceptor

use of com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor in project springboot-learning by lyb-geek.

the class MybatisPlusConfig method performanceInterceptor.

/**
 * 性能分析插件
 *
 * @return
 */
@Bean
public PerformanceInterceptor performanceInterceptor() {
    PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
    performanceInterceptor.setFormat(true);
    return performanceInterceptor;
}
Also used : PerformanceInterceptor(com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor) Bean(org.springframework.context.annotation.Bean)

Aggregations

PerformanceInterceptor (com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor)7 Bean (org.springframework.context.annotation.Bean)7 MybatisSqlSessionFactoryBean (com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean)1 ConditionalOnProperty (org.springframework.boot.autoconfigure.condition.ConditionalOnProperty)1 Profile (org.springframework.context.annotation.Profile)1