Commit 56e9bb2d by s_guodong

返回第三方数据的total

parent dca7e991
package com.ceb.gjjs.mda.util; package com.ceb.gjjs.mda.util;
import com.brilliance.jrxx.utils.StringUtil;
import com.brilliance.mda.runtime.annotation.RelPath; import com.brilliance.mda.runtime.annotation.RelPath;
import com.brilliance.mda.runtime.mda.impl.ModuleList; import com.brilliance.mda.runtime.mda.impl.ModuleList;
import com.brilliance.mda.runtime.mda.util.MdaUtils; import com.brilliance.mda.runtime.mda.util.MdaUtils;
...@@ -96,6 +97,7 @@ public class ReflectUtil { ...@@ -96,6 +97,7 @@ public class ReflectUtil {
public static String setValue2RespondVo(Object respondVo, Class respondVoClass, Object baseVo, Class baseVoClass) { public static String setValue2RespondVo(Object respondVo, Class respondVoClass, Object baseVo, Class baseVoClass) {
String total = "";
Field[] declaredFields = respondVoClass.getDeclaredFields(); Field[] declaredFields = respondVoClass.getDeclaredFields();
for (Field f : declaredFields) { for (Field f : declaredFields) {
f.setAccessible(true); f.setAccessible(true);
...@@ -114,6 +116,13 @@ public class ReflectUtil { ...@@ -114,6 +116,13 @@ public class ReflectUtil {
if (isPrimate(type)) { if (isPrimate(type)) {
f.set(respondVo, o); f.set(respondVo, o);
} 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
ModuleList moduleList = (ModuleList) o;
log.info("moduleList====" + moduleList.getFullSize());
if (moduleList.getFullSize() >= 0) {
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)) {
...@@ -148,6 +157,16 @@ public class ReflectUtil { ...@@ -148,6 +157,16 @@ public class ReflectUtil {
} }
} }
} }
if (StringUtil.isNotEmpty(total)) {
Field totalField = null;
try {
totalField = respondVoClass.getSuperclass().getDeclaredField("total");
totalField.setAccessible(true);
totalField.set(respondVo, total);
} catch (Exception e) {
e.printStackTrace();
}
}
return ""; return "";
} }
......
...@@ -366,4 +366,9 @@ public class ModuleList<T extends IModule> extends ArrayList<T> implements IModu ...@@ -366,4 +366,9 @@ public class ModuleList<T extends IModule> extends ArrayList<T> implements IModu
return (size % this.pageSize == 0) ? (size / this.pageSize) : (size / this.pageSize + 1); return (size % this.pageSize == 0) ? (size / this.pageSize) : (size / this.pageSize + 1);
} }
public int getFullSize() {
return this.fullSize;
}
} }
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