forked from DeepBin/codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentity.ftl
More file actions
97 lines (94 loc) · 2.72 KB
/
entity.ftl
File metadata and controls
97 lines (94 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<#import "function.ftl" as func>
<#assign package=model.variables.package>
<#assign class=model.variables.class>
<#assign system=vars.system>
<#assign subtables=model.subTableList>
<#assign pk=func.getPk(model) >
<#assign pkVar=func.convertUnderLine(pk) >
package com.hotent.${system}.${package}.model;
<#if subtables?exists && subtables?size!=0>
import java.util.ArrayList;
import java.util.List;
</#if>
import java.util.Date;
import org.apache.commons.lang.builder.ToStringBuilder;
import com.hotent.base.core.model.AbstractModel;
/**
* 对象功能:${model.tabComment} entity对象
<#if vars.company?exists>
* 开发公司:${vars.company}
</#if>
<#if vars.developer?exists>
* 开发人员:${vars.developer}
</#if>
* 创建时间:${date?string("yyyy-MM-dd HH:mm:ss")}
*/
public class Default${class} extends AbstractModel<String> implements ${class},Cloneable{
<#list model.columnList as col>
<#if (col.colType=="Integer")>
protected Long ${func.convertUnderLine(col.columnName)}; /*${col.comment}*/
<#else>
protected ${col.colType} ${func.convertUnderLine(col.columnName)}; /*${col.comment}*/
</#if>
</#list>
<#if subtables?exists && subtables?size!=0>
<#list subtables as table>
<#assign vars=table.variables>
protected List<${vars.class}> ${vars.classVar}List=new ArrayList<${vars.class}>(); /*${table.tabComment}列表*/
</#list>
</#if>
<#if (pkVar!="id")>
@Override
public void setId(String ${pkVar}) {
set${pkVar?cap_first}(${pkVar});
}
@Override
public String getId() {
return get${pkVar?cap_first}();
}
</#if>
<#list model.columnList as col>
<#assign colName=func.convertUnderLine(col.columnName)>
public void set${colName?cap_first}(<#if (col.colType="Integer")>Long<#else>${col.colType}</#if> ${colName})
{
this.${colName} = ${colName};
}
/**
* 返回 ${col.comment}
* @return
*/
public <#if (col.colType="Integer")>Long<#else>${col.colType}</#if> get${colName?cap_first}()
{
return this.${colName};
}
</#list>
<#if subtables?exists && subtables?size!=0>
<#list subtables as table>
<#assign vars=table.variables>
public void set${vars.classVar?cap_first}List(List<${vars.class}> ${vars.classVar}List)
{
this.${vars.classVar}List = ${vars.classVar}List;
}
/**
* 返回 ${table.tabComment}列表
* @return
*/
public List<${vars.class}> get${vars.classVar?cap_first}List()
{
return this.${vars.classVar}List;
}
</#list>
</#if>
/**
* @see java.lang.Object#toString()
*/
public String toString()
{
return new ToStringBuilder(this)
<#list model.columnList as col>
<#assign colName=func.convertUnderLine(col.columnName)>
.append("${colName}", this.${colName})
</#list>
.toString();
}
}