diff --git a/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/core/CellMergeStrategy.java b/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/core/CellMergeStrategy.java index 39697e186..3e1ccfd67 100644 --- a/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/core/CellMergeStrategy.java +++ b/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/core/CellMergeStrategy.java @@ -73,6 +73,7 @@ public class CellMergeStrategy extends AbstractMergeStrategy implements Workbook return cellList; } Class clazz = list.get(0).getClass(); + boolean annotationPresent = clazz.isAnnotationPresent(ExcelIgnoreUnannotated.class); Field[] fields = ReflectUtils.getFields(clazz, field -> { if ("serialVersionUID".equals(field.getName())) { return false; @@ -80,7 +81,7 @@ public class CellMergeStrategy extends AbstractMergeStrategy implements Workbook if (field.isAnnotationPresent(ExcelIgnore.class)) { return false; } - return !clazz.isAnnotationPresent(ExcelIgnoreUnannotated.class) || field.isAnnotationPresent(ExcelProperty.class); + return !annotationPresent || field.isAnnotationPresent(ExcelProperty.class); }); // 有注解的字段