Browse Source

Merge pull request #1047 from liuxuzxx/master

修改issue #1046(当类的属性没有按照ExcelProperty的属性index顺序排序的时候,写数据出现错乱)
developing
Jiaju Zhuang 5 years ago committed by GitHub
parent
commit
1440ef040e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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"); + "' and '" + field.getName() + "' must be inconsistent");
} }
customFiledMap.put(excelProperty.index(), field); customFiledMap.put(excelProperty.index(), field);
allFieldList.add(field);
} }
List<Field> allWriteFieldList = new ArrayList<Field>(customFiledMap.values());
allWriteFieldList.addAll(allFieldList);
FIELD_CACHE.put(clazz, 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 { private static class FieldCache {

Loading…
Cancel
Save