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

pull/202/head
RuoYi 2020-08-26 15:39:19 +08:00
parent 00392e6809
commit adcdd046d2
1 changed files with 3 additions and 3 deletions

View File

@ -884,9 +884,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;
}