mirror of
https://gitee.com/best_handsome/mybatis-plus-join
synced 2025-07-11 00:02:22 +08:00
优化 mapper not find
This commit is contained in:
parent
72f155319f
commit
3fbeb1c84a
@ -9,7 +9,6 @@ import com.github.yulichang.config.MPJInterceptorConfig;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yulichang
|
* @author yulichang
|
||||||
@ -17,7 +16,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
*/
|
*/
|
||||||
public class TableHelper {
|
public class TableHelper {
|
||||||
|
|
||||||
private static final AtomicBoolean load = new AtomicBoolean(false);
|
private static boolean load = false;
|
||||||
|
|
||||||
private static final Map<Class<?>, TableInfo> TABLE_INFO_CACHE = new ConcurrentHashMap<>();
|
private static final Map<Class<?>, TableInfo> TABLE_INFO_CACHE = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@ -52,10 +51,10 @@ public class TableHelper {
|
|||||||
if (Objects.nonNull(info)) {
|
if (Objects.nonNull(info)) {
|
||||||
TABLE_INFO_CACHE.put(currentClass, info);
|
TABLE_INFO_CACHE.put(currentClass, info);
|
||||||
} else {
|
} else {
|
||||||
if (!load.get()) {
|
if (!load) {
|
||||||
SpringContentUtils.getBean(MPJInterceptorConfig.class);
|
SpringContentUtils.getBean(MPJInterceptorConfig.class);
|
||||||
SpringContentUtils.getBeansOfType(BaseMapper.class);
|
SpringContentUtils.getBeansOfType(BaseMapper.class);
|
||||||
load.set(true);
|
load = true;
|
||||||
return get(clazz);
|
return get(clazz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拷贝 {@link TableInfoHelper}
|
* 拷贝 {@link TableInfoHelper}
|
||||||
@ -28,7 +27,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
*/
|
*/
|
||||||
public class MPJTableInfoHelper {
|
public class MPJTableInfoHelper {
|
||||||
|
|
||||||
private static final AtomicBoolean load = new AtomicBoolean(false);
|
private static boolean load = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 储存反射类表信息
|
* 储存反射类表信息
|
||||||
@ -51,10 +50,10 @@ public class MPJTableInfoHelper {
|
|||||||
if (Objects.nonNull(tableInfo)) {
|
if (Objects.nonNull(tableInfo)) {
|
||||||
return tableInfo;
|
return tableInfo;
|
||||||
}
|
}
|
||||||
if (!load.get()) {
|
if (!load) {
|
||||||
SpringContentUtils.getBeansOfType(BaseMapper.class);
|
SpringContentUtils.getBeansOfType(BaseMapper.class);
|
||||||
MappingConfig.init();
|
MappingConfig.init();
|
||||||
load.set(true);
|
load = true;
|
||||||
return getTableInfo(clazz);
|
return getTableInfo(clazz);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user