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
| ##导入宏定义 $!define $!init ##保存文件(宏定义) #save("/entity", ".java")
##包路径(宏定义) #setPackageSuffix("entity")
##自动导入包(全局变量) $!autoImport import com.baomidou.mybatisplus.extension.activerecord.Model; import java.io.Serializable;
##拿到主键 #if(!$tableInfo.pkColumn.isEmpty()) #set($pk = $tableInfo.pkColumn.get(0)) #end ##表注释(宏定义) #tableComment("表实体类") @SuppressWarnings("serial") @Data @TableName("`$!{tableInfo.obj.name}`") public class $!{tableInfo.name} extends Model<$!{tableInfo.name}> { private static final long serialVersionUID = $!tool.serial(); #foreach($column in $tableInfo.fullColumn) #if(${column.comment})/** * ${column.comment} */#end #if(${column.name}=="createTime") @ApiModelProperty(value = "创建时间", example = "2020-05-01 11:28:26") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss") @TableField(fill = FieldFill.INSERT) #elseif(${column.name}=="updateTime") @ApiModelProperty(value = "修改时间", example = "2020-05-01 11:28:26") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss") @TableField(fill = FieldFill.INSERT_UPDATE) #elseif(${pk.name}==${column.name}) @TableId(value = "${column.name}", type = IdType.AUTO) @ApiModelProperty( name ="$!{column.name}", value="$column.comment") #else @ApiModelProperty( name ="$!{column.name}", value="$column.comment") #end private $!{tool.getClsNameByFullName($column.type)} $!{column.name}; #end
#foreach($column in $tableInfo.pkColumn)
@Override protected Serializable pkVal() { return this.$!column.name; } #break #end }
|