提交 69779a5c 编写于 作者: misaka's avatar misaka

外键信息回填

上级 404f98b1
......@@ -2,6 +2,7 @@ package cn.ibizlab.businesscentral.util.helper;
import cn.ibizlab.businesscentral.util.annotation.Audit;
import cn.ibizlab.businesscentral.util.annotation.BackFillProperty;
import cn.ibizlab.businesscentral.util.annotation.DEField;
import cn.ibizlab.businesscentral.util.annotation.DynaProperty;
import org.springframework.util.ObjectUtils;
......@@ -28,6 +29,8 @@ public class DEFieldCacheMap {
private static Hashtable<String, Hashtable<String, DynaProperty>> cacheDynaPropertyField = new Hashtable<>();
private static Hashtable<String, Hashtable<String, BackFillProperty>> cacheBackFillPropertyField = new Hashtable<>();
private static Hashtable<String, String> cacheDEKeyField = new Hashtable<>();
private static Object objLock1=new Object();
......@@ -52,6 +55,7 @@ public class DEFieldCacheMap {
Hashtable<String,DEField> defields=new Hashtable<>();
Hashtable<String, Audit> auditfields=new Hashtable<>();
Hashtable<String, DynaProperty> dynapropertyfields=new Hashtable<>();
Hashtable<String, BackFillProperty> backfillpropertyfields=new Hashtable<>();
Hashtable<String,String> dekeyfields=new Hashtable<>();
Field[] fields=clazz.getDeclaredFields();
for(Field field:fields){
......@@ -61,6 +65,7 @@ public class DEFieldCacheMap {
DEField deField=field.getAnnotation(DEField.class);
Audit auditField=field.getAnnotation(Audit.class);
DynaProperty dynaPropertyField=field.getAnnotation(DynaProperty.class);
BackFillProperty backFillPropertyField=field.getAnnotation(BackFillProperty.class);
if(!ObjectUtils.isEmpty(deField)) {
defields.put(field.getName(),deField);
if(deField.isKeyField())
......@@ -72,6 +77,9 @@ public class DEFieldCacheMap {
if(!ObjectUtils.isEmpty(dynaPropertyField)){
dynapropertyfields.put(field.getName(),dynaPropertyField) ;
}
if(!ObjectUtils.isEmpty(backFillPropertyField)){
backfillpropertyfields.put(field.getName(),backFillPropertyField) ;
}
}
cacheMap.put(className, result);
cacheList.put(className,list);
......@@ -79,6 +87,7 @@ public class DEFieldCacheMap {
cacheDEField.put(className,defields);
cacheAuditField.put(className,auditfields);
cacheDynaPropertyField.put(className,dynapropertyfields);
cacheBackFillPropertyField.put(className,backfillpropertyfields);
return result;
}
}
......@@ -133,7 +142,7 @@ public class DEFieldCacheMap {
}
/**
* 从缓存中查询审计属性集合
* 从缓存中查询动态存储属性集合
* @param
* @return
*/
......@@ -149,6 +158,23 @@ public class DEFieldCacheMap {
}
}
/**
* 从缓存中查询回填属性集合
* @param
* @return
*/
public static <T> Hashtable<String,BackFillProperty> getBackFillropertyFields(Class<T> clazz) {
String className=clazz.getName();
if(className.indexOf("_$")>0)
className=className.substring(0, className.lastIndexOf("_$"));
if(cacheBackFillPropertyField.containsKey(className))
return cacheBackFillPropertyField.get(className);
else{
DEFieldCacheMap.getFieldMap(className);
return cacheBackFillPropertyField.get(className);
}
}
/**
* 从缓存中查询实体对象主键
* @param
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册