|
@@ -0,0 +1,25 @@
|
|
|
|
|
+package com.poyee.config;
|
|
|
|
|
+
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
|
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * MyBatis-Plus 配置
|
|
|
|
|
+ */
|
|
|
|
|
+@Configuration
|
|
|
|
|
+public class MybatisPlusConfig {
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 配置 MyBatis-Plus 拦截器
|
|
|
|
|
+ * 包含乐观锁插件
|
|
|
|
|
+ */
|
|
|
|
|
+ @Bean
|
|
|
|
|
+ public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
|
|
|
|
+ MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
|
|
|
|
+ // 乐观锁插件
|
|
|
|
|
+ interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
|
|
|
|
|
+ return interceptor;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|