private static Collection getSheetTitles(final T bean, final SheetTitleDTO sheetTitle) { final String fieldName = sheetTitle.getFieldName(); // 如果为不为动态标题,则直接返回 if (!sheetTitle.isDynamicTitle()) { return Collections.singletonList(fieldName); } // 获得字段值,通过反射直接获得字段值 final Object fieldValue = BeanUtil.getFieldValue(bean, fieldName); if (fieldValue instanceof Collection) { return (Collection) fieldValue; } return Collections.singletonList((String) fieldValue); }


原文地址: https://www.cveoy.top/t/topic/jbKY 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录