Browse Source

导出Excel调整targetAttr获取值方法,防止get方法不规范

tags/v2.2
RuoYi 4 years ago
parent
commit
66e8b59e26
  1. 7
      ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/poi/ExcelUtil.java

7
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/poi/ExcelUtil.java

@ -4,7 +4,6 @@ import java.io.IOException; @@ -4,7 +4,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
@ -799,9 +798,9 @@ public class ExcelUtil<T> @@ -799,9 +798,9 @@ public class ExcelUtil<T>
if (StringUtils.isNotEmpty(name))
{
Class<?> clazz = o.getClass();
String methodName = "get" + name.substring(0, 1).toUpperCase() + name.substring(1);
Method method = clazz.getMethod(methodName);
o = method.invoke(o);
Field field = clazz.getDeclaredField(name);
field.setAccessible(true);
o = field.get(o);
}
return o;
}

Loading…
Cancel
Save