Commit 23e438b0 by s_guodong

优化自定义返回vo赋值问题

parent 48a9eb4c
...@@ -120,11 +120,9 @@ public class ReflectUtil { ...@@ -120,11 +120,9 @@ public class ReflectUtil {
} else if ("com.brilliance.mda.runtime.mda.impl.ModuleList".equals(type.getName())) { } else if ("com.brilliance.mda.runtime.mda.impl.ModuleList".equals(type.getName())) {
// 取总条数total // 取总条数total
ModuleList moduleList = (ModuleList) o; ModuleList moduleList = (ModuleList) o;
log.info("moduleList====" + moduleList.getFullSize());
if (moduleList.getFullSize() >= 0) { if (moduleList.getFullSize() >= 0) {
total = String.valueOf(moduleList.getFullSize()); total = String.valueOf(moduleList.getFullSize());
} }
// list数据类型 // list数据类型
Class tType = ReflectUtil.getTType(f); Class tType = ReflectUtil.getTType(f);
if (ReflectUtil.isPrimate(tType)) { if (ReflectUtil.isPrimate(tType)) {
...@@ -133,13 +131,17 @@ public class ReflectUtil { ...@@ -133,13 +131,17 @@ public class ReflectUtil {
} else { } else {
// 泛型是对象 // 泛型是对象
List list = (List) o; List list = (List) o;
List dataList = new ArrayList(list.size()); if (tType.equals(ReflectUtil.getTType(declaredField))) {
for (Object data : list) { f.set(respondVo, list);
Object o1 = tType.newInstance(); } else {
setValue2RespondVo(o1, tType, data, ReflectUtil.getTType(declaredField)); List dataList = new ArrayList(list.size());
dataList.add(o1); for (Object data : list) {
Object o1 = tType.newInstance();
setValue2RespondVo(o1, tType, data, ReflectUtil.getTType(declaredField));
dataList.add(o1);
}
f.set(respondVo, dataList);
} }
f.set(respondVo, dataList);
} }
} else if ("java.util.List".equals(type.getName())) { } else if ("java.util.List".equals(type.getName())) {
f.set(respondVo, o); f.set(respondVo, o);
......
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