Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

添加注解ExcelUnInheritable,声明不可指定类的Field不进行继承#3724

Open
sunsjgit wants to merge 1 commit intoalibaba:masterfrom
sunsjgit:master
Open

添加注解ExcelUnInheritable,声明不可指定类的Field不进行继承#3724
sunsjgit wants to merge 1 commit intoalibaba:masterfrom
sunsjgit:master

Conversation

@sunsjgit
Copy link

@sunsjgit sunsjgit commented Mar 12, 2024

父类不添加对应注解的情况

父类

@Data
@ExcelIgnoreUnannotated
public class ExportVisitRecordData{
    /**
     * 类目
     */
    @ExcelProperty(value = "类目")
    private String categoryName;
}

子类

@Data
@ExcelIgnoreUnannotated
public class ExportVisitRecordDataSub extends ExportVisitRecordData{

    /**
     * 类目
     */
    @ExcelProperty(value = "类目")
    private String category;

}

导出结果两列重复的:
image

父类添加ExcelUnInheritable注解

父类

@Data
@ExcelIgnoreUnannotated
@ExcelUnInheritable
public class ExportVisitRecordData{
    /**
     * 类目
     */
    @ExcelProperty(value = "类目")
    private String categoryName;
}

导出结果:
image

@CLAassistant
Copy link

CLAassistant commented Mar 12, 2024

CLA assistant check
All committers have signed the CLA.

sunsjgit

This comment was marked as off-topic.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants