-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yongjingchuan
authored and
yongjingchuan
committed
Aug 19, 2020
1 parent
e3b523e
commit e9d7a45
Showing
2 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/com/cy/generate/common/builder/MybatisPlusConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.cy.generate.common.builder; | ||
|
||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; | ||
import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize; | ||
import org.springframework.context.annotation.Bean; | ||
|
||
/** | ||
* @Description: | ||
* @Author: YongJingChuan | ||
* @Date: 2020/8/19 14:42 | ||
*/ | ||
//@Configuration | ||
public class MybatisPlusConfig { | ||
/** | ||
* 分页插件 | ||
*/ | ||
@Bean | ||
public PaginationInterceptor paginationInterceptor() { | ||
PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); | ||
// 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false | ||
// paginationInterceptor.setOverflow(false); | ||
// 设置最大单页限制数量,默认 500 条,-1 不受限制 | ||
// paginationInterceptor.setLimit(500); | ||
// 开启 count 的 join 优化,只针对部分 left join | ||
paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize(true)); | ||
return paginationInterceptor; | ||
} | ||
} |