|
@@ -0,0 +1,34 @@
|
|
|
+package com.flyer.foster.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;
|
|
|
+import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|
|
+
|
|
|
+/**
|
|
|
+ * MybatisPlusConfig
|
|
|
+ *
|
|
|
+ * @author kelei
|
|
|
+ * @since 2022/3/25/15:53
|
|
|
+ */
|
|
|
+@Configuration
|
|
|
+@MapperScan("com.flyer.foster.mapper")
|
|
|
+@EnableTransactionManagement
|
|
|
+public class MybatisPlusConfig {
|
|
|
+ /**
|
|
|
+ * 乐观锁插件
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Bean
|
|
|
+ public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
|
|
+ MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
|
|
|
+ mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
|
|
|
+ mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
|
|
+ return mybatisPlusInterceptor;
|
|
|
+ }
|
|
|
+}
|