新增 MybatisPlus 配置
This commit is contained in:
parent
83d52fdc37
commit
b8953ee3d3
@ -0,0 +1,25 @@
|
|||||||
|
package net.rzdata.demo.config;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class MybatisPlusConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加插件
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||||
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||||
|
// 分页插件
|
||||||
|
interceptor.addInnerInterceptor(paginationInnerInterceptor());
|
||||||
|
return interceptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PaginationInnerInterceptor paginationInnerInterceptor() {
|
||||||
|
return new PaginationInnerInterceptor();
|
||||||
|
}
|
||||||
|
}
|
@ -1,2 +1,3 @@
|
|||||||
net.rzdata.demo.exception.GlobalExceptionHandler
|
net.rzdata.demo.exception.GlobalExceptionHandler
|
||||||
net.rzdata.demo.config.DemoConfig
|
net.rzdata.demo.config.DemoConfig
|
||||||
|
net.rzdata.demo.config.MybatisPlusConfig
|
||||||
|
@ -19,3 +19,11 @@ spring:
|
|||||||
maximum-pool-size: 20
|
maximum-pool-size: 20
|
||||||
idle-timeout: 30000
|
idle-timeout: 30000
|
||||||
max-lifetime: 1800000
|
max-lifetime: 1800000
|
||||||
|
mybatis-plus:
|
||||||
|
configuration:
|
||||||
|
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
root: info
|
||||||
|
net.rzdata: debug
|
||||||
|
com.baomidou.example.mapper: debug
|
||||||
|
Loading…
x
Reference in New Issue
Block a user