修改代码生成器实体生成类
This commit is contained in:
@ -5,14 +5,10 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
<#if isNotNullColumns??>
|
||||
import javax.validation.constraints.*;
|
||||
</#if>
|
||||
<#if hasDateAnnotation>
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import org.hibernate.annotations.*;
|
||||
</#if>
|
||||
<#if hasTimestamp>
|
||||
import java.sql.Timestamp;
|
||||
@ -26,9 +22,8 @@ import java.io.Serializable;
|
||||
* @author ${author}
|
||||
* @date ${date}
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="${tableName}")
|
||||
@TableName(name="${tableName}")
|
||||
public class ${className} implements Serializable {
|
||||
<#if columns??>
|
||||
<#list columns as column>
|
||||
@ -37,12 +32,8 @@ public class ${className} implements Serializable {
|
||||
/** ${column.remark} */
|
||||
</#if>
|
||||
<#if column.columnKey = 'PRI'>
|
||||
@Id
|
||||
<#if auto>
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@TableId
|
||||
</#if>
|
||||
</#if>
|
||||
@Column(name = "${column.columnName}"<#if column.columnKey = 'UNI'>,unique = true</#if><#if column.istNotNull && column.columnKey != 'PRI'>,nullable = false</#if>)
|
||||
<#if column.istNotNull && column.columnKey != 'PRI'>
|
||||
<#if column.columnType = 'String'>
|
||||
@NotBlank
|
||||
@ -77,4 +68,4 @@ public class ${className} implements Serializable {
|
||||
public void copy(${className} source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user