Skip to content

[Enhancement] @ExcelProperty 开放注解范围 #915

Description

@ergehenmeng

Search before asking

  • I searched in the issues and found nothing similar.

Motivation

目前ExcelPropery只能使用在Field, 导致如果字段是status这种, 只能手动增加转换器, 各类型不一样 就要增加很多转换器或者通过组合注解实现(太臃肿了), 希望开放ExcelPropery可以放在注解类上, 实现自定义注解, 用来翻译数据字典, 类似这样

@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@ExcelProperty(converter = DictConverter.class)
public @interface DictExcelProperty {
    
    /**
     * 导出时在Excel中显示的列名
     */
    String value() default "";
    
    /**
     * 字典类型,对应sys_dict_data表的dict_type字段
     * 例如:sys_user_sex, sys_job_status等
     */
    String dictType();
    
    /**
     * 本地数据字典转换 1=是,0=否
     */
    String translate() default "";
}

Solution

No response

Alternatives

No response

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions