mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 01:48:47 +08:00
优化避免每个字段都进行ExcelIgnoreUnannotated.class判断
This commit is contained in:
parent
0bc9097f18
commit
ba6015ca19
@ -73,6 +73,7 @@ public class CellMergeStrategy extends AbstractMergeStrategy implements Workbook
|
|||||||
return cellList;
|
return cellList;
|
||||||
}
|
}
|
||||||
Class<?> clazz = list.get(0).getClass();
|
Class<?> clazz = list.get(0).getClass();
|
||||||
|
boolean annotationPresent = clazz.isAnnotationPresent(ExcelIgnoreUnannotated.class);
|
||||||
Field[] fields = ReflectUtils.getFields(clazz, field -> {
|
Field[] fields = ReflectUtils.getFields(clazz, field -> {
|
||||||
if ("serialVersionUID".equals(field.getName())) {
|
if ("serialVersionUID".equals(field.getName())) {
|
||||||
return false;
|
return false;
|
||||||
@ -80,7 +81,7 @@ public class CellMergeStrategy extends AbstractMergeStrategy implements Workbook
|
|||||||
if (field.isAnnotationPresent(ExcelIgnore.class)) {
|
if (field.isAnnotationPresent(ExcelIgnore.class)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return !clazz.isAnnotationPresent(ExcelIgnoreUnannotated.class) || field.isAnnotationPresent(ExcelProperty.class);
|
return !annotationPresent || field.isAnnotationPresent(ExcelProperty.class);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 有注解的字段
|
// 有注解的字段
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user