提交 | 用户 | 时间
|
e7c126
|
1 |
package ${basePackage}.module.${table.moduleName}.controller.${sceneEnum.basePackage}.${table.businessName}.vo; |
H |
2 |
|
|
3 |
import io.swagger.v3.oas.annotations.media.Schema; |
|
4 |
import lombok.*; |
|
5 |
import java.util.*; |
|
6 |
## 处理 BigDecimal 字段的引入 |
|
7 |
import java.util.*; |
|
8 |
#foreach ($column in $columns) |
|
9 |
#if (${column.javaType} == "BigDecimal") |
|
10 |
import java.math.BigDecimal; |
|
11 |
#break |
|
12 |
#end |
|
13 |
#end |
|
14 |
## 处理 LocalDateTime 字段的引入 |
|
15 |
#foreach ($column in $columns) |
|
16 |
#if (${column.listOperationResult} && ${column.javaType} == "LocalDateTime") |
|
17 |
import org.springframework.format.annotation.DateTimeFormat; |
|
18 |
import java.time.LocalDateTime; |
|
19 |
#break |
|
20 |
#end |
|
21 |
#end |
|
22 |
## 处理 Excel 导出 |
|
23 |
import com.alibaba.excel.annotation.*; |
|
24 |
#foreach ($column in $columns) |
|
25 |
#if ("$!column.dictType" != "")## 有设置数据字典 |
|
26 |
import ${DictFormatClassName}; |
|
27 |
import ${DictConvertClassName}; |
|
28 |
#break |
|
29 |
#end |
|
30 |
#end |
|
31 |
|
|
32 |
@Schema(description = "${sceneEnum.name} - ${table.classComment} Response VO") |
|
33 |
@Data |
|
34 |
@ExcelIgnoreUnannotated |
|
35 |
public class ${sceneEnum.prefixClass}${table.className}RespVO { |
|
36 |
|
|
37 |
## 逐个处理字段 |
|
38 |
#foreach ($column in $columns) |
|
39 |
#if (${column.listOperationResult}) |
|
40 |
## 1. 处理 Swagger 注解 |
|
41 |
@Schema(description = "${column.columnComment}"#if (!${column.nullable}), requiredMode = Schema.RequiredMode.REQUIRED#end#if ("$!column.example" != ""), example = "${column.example}"#end) |
|
42 |
## 2. 处理 Excel 导出 |
|
43 |
#if ("$!column.dictType" != "")##处理枚举值 |
|
44 |
@ExcelProperty(value = "${column.columnComment}", converter = DictConvert.class) |
|
45 |
@DictFormat("${column.dictType}") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 |
|
46 |
#else |
|
47 |
@ExcelProperty("${column.columnComment}") |
|
48 |
#end |
|
49 |
## 3. 处理字段定义 |
|
50 |
private ${column.javaType} ${column.javaField}; |
|
51 |
|
|
52 |
#end |
|
53 |
#end |
|
54 |
} |