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,6 +131,9 @@ public class ReflectUtil { ...@@ -133,6 +131,9 @@ public class ReflectUtil {
} else { } else {
// 泛型是对象 // 泛型是对象
List list = (List) o; List list = (List) o;
if (tType.equals(ReflectUtil.getTType(declaredField))) {
f.set(respondVo, list);
} else {
List dataList = new ArrayList(list.size()); List dataList = new ArrayList(list.size());
for (Object data : list) { for (Object data : list) {
Object o1 = tType.newInstance(); Object o1 = tType.newInstance();
...@@ -141,6 +142,7 @@ public class ReflectUtil { ...@@ -141,6 +142,7 @@ public class ReflectUtil {
} }
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);
} else { } else {
......
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