+ 接口getEntityClassByClassName

This commit is contained in:
mazhicheng 2020-06-26 13:59:36 +08:00
parent 3c4804a8ea
commit 969f3e7f82
2 changed files with 13 additions and 4 deletions

View File

@ -57,9 +57,9 @@ public class ParserCache {
*/
private static Map<String, String> entityClassTableCacheMap = new ConcurrentHashMap<>();
/**
* entity类小驼峰-entity类
* entity类小驼峰实例名-entity类
*/
private static Map<String, Class<?>> entityLowerCaseCamelEntityClassCacheMap = new ConcurrentHashMap<>();
private static Map<String, Class<?>> entityName2EntityClassCacheMap = new ConcurrentHashMap<>();
/**
* dto类-BindQuery注解的缓存
*/
@ -124,7 +124,7 @@ public class ParserCache {
Class<?> entityClass = Class.forName(entityClassName);
TableLinkage linkage = new TableLinkage(entityClass, m);
tableToLinkageCacheMap.put(linkage.getTable(), linkage);
entityLowerCaseCamelEntityClassCacheMap.put(entityClass.getSimpleName(), entityClass);
entityName2EntityClassCacheMap.put(entityClass.getSimpleName(), entityClass);
}
}
}
@ -191,6 +191,15 @@ public class ParserCache {
return mapper;
}
/**
* 根据类的entity类名获取EntityClass
* @return
*/
public static Class<?> getEntityClassByClassName(String className){
initTableToLinkageCacheMap();
return entityName2EntityClassCacheMap.get(className);
}
/**
* 当前DTO是否有Join绑定
* @param dto dto对象

View File

@ -20,7 +20,7 @@ import java.lang.annotation.*;
/**
* 绑定管理器
* @author Xieshuang
* @author mazc@dibo.ltd
* @version v2.0
* @date 2019/7/18
*/