Browse Source

修改issue #1046(当类的属性没有按照ExcelProperty的属性index顺序排序的时候,写数据出现错乱)

pull/1047/head
liuxu 5 years ago
parent
commit
f4f65e82eb
  1. 5
      src/main/java/com/alibaba/excel/util/ClassUtils.java

5
src/main/java/com/alibaba/excel/util/ClassUtils.java

@ -109,11 +109,12 @@ public class ClassUtils {
+ "' and '" + field.getName() + "' must be inconsistent");
}
customFiledMap.put(excelProperty.index(), field);
allFieldList.add(field);
}
List<Field> allWriteFieldList = new ArrayList<Field>(customFiledMap.values());
allWriteFieldList.addAll(allFieldList);
FIELD_CACHE.put(clazz,
new SoftReference<FieldCache>(new FieldCache(defaultFieldList, customFiledMap, allFieldList, ignoreMap)));
new SoftReference<FieldCache>(new FieldCache(defaultFieldList, customFiledMap, allWriteFieldList, ignoreMap)));
}
private static class FieldCache {

Loading…
Cancel
Save