| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <#import "../function.ftl" as func>
- <#assign class=model.variables.class>
- <#assign classVar=model.variables.classVar>
- <#assign tableName=model.tableName>
- <#assign sys=model.variables.sys>
- <#assign module=model.variables.module>
- <#assign subtables=model.subTableList>
- <#assign pk=func.getPk(model) >
- <#assign pkVar=func.convertUnderLine(pk) >
- <#assign isBaseModule=model.variables.isBaseModule>
- <#if isBaseModule = 'true'>
- package com.${vars.cAlias}.${sys}.persistence.entity;
- <#else>
- package com.${vars.cAlias}.${sys}.${module}.persistence.entity;
- </#if>
- <#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.bugull.mongo.SimpleEntity;
- import com.bugull.mongo.annotations.Entity;
- import com.bugull.mongo.annotations.Property;
- /**
- * 对象功能:${model.tabComment} Po对象
- <#if vars.company?exists>
- * 开发公司:${vars.company}
- </#if>
- <#if vars.developer?exists>
- * 开发人员:${vars.developer}
- </#if>
- * 创建时间:${date?string("yyyy-MM-dd HH:mm:ss")}
- */
- @Entity(name="${tableName}")
- public class ${class}Entity extends SimpleEntity{
- <#list model.columnList as col>
- @Property(name="${col.columnName}")
- protected ${col.colType} ${func.convertUnderLine(col.columnName)}; /*${col.comment}*/
- </#list>
- <#if (pkVar!="id")>
- public void setId(String ${pkVar}) {
- this.${pkVar} = ${pkVar};
- }
- public String getId() {
- return ${pkVar};
- }
- </#if>
- <#list model.columnList as col>
- <#assign colName=func.convertUnderLine(col.columnName)>
- public void set${colName?cap_first}(${col.colType} ${colName})
- {
- this.${colName} = ${colName};
- }
- /**
- * 返回 ${col.comment}
- * @return
- */
- public ${col.colType} get${colName?cap_first}()
- {
- return this.${colName};
- }
- </#list>
- /**
- * @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();
- }
- }
|