Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants