导出Excel调整targetAttr获取值方法,防止get方法不规范
parent
00392e6809
commit
adcdd046d2
|
@ -884,9 +884,9 @@ public class ExcelUtil<T>
|
||||||
if (StringUtils.isNotEmpty(name))
|
if (StringUtils.isNotEmpty(name))
|
||||||
{
|
{
|
||||||
Class<?> clazz = o.getClass();
|
Class<?> clazz = o.getClass();
|
||||||
String methodName = "get" + name.substring(0, 1).toUpperCase() + name.substring(1);
|
Field field = clazz.getDeclaredField(name);
|
||||||
Method method = clazz.getMethod(methodName);
|
field.setAccessible(true);
|
||||||
o = method.invoke(o);
|
o = field.get(o);
|
||||||
}
|
}
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue