entity.java.vm 1.98 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
package ${package.Entity};

#if(${superEntityClassPackage})
import ${superEntityClassPackage};
#end
#if(${activeRecord})
import com.baomidou.mybatisplus.activerecord.Model;
#end
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
#if(${table.hasDate})
import java.util.Date;
#end

/**
* <p>
* ${table.comment}
* </p>
*
* @author ${author}
* @since ${date}
*/
#if(${tabeAnnotation})
@TableName("${table.name}")
#end
#if(${superEntityClass})
public class ${entity} extends ${superEntityClass} {
#else
#if(${activeRecord})
public class ${entity} extends Model<${entity}> {
#else
public class ${entity} implements Serializable {
#end
#end

private static final long serialVersionUID = 1L;

#foreach($field in ${table.fields})
/**
* ${field.comment}
*/
#if(${field.keyFlag} && ${field.convert})
#set($keyPropertyName=${field.propertyName})
@TableId(value="${field.name}")
#elseif(${field.convert})
@TableField(value="${field.name}")
#end
private ${field.propertyType} ${field.propertyName};
#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};
}

#if(${entityBuliderModel})
public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
#else
public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
#end
this.${field.propertyName} = ${field.propertyName};
#if(${entityBuliderModel})
return this;
#end
}
#end

#if(${entityColumnConstant})
#foreach($field in ${table.fields})
public static final String ${field.name.toUpperCase()} = "${field.name}";

#end
#end
#if(${activeRecord})
@Override
protected Serializable pkVal() {
#if(${keyPropertyName})
return this.${keyPropertyName};
#else
return this.id;
#end
}

#end
}