Skip to content

Commit 930b1d4

Browse files
OneTaroCharles7c
authored andcommitted
refactor(generator): 为枚举类型的字段添加自定义 Excel 转换器
1 parent d4df425 commit 930b1d4

File tree

1 file changed

+5
-0
lines changed
  • continew-plugin/continew-plugin-generator/src/main/resources/templates/backend

1 file changed

+5
-0
lines changed

continew-plugin/continew-plugin-generator/src/main/resources/templates/backend/DetailResp.ftl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
88
import com.alibaba.excel.annotation.ExcelProperty;
99

1010
import top.continew.admin.common.model.resp.BaseDetailResp;
11+
import top.continew.starter.file.excel.converter.ExcelBaseEnumConverter;
1112
<#if imports??>
1213
<#list imports as className>
1314
import ${className};
@@ -41,7 +42,11 @@ public class ${className} extends BaseDetailResp {
4142
* ${fieldConfig.comment}
4243
*/
4344
@Schema(description = "${fieldConfig.comment}")
45+
<#if fieldConfig.fieldType?ends_with("Enum")>
46+
@ExcelProperty(value = "${fieldConfig.comment}", converter = ExcelBaseEnumConverter.class)
47+
<#else>
4448
@ExcelProperty(value = "${fieldConfig.comment}")
49+
</#if>
4550
private ${fieldConfig.fieldType} ${fieldConfig.fieldName};
4651
</#list>
4752
</#if>

0 commit comments

Comments
 (0)