templates.generator.Entity.vm Maven / Gradle / Ivy
package ${package}.${moduleName}.entity;
import com.github.hdy.jdbcplus.data.annotation.Entity;
import com.github.hdy.jdbcplus.data.annotation.Id;
import javax.validation.constraints.NotBlank;
import lombok.Data;
#if(${hasBigDecimal})
import java.math.BigDecimal;
#end
#if(${hasDate})
import java.util.Date;
#end
/**
* ${comments}
*
* @author ${author}
* @date ${datetime}
*/
@Data
@Entity(name = "${tableName}")
public class ${className} {
#foreach ($column in $columns)
/**
* $column.comments
*/
#if($column.columnName == $pk.columnName)
@Id#if($column.extra == 'auto_increment')(automatic = true)
#end
#end
#if($column.isNullBle == "NO")
@NotBlank(message = "$column.comments不能为空")
#end
private $column.attrType $column.lowerAttrName;
#end
}