1
1
package ${package.Entity} ;
2
2
3
3
<#list table.importPackages as pkg >
4
- import ${pkg} ;
4
+ import ${pkg} ;
5
5
</#list >
6
6
<#if swagger2 >
7
- import io.swagger.annotations.ApiModel;
8
- import io.swagger.annotations.ApiModelProperty;
7
+ import io.swagger.annotations.ApiModel;
8
+ import io.swagger.annotations.ApiModelProperty;
9
9
</#if >
10
10
<#if entityLombokModel >
11
- import lombok.Data;
12
- import lombok.EqualsAndHashCode;
13
- import lombok.experimental.Accessors;
11
+ import lombok.Data;
12
+ import lombok.EqualsAndHashCode;
13
+ import lombok.experimental.Accessors;
14
14
</#if >
15
15
16
16
/**
17
- * <p >
18
- * ${table.comment! }
19
- * </p >
20
- *
21
- * @author ${author}
22
- * @since ${date}
23
- */
17
+ * <p >
18
+ * ${table.comment! }
19
+ * </p >
20
+ *
21
+ * @author ${author}
22
+ * @since ${date}
23
+ */
24
24
<#if entityLombokModel >
25
- @Data
25
+ @Data
26
26
<#if superEntityClass?? >
27
- @EqualsAndHashCode(callSuper = true)
27
+ @EqualsAndHashCode(callSuper = true)
28
28
<#else >
29
- @EqualsAndHashCode(callSuper = false)
29
+ @EqualsAndHashCode(callSuper = false)
30
30
</#if >
31
- @Accessors(chain = true)
31
+ @Accessors(chain = true)
32
32
</#if >
33
33
<#if table.convert >
34
- @TableName("${table.name} ")
34
+ @TableName("${table.name} ")
35
35
</#if >
36
36
<#if swagger2 >
37
- @ApiModel(value="${entity} 对象", description="${table.comment! } ")
37
+ @ApiModel(value="${entity} 对象", description="${table.comment! } ")
38
38
</#if >
39
39
<#if superEntityClass?? >
40
- public class ${entity} extends ${superEntityClass} <#if activeRecord ><${entity} ></#if > {
40
+ public class ${entity} extends ${superEntityClass} <#if activeRecord ><${entity} ></#if > {
41
41
<#elseif activeRecord >
42
- public class ${entity} extends Model<${entity} > {
42
+ public class ${entity} extends Model<${entity} > {
43
43
<#else >
44
- public class ${entity} implements Serializable {
44
+ public class ${entity} implements Serializable {
45
45
</#if >
46
46
47
+ <#if entitySerialVersionUID >
47
48
private static final long serialVersionUID = 1L;
49
+ </#if >
48
50
<#-- ---------- BEGIN 字段循环遍历 ---------->
49
51
<#list table.fields as field >
50
52
<#if field.keyFlag >
51
53
<#assign keyPropertyName="${field.propertyName}"/ >
52
54
</#if >
53
55
54
56
<#if field.comment!?length gt 0 >
55
- <#if swagger2 >
56
- @ApiModelProperty(value = "${field.comment} ")
57
- <#else >
58
- /**
59
- * ${field.comment}
60
- */
61
- </#if >
57
+ <#if swagger2 >
58
+ @ApiModelProperty(value = "${field.comment} ")
59
+ <#else >
60
+ /**
61
+ * ${field.comment}
62
+ */
63
+ </#if >
62
64
</#if >
63
65
<#if field.keyFlag >
64
66
<#-- 主键 -->
65
67
<#if field.keyIdentityFlag >
66
- @TableId(value = "${field.name} ", type = IdType.AUTO)
68
+ @TableId(value = "${field.name} ", type = IdType.AUTO)
67
69
<#elseif idType?? >
68
- @TableId(value = "${field.name} ", type = IdType.${idType} )
70
+ @TableId(value = "${field.name} ", type = IdType.${idType} )
69
71
<#elseif field.convert >
70
- @TableId("${field.name} ")
72
+ @TableId("${field.name} ")
71
73
</#if >
72
74
<#-- 普通字段 -->
73
75
<#elseif field.fill?? >
74
76
<#-- ----- 存在字段填充设置 ----->
75
77
<#if field.convert >
76
- @TableField(value = "${field.name} ", fill = FieldFill.${field.fill} )
78
+ @TableField(value = "${field.name} ", fill = FieldFill.${field.fill} )
77
79
<#else >
78
- @TableField(fill = FieldFill.${field.fill} )
80
+ @TableField(fill = FieldFill.${field.fill} )
79
81
</#if >
80
82
<#elseif field.convert >
81
- @TableField("${field.name} ")
83
+ @TableField("${field.name} ")
82
84
</#if >
83
85
<#-- 乐观锁注解 -->
84
86
<#if (versionFieldName!"") == field.name >
85
- @Version
87
+ @Version
86
88
</#if >
87
89
<#-- 逻辑删除注解 -->
88
90
<#if (logicDeleteFieldName!"") == field.name >
89
- @TableLogic
91
+ @TableLogic
90
92
</#if >
91
93
private ${field.propertyType} ${field.propertyName} ;
92
94
</#list >
@@ -99,26 +101,26 @@ public class ${entity} implements Serializable {
99
101
<#else >
100
102
<#assign getprefix="get"/ >
101
103
</#if >
102
- public ${field.propertyType} ${getprefix}${field.capitalName} () {
104
+ public ${field.propertyType} ${getprefix}${field.capitalName} () {
103
105
return ${field.propertyName} ;
104
- }
106
+ }
105
107
106
108
<#if entityBuilderModel >
107
- public ${entity} set${field.capitalName} (${field.propertyType} ${field.propertyName} ) {
109
+ public ${entity} set${field.capitalName} (${field.propertyType} ${field.propertyName} ) {
108
110
<#else >
109
- public void set${field.capitalName} (${field.propertyType} ${field.propertyName} ) {
111
+ public void set${field.capitalName} (${field.propertyType} ${field.propertyName} ) {
110
112
</#if >
111
113
this.${field.propertyName} = ${field.propertyName} ;
112
114
<#if entityBuilderModel >
113
- return this;
115
+ return this;
114
116
</#if >
115
- }
117
+ }
116
118
</#list >
117
119
</#if >
118
120
119
121
<#if entityColumnConstant >
120
122
<#list table.fields as field >
121
- public static final String ${field.name?upper_case } = "${field.name} ";
123
+ public static final String ${field.name?upper_case } = "${field.name} ";
122
124
123
125
</#list >
124
126
</#if >
@@ -136,15 +138,15 @@ public class ${entity} implements Serializable {
136
138
<#if !entityLombokModel >
137
139
@Override
138
140
public String toString() {
139
- return "${entity} {" +
141
+ return "${entity} {" +
140
142
<#list table.fields as field >
141
143
<#if field_index==0 >
142
- "${field.propertyName} =" + ${field.propertyName} +
144
+ "${field.propertyName} =" + ${field.propertyName} +
143
145
<#else >
144
- ", ${field.propertyName} =" + ${field.propertyName} +
146
+ ", ${field.propertyName} =" + ${field.propertyName} +
145
147
</#if >
146
148
</#list >
147
- "}";
149
+ "}";
148
150
}
149
151
</#if >
150
152
}
0 commit comments