|
@@ -23,9 +23,10 @@ import javax.validation.constraints.NotNull;
|
|
|
public class MybatisPlusAutoConfiguration {
|
|
|
|
|
|
@Bean
|
|
|
- public MybatisPlusInterceptor mybatisPlusInterceptor(@NotNull MybatisProperties mybatisProperties) {
|
|
|
+ public MybatisPlusInterceptor mybatisPlusInterceptor(@NotNull MybatisProperties mybatisProperties,
|
|
|
+ @NotNull DataSourceProperties dataSourceProperties) {
|
|
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
|
|
- interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
|
|
+ interceptor.addInnerInterceptor(new PaginationInnerInterceptor(getDbType(dataSourceProperties)));
|
|
|
if (mybatisProperties.isBlockAttack()) {
|
|
|
interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());
|
|
|
}
|
|
@@ -45,4 +46,13 @@ public class MybatisPlusAutoConfiguration {
|
|
|
configuration.setLogImpl(MybatisPlusLogger.class);
|
|
|
};
|
|
|
}
|
|
|
+
|
|
|
+ private DbType getDbType(DataSourceProperties dataSourceProperties) {
|
|
|
+ String driverClassName = dataSourceProperties.getDriverClassName();
|
|
|
+ if (driverClassName.contains("mysql")) {
|
|
|
+ return DbType.MYSQL;
|
|
|
+ } else {
|
|
|
+ return DbType.OTHER;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|