apache / apache/fesod

[Enhancement] @ExcelProperty 开放注解范围

Open
#915 12 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
6.2k
Forks
532
Avg merge
1d 3h
Merged PRs (30d)
42

Description

### Search before asking

- [x] I searched in the [issues](https://github.com/apache/fesod/issues) and found nothing similar.

### Motivation

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

```java

@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!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.