Commit c913d44b by s_guodong

支持List<String>

parent c79ddb3b
...@@ -398,34 +398,41 @@ public class MdaDriver { ...@@ -398,34 +398,41 @@ public class MdaDriver {
((ParameterizedType) to.getGenericType()).getActualTypeArguments()[0] ((ParameterizedType) to.getGenericType()).getActualTypeArguments()[0]
) { ) {
if (!voToMod) { if (!voToMod) {
to.set(toObj, from.get(fromObj)); //拷贝数据 //拷贝数据
to.set(toObj, from.get(fromObj));
} else { } else {
//添加数据、添加分页数据 //添加数据、添加分页数据
List dataList = (List) from.get(fromObj); List dataList = (List) from.get(fromObj);
IModuleList moduleList = (IModuleList) getBaseObject((IModule) toObj, to.getName()); IBaseObject baseObject = getBaseObject((IModule) toObj, to.getName());
if (dataList != null) { if (baseObject instanceof IModuleList) {
HashMap<String, Object> inrs = new HashMap<>(); IModuleList moduleList = (IModuleList) baseObject;
for (Object o : moduleList) { if (dataList != null) {
try { HashMap<String, Object> inrs = new HashMap<>();
Field f = o.getClass().getDeclaredField("inr"); for (Object o : moduleList) {
f.setAccessible(true); try {
inrs.put((String) f.get(o), o); Field f = o.getClass().getDeclaredField("inr");
} catch (NoSuchFieldException ne) { f.setAccessible(true);
continue; inrs.put((String) f.get(o), o);
} catch (NoSuchFieldException ne) {
continue;
}
}
for (Object o : dataList) {
String inr = getFieldValue(o, "inr");
if (inrs.containsKey(inr))
moduleList.remove(inrs.get(inr));
moduleList.add(o);
} }
} }
for (Object o : dataList) { } else {
String inr = getFieldValue(o, "inr"); IDatafield iDatafield = (IDatafield) baseObject;
if (inrs.containsKey(inr)) iDatafield.setValue(dataList);
moduleList.remove(inrs.get(inr));
moduleList.add(o);
}
} }
} }
return; return;
} }
if (!to.getType().equals(from.getType())) //类型不相等 //类型不相等
{ if (!to.getType().equals(from.getType())) {
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment