Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
2f5637ad
Commit
2f5637ad
authored
Sep 19, 2023
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加分页插件
parent
84a17a41
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
MysqlServerConfig.java
...n/amos/boot/module/hygf/biz/config/MysqlServerConfig.java
+19
-2
TDengineServerConfig.java
...mos/boot/module/hygf/biz/config/TDengineServerConfig.java
+9
-1
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/config/MysqlServerConfig.java
View file @
2f5637ad
...
...
@@ -3,7 +3,9 @@ package com.yeejoin.amos.boot.module.hygf.biz.config;
import
com.baomidou.mybatisplus.annotation.DbType
;
import
com.baomidou.mybatisplus.core.config.GlobalConfig
;
import
com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor
;
import
com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInterceptor
;
import
org.apache.ibatis.plugin.Interceptor
;
import
org.apache.ibatis.session.SqlSessionFactory
;
...
...
@@ -41,6 +43,7 @@ public class MysqlServerConfig {
return
DataSourceBuilder
.
create
().
build
();
}
@Bean
(
name
=
"mysqlSqlSessionFactory"
)
@Primary
public
SqlSessionFactory
mysqlSqlSessionFactory
(
@Qualifier
(
"mysqlDataSource"
)
DataSource
dataSource
,
GlobalConfig
globalConfig
)
throws
Exception
{
...
...
@@ -57,11 +60,14 @@ public class MysqlServerConfig {
properties
.
setProperty
(
"rowBoundsWithCount"
,
"true"
);
properties
.
setProperty
(
"reasonable"
,
"true"
);
properties
.
setProperty
(
"supportMethodsArguments"
,
"true"
);
properties
.
setProperty
(
"params"
,
"pageNum=
pageNum;pageSize=pageS
ize"
+
properties
.
setProperty
(
"params"
,
"pageNum=
current;pageSize=s
ize"
+
""
+
";"
);
interceptor
.
setProperties
(
properties
);
bean
.
setPlugins
(
new
Interceptor
[]
{
interceptor
});
bean
.
setPlugins
(
new
Interceptor
[]
{
interceptor
,
paginationInterceptor
()
});
return
bean
.
getObject
();
}
...
...
@@ -76,4 +82,14 @@ public class MysqlServerConfig {
public
SqlSessionTemplate
mysqlSqlSessionTemplate
(
@Qualifier
(
"mysqlSqlSessionFactory"
)
SqlSessionFactory
sqlSessionFactory
)
throws
Exception
{
return
new
SqlSessionTemplate
(
sqlSessionFactory
);
}
@Bean
public
PaginationInterceptor
paginationInterceptor
()
{
PaginationInterceptor
paginationInterceptor
=
new
PaginationInterceptor
();
paginationInterceptor
.
setDialectType
(
"mysql"
);
return
paginationInterceptor
;
}
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/config/TDengineServerConfig.java
View file @
2f5637ad
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
config
;
import
com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor
;
import
com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean
;
import
com.github.pagehelper.PageInterceptor
;
import
org.apache.ibatis.plugin.Interceptor
;
...
...
@@ -55,7 +56,7 @@ public class TDengineServerConfig {
""
+
";"
);
interceptor
.
setProperties
(
properties
);
bean
.
setPlugins
(
new
Interceptor
[]
{
interceptor
});
bean
.
setPlugins
(
new
Interceptor
[]
{
interceptor
,
paginationInterceptor
()
});
return
bean
.
getObject
();
}
...
...
@@ -70,5 +71,11 @@ public class TDengineServerConfig {
public
SqlSessionTemplate
tdengineSqlSessionTemplate
(
@Qualifier
(
"tdengineSqlSessionFactory"
)
SqlSessionFactory
sqlSessionFactory
)
throws
Exception
{
return
new
SqlSessionTemplate
(
sqlSessionFactory
);
}
@Bean
public
PaginationInterceptor
paginationInterceptor
()
{
PaginationInterceptor
paginationInterceptor
=
new
PaginationInterceptor
();
paginationInterceptor
.
setDialectType
(
"mysql"
);
return
paginationInterceptor
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment