From be54188ba6c0ff9a0d3d286f102041cd98f7eabc Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 26 Aug 2020 15:39:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BAExcel=E8=B0=83=E6=95=B4target?= =?UTF-8?q?Attr=E8=8E=B7=E5=8F=96=E5=80=BC=E6=96=B9=E6=B3=95=EF=BC=8C?= =?UTF-8?q?=E9=98=B2=E6=AD=A2get=E6=96=B9=E6=B3=95=E4=B8=8D=E8=A7=84?= =?UTF-8?q?=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index d0775fc5..4e93c6cf 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -6,7 +6,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; @@ -864,9 +863,9 @@ public class ExcelUtil 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; }