package com.copy.trade.config.mybatis;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@MapperScan({"com.copy.trade.dao*"})
public class MybatisPlusConfig {

    /**
     * mybatis-plus SQL执行效率插件【生产环境可以关闭】
     */
    @Bean
    @ConditionalOnProperty(prefix = "mybatis-plus.configuration",name = "log-performance",havingValue = "true",matchIfMissing = false)
    public BusinessPerformanceInterceptor performanceInterceptor() {
    	BusinessPerformanceInterceptor finPerformanceInterceptor = new BusinessPerformanceInterceptor();
    	finPerformanceInterceptor.setPreparedStatement(false);
        return finPerformanceInterceptor;
    }

    /**
     * mybatis-plus分页插件<br>
     * 文档：http://mp.baomidou.com<br>
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        return paginationInterceptor;
    }



}
