| | |
| | | if (ObjectUtil.isNull(textValue)) { |
| | | return null; |
| | | } |
| | | ExcelEnumFormat anno = getAnnotation(contentProperty.getField()); |
| | | // 字段未配置枚举注解时,按原始值转换,避免空指针导致导入/导出中断 |
| | | if (ObjectUtil.isNull(anno)) { |
| | | return Convert.convert(contentProperty.getField().getType(), textValue); |
| | | } |
| | | Map<Object, String> enumCodeToTextMap = beforeConvert(contentProperty); |
| | | // 从Java输出至Excel是code转text |
| | | // 因此从Excel转Java应该将text与code对调 |
| | |
| | | if (ObjectUtil.isNull(object)) { |
| | | return new WriteCellData<>(""); |
| | | } |
| | | ExcelEnumFormat anno = getAnnotation(contentProperty.getField()); |
| | | // 字段未配置枚举注解时,按原值输出文本 |
| | | if (ObjectUtil.isNull(anno)) { |
| | | return new WriteCellData<>(Convert.toStr(object, "")); |
| | | } |
| | | Map<Object, String> enumValueMap = beforeConvert(contentProperty); |
| | | String value = Convert.toStr(enumValueMap.get(object), ""); |
| | | return new WriteCellData<>(value); |