3131
3232import javax .annotation .PostConstruct ;
3333import java .util .List ;
34+ import java .util .Properties ;
3435
3536/**
3637 * ApiBoot Mybatis Pageable Auto Configuration
3738 *
38- * @author:恒宇少年 - 于起宇
39- * <p>
40- * DateTime:2019-04-25 14:53
41- * Blog:http://blog.yuqiyu.com
42- * WebSite:http://www.jianshu.com/u/092df3f77bca
43- * Gitee:https://gitee.com/hengboy
44- * GitHub:https://github.com/hengboy
39+ * @author 恒宇少年
4540 */
4641@ Configuration
4742@ ConditionalOnBean (SqlSessionFactory .class )
5045@ AutoConfigureAfter (DataSourceAutoConfiguration .class )
5146public class ApiBootMybatisPageableAutoConfiguration {
5247 /**
53- * myabtis pageable properties
48+ * mybatis pageable properties
5449 */
55- private ApiBootMyBatisPageableProperties myBatisPageableProperties ;
50+ private ApiBootMyBatisPageableProperties pageableProperties ;
5651 /**
5752 * mybatis sqlSession factory
5853 */
@@ -65,7 +60,7 @@ public class ApiBootMybatisPageableAutoConfiguration {
6560 public ApiBootMybatisPageableAutoConfiguration (ApiBootMyBatisPageableProperties myBatisPageableProperties ,
6661 ObjectProvider <List <SqlSessionFactory >> interceptorsProvider ,
6762 ObjectProvider <PageableConfigurer > pageableConfigurerObjectProvider ) {
68- this .myBatisPageableProperties = myBatisPageableProperties ;
63+ this .pageableProperties = myBatisPageableProperties ;
6964 this .sqlSessionFactoryList = interceptorsProvider .getIfAvailable ();
7065 this .pageableConfigurer = pageableConfigurerObjectProvider .getIfAvailable ();
7166 }
@@ -77,7 +72,8 @@ public ApiBootMybatisPageableAutoConfiguration(ApiBootMyBatisPageableProperties
7772 void addInterceptors () {
7873 Interceptor interceptor = new MyBatisExecutePageableInterceptor ();
7974 // set properties to interceptor
80- interceptor .setProperties (myBatisPageableProperties .getProperties ());
75+ Properties properties = pageableProperties .convertProperties ();
76+ interceptor .setProperties (properties );
8177
8278 for (SqlSessionFactory sqlSessionFactory : sqlSessionFactoryList ) {
8379 // pre
@@ -90,9 +86,9 @@ void addInterceptors() {
9086 }
9187
9288 /**
93- * pre interceptors
89+ * add pre interceptors
9490 *
95- * @param sqlSessionFactory sqlSessionFactory对象实例
91+ * @param sqlSessionFactory The {@link SqlSessionFactory} instance
9692 */
9793 void addPreInterceptors (SqlSessionFactory sqlSessionFactory ) {
9894 if (allowPageableConfigurer () && pageableConfigurer .prePlugins () != null ) {
@@ -101,9 +97,9 @@ void addPreInterceptors(SqlSessionFactory sqlSessionFactory) {
10197 }
10298
10399 /**
104- * after interceptors
100+ * add after interceptors
105101 *
106- * @param sqlSessionFactory sqlSessionFactory对象实例
102+ * @param sqlSessionFactory The {@link SqlSessionFactory} instance
107103 */
108104 void addPostInterceptors (SqlSessionFactory sqlSessionFactory ) {
109105 if (allowPageableConfigurer () && pageableConfigurer .postPlugins () != null ) {
0 commit comments