| | |
| | | package ${basePackage}.${entityPackage}; |
| | | |
| | | import java.io.Serializable; |
| | | <#if hasDate = true> |
| | | import java.util.Date; |
| | | import cc.mrbird.febs.common.core.annotation.FieldInfo; |
| | | import cc.mrbird.febs.common.core.utils.DateDeSerializer; |
| | | import cc.mrbird.febs.common.core.utils.DateSerializer; |
| | | import cc.mrbird.febs.common.core.utils.DateTimeDeserializer; |
| | | import cc.mrbird.febs.common.core.utils.DateTimeSerializer; |
| | | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | </#if> |
| | | <#if hasBigDecimal = true> |
| | | import java.math.BigDecimal; |
| | | </#if> |
| | | import lombok.Data; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.Version; |
| | | |
| | | /** |
| | | * ${tableComment} Entity |
| | | * |
| | | * name:${className} |
| | | * package:${basePackage}.${controllerPackage} |
| | | * description:${tableComment}数据表映射实体 |
| | | * |
| | | * @author ${author} |
| | | * @date ${date} |
| | | * @since JDK1.8 |
| | | */ |
| | | @Data |
| | | @TableName("${tableName}") |
| | | public class ${className} { |
| | | public class ${className} implements Serializable{ |
| | | |
| | | <#if columns??> |
| | | <#list columns as column> |
| | | /** |
| | | * ${column.remark} |
| | | */ |
| | | @FieldInfo(name = "${column.name}",type = "${column.type}",explain = "${column.remark}") |
| | | <#if column.isKey = true> |
| | | @TableId(value = "${column.name}", type = IdType.AUTO) |
| | | @TableId(value = "${column.name}") |
| | | <#else> |
| | | @TableField("${column.name}") |
| | | @TableField("${column.name}") |
| | | </#if> |
| | | <#if (column.type = 'varchar' || column.type = 'text' || column.type = 'uniqueidentifier' |
| | | || column.type = 'varchar2' || column.type = 'nvarchar' || column.type = 'VARCHAR2' |
| | | || column.type = 'VARCHAR'|| column.type = 'CLOB' || column.type = 'char')> |
| | | private String ${column.field?uncap_first}; |
| | | private String ${column.field?uncap_first}; |
| | | |
| | | </#if> |
| | | <#if column.type = 'timestamp' || column.type = 'date' || column.type = 'datetime'||column.type = 'TIMESTAMP' || column.type = 'DATE' || column.type = 'DATETIME'> |
| | | private Date ${column.field?uncap_first}; |
| | | <#if column.type = 'timestamp' || column.type = 'datetime'||column.type = 'TIMESTAMP' || column.type = 'DATETIME'> |
| | | @JsonSerialize(using = DateTimeSerializer.class) |
| | | @JsonDeserialize(using = DateTimeDeserializer.class) |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date ${column.field?uncap_first}; |
| | | |
| | | </#if> |
| | | <#if column.type = 'int' || column.type = 'smallint'> |
| | | private Integer ${column.field?uncap_first}; |
| | | <#if column.type = 'date' ||column.type = 'DATE'> |
| | | @JsonSerialize(using = DateSerializer.class) |
| | | @JsonDeserialize(using = DateDeSerializer.class) |
| | | @DateTimeFormat(pattern="yyyy-MM-dd") |
| | | private Date ${column.field?uncap_first}; |
| | | |
| | | </#if> |
| | | <#if column.type = 'int' || column.type = 'smallint'|| column.type = 'bit'||column.type = 'tinyint'> |
| | | <#if column.name = 'version'> |
| | | @Version |
| | | </#if> |
| | | private Integer ${column.field?uncap_first}; |
| | | |
| | | </#if> |
| | | <#if column.type = 'double'> |
| | | private Double ${column.field?uncap_first}; |
| | | private Double ${column.field?uncap_first}; |
| | | |
| | | </#if> |
| | | <#if column.type = 'bigint'> |
| | | private Long ${column.field?uncap_first}; |
| | | |
| | | </#if> |
| | | <#if column.type = 'tinyint'> |
| | | private Byte ${column.field?uncap_first}; |
| | | private Long ${column.field?uncap_first}; |
| | | |
| | | </#if> |
| | | <#if column.type = 'decimal' || column.type = 'numeric'> |
| | | private BigDecimal ${column.field?uncap_first}; |
| | | private BigDecimal ${column.field?uncap_first}; |
| | | |
| | | </#if> |
| | | </#list> |
| | | </#if> |