提交 72496e9e 编写于 作者: E Erwin

feat: mybatis-plus config

上级 ecaca81f
......@@ -14,6 +14,7 @@
<groupId>com.fengwenyi</groupId>
<artifactId>MyBatis-Plus-Example</artifactId>
<version>3.2.1-BUILD</version>
<packaging>jar</packaging>
<name>MyBatis-Plus-Example</name>
<description>Spring Boot 整合 MyBatis Plus 实例</description>
......
package com.fengwenyi.mybatisplusexample.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
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 Erwin Feng
* @since 2021-03-08
*/
@Configuration
@MapperScan("com.fengwenyi.mybatisplusexample.mapper")
public class MyBatisPlusConfiguration {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
}
package com.fengwenyi.mybatisplusexample;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class MybatisPlusExampleApplicationTests {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册