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

基于枚举类做通用转换器遇到的问题 #4048

@nhsoft-yex

Description

@nhsoft-yex

目前存在一个需求,想要通过一个通用枚举转换器,来对导出的枚举类型转换为字符串:
image

如上图所示,若将该转换器注册进去,由于enum是所有枚举的超类,这里会存在map映射问题,导致找不到转换器;
于是想到使用@ExcelProperty 的convert来做类型转换,但是导出需求要求动态列(静态列公式计算出来的列,这一部分是前端传入),
所以在设置表头的时候是拼接了动态列的,如果要使用@ExcelProperty需要head写入对应class,这又会导致异常(由于实际表头和类的静态表头不一致)
image

所以在此想要咨询下有没有方法可以完成这个枚举类的通用转换器

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions