Skip to content

Commit

Permalink
feat: mybatis plus plugin update (#890)
Browse files Browse the repository at this point in the history
* refactor: update es and upgrade file

* fix: Fixed the issue of reading a large number of files OOM and upgraded the ES version

* refactor: update compile jdk version

* refactor: update file coll

* refactor: mybatis plus plugin supported page
  • Loading branch information
wtt40122 authored Sep 3, 2024
1 parent bd03aa7 commit 82c2441
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* @author shanwb
* @date 2022-09-13
*/
@DOceanPlugin(order = Integer.MAX_VALUE)
@DOceanPlugin(order = Integer.MAX_VALUE - 2)
@Slf4j
public class ConfigurationPlugin implements IPlugin {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.xiaomi.youpin.docean.plugin.mybatisplus;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.xiaomi.youpin.docean.Aop;
import com.xiaomi.youpin.docean.Ioc;
import com.xiaomi.youpin.docean.anno.DOceanPlugin;
Expand All @@ -33,6 +34,7 @@
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.util.CollectionUtils;

import javax.sql.DataSource;
import java.lang.reflect.InvocationHandler;
Expand All @@ -47,7 +49,7 @@
/**
* @author [email protected]
*/
@DOceanPlugin
@DOceanPlugin(order = Integer.MAX_VALUE - 1)
@Slf4j
public class MybatisPlugin implements IPlugin {

Expand Down Expand Up @@ -93,6 +95,11 @@ private void addDAO(Ioc ioc, String beanName, String mapperLocation, boolean one
bean.setPlugins(new Interceptor[]{interceptor});
}

Set<MybatisPlusInterceptor> plusInterceptors = ioc.getBeans(MybatisPlusInterceptor.class);
if (!CollectionUtils.isEmpty(plusInterceptors)) {
bean.setPlugins(plusInterceptors.toArray(new Interceptor[]{}));
}

SqlSessionFactory factory = bean.buildSqlSessionFactory();

ioc.putBean("mybatis_" + beanName + config.getName(), factory);
Expand Down

0 comments on commit 82c2441

Please sign in to comment.