content: package com.wechat.bot.config;
  
  import com.baomidou.mybatisplus.annotation.DbType;
  import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
  import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
  import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
  import org.mybatis.spring.annotation.MapperScan;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  
  /**
   * @author Alex
   * @since 2025/1/27 17:34
   * <p></p>
   */
  
  @Configuration
  @MapperScan("com.wechat.bot.mapper")
  public class MybatisPlusConfig {
  
      /**
       * 3.4.0以后的mp版本，推荐用如下的配置方式
       **/
      @Bean
      public MybatisPlusInterceptor mybatisPlusInterceptor() {
  
          MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
          // 乐观锁插件
          interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
          // 分页插件  // 如果配置多个插件, 切记分页最后添加
          interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.SQLITE));
  
          return interceptor;
      }
  
  
  }
  