All Downloads are FREE. Search and download functionalities are using the official Maven repository.

template.entity.vm Maven / Gradle / Ivy

package ${package.Entity};

#if(${activeRecord})
import com.baomidou.mybatisplus.activerecord.Model;
#end
#if(${idGenType}!="ID_WORKER")
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
#end
import com.baomidou.mybatisplus.annotation.TableField;
#if(${addTableName})
import com.baomidou.mybatisplus.annotation.TableName;
#end
import java.io.Serializable;
#if(${table.hasDate})
import java.util.Date;
#end
#foreach($field in ${table.fields})
	#if(${field.propertyType.equals('BigDecimal')})
import java.math.BigDecimal;
	#break
	#end
#end

/**
 * 

* ${table.comment} *

* * @author ${author} * @since ${date} */ #if(${addTableName}) @TableName("`${table.name}`") #end #if(${activeRecord}) public class ${entity} extends Model<${entity}> { #else public class ${entity} implements Serializable { #end private static final long serialVersionUID = 1L; #foreach($field in ${table.fields}) /** * ${field.comment} */ #if(${field.keyFlag} && ${idGenType}!="ID_WORKER") @TableId(type = IdType.${idGenType}) #end @TableField(value="`${field.name}`") private ${field.propertyType} ${field.propertyName}; #end ##常量设置 #foreach($field in ${table.fields}) public static final String ${field.nameUp}="${field.name}"; #end #foreach($field in ${table.fields}) #if(${field.propertyType.equals("Boolean")}) #set($getprefix="is") #else #set($getprefix="get") #end public ${field.propertyType} ${getprefix}${field.capitalName}() { return ${field.propertyName}; } public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) { this.${field.propertyName} = ${field.propertyName}; } #end @Override public String toString() { final StringBuilder sb = new StringBuilder("${entity}{").append(super.toString()); #foreach($field in ${table.fields}) #if(${field.propertyType.equals("String")}) sb.append(",${field.propertyName}='").append(${field.propertyName}).append('\''); #else sb.append(",${field.propertyName}=").append(${field.propertyName}); #end #end sb.append('}'); return sb.toString(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy