提交 | 用户 | 时间
|
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 |
import ${jakartaPackage}.validation.constraints.*; |
|
7 |
## 处理 BigDecimal 字段的引入 |
|
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.createOperation} || ${column.updateOperation}) && ${column.javaType} == "LocalDateTime") |
|
17 |
import org.springframework.format.annotation.DateTimeFormat; |
|
18 |
import java.time.LocalDateTime; |
|
19 |
#break |
|
20 |
#end |
|
21 |
#end |
|
22 |
## 特殊:主子表专属逻辑 |
|
23 |
#foreach ($subTable in $subTables) |
|
24 |
import ${basePackage}.module.${subTable.moduleName}.dal.dataobject.${subTable.businessName}.${subTable.className}DO; |
|
25 |
#end |
|
26 |
|
|
27 |
@Schema(description = "${sceneEnum.name} - ${table.classComment}新增/修改 Request VO") |
|
28 |
@Data |
|
29 |
public class ${sceneEnum.prefixClass}${table.className}SaveReqVO { |
|
30 |
|
|
31 |
## 逐个处理字段 |
|
32 |
#foreach ($column in $columns) |
|
33 |
#if (${column.createOperation} || ${column.updateOperation}) |
|
34 |
## 1. 处理 Swagger 注解 |
|
35 |
@Schema(description = "${column.columnComment}"#if (!${column.nullable}), requiredMode = Schema.RequiredMode.REQUIRED#end#if ("$!column.example" != ""), example = "${column.example}"#end) |
|
36 |
## 2. 处理 Validator 参数校验 |
|
37 |
#if (!${column.nullable} && !${column.primaryKey}) |
|
38 |
#if (${column.javaType} == 'String') |
|
39 |
@NotEmpty(message = "${column.columnComment}不能为空") |
|
40 |
#else |
|
41 |
@NotNull(message = "${column.columnComment}不能为空") |
|
42 |
#end |
|
43 |
#end |
|
44 |
## 3. 处理字段定义 |
|
45 |
private ${column.javaType} ${column.javaField}; |
|
46 |
|
|
47 |
#end |
|
48 |
#end |
|
49 |
## 特殊:主子表专属逻辑(非 ERP 模式) |
|
50 |
#if ( $subTables && $subTables.size() > 0 && $table.templateType != 11 ) |
|
51 |
#foreach ($subTable in $subTables) |
|
52 |
#set ($index = $foreach.count - 1) |
|
53 |
#if ( $subTable.subJoinMany) |
|
54 |
@Schema(description = "${subTable.classComment}列表") |
|
55 |
private List<${subTable.className}DO> ${subClassNameVars.get($index)}s; |
|
56 |
|
|
57 |
#else |
|
58 |
@Schema(description = "${subTable.classComment}") |
|
59 |
private ${subTable.className}DO ${subClassNameVars.get($index)}; |
|
60 |
|
|
61 |
#end |
|
62 |
#end |
|
63 |
#end |
|
64 |
} |