All Downloads are FREE. Search and download functionalities are using the official Maven repository.

vm10.java.domain.vm Maven / Gradle / Ivy

package ${packageName}.domain;

#foreach ($item in $importList)
${item}
#end
import java.io.Serializable;
#if( "$!tableComment" != "" )
/** ${tableComment} */
#end
@Data
@NoArgsConstructor
@AllArgsConstructor
#if( "$!column.columnComment" != "" )
@ApiModel(description = "${column.columnComment}")
#end
@TableName(value = "$tableName")
public class ${ClassName}
#if($configEntity.useMybatisPlus&&$configEntity.mapper.useCache)
 implements Serializable
#elseif($configEntity.useMybatisPlus&&$!configEntity.mapper.useCache&&$configEntity.domain.useActiveRecord)
 extends Model<${ClassName}>
#end
{
    private static final long serialVersionUID = 1L;

#foreach ($column in $columns)
#if(!$tables.isSuperColumn($column.javaField))
    #if($configEntity.domain.addNoteInfo && "$!column.columnComment" != "" )
    /** ${column.columnComment} */
    #end
#if($configEntity.useMybatisPlus&&$column.pkColumn&&!$configEntity.domain.pkInc)
    @TableId()
#elseif($configEntity.useMybatisPlus&&$column.pkColumn&&$configEntity.domain.pkInc)
    @TableId(type = IdType.AUTO)
#end
#if($configEntity.useSwagger&&"$!column.columnComment" != "")
    @ApiModelProperty(value = "${column.columnComment}", position = ${column.ordinalPosition})
#end
#if($column.fieldType=="LocalDate")
    #if($configEntity.domain.dateFormat)
    @JsonFormat(pattern = "yyyy-MM-dd")
    #end
    #if($configEntity.domain.dateSerialize)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @JsonSerialize(using = LocalDateSerializer.class)
    #end
#elseif($column.fieldType=="LocalDateTime")
    #if($configEntity.domain.dateFormat)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    #end
    #if($configEntity.domain.dateSerialize)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    #end
#end
    private $column.fieldType $column.fieldName;
#end

#end
#if($configEntity.domain.addConstructionMethod)
    public ${ClassName}(${ClassName} ${className}) {
        if (Objects.nonNull(${className})) {
#foreach ($columns in $columns)
            this.$columns.fieldName=${className}.$columns.fieldName;
#end
        }
    }
#end
#if($configEntity.domain.overrideToString)
    @Override
    public String toString() {
        ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.JSON_STYLE);
#foreach ($columns in $columns)
        Optional.ofNullable($columns.fieldName).ifPresent(e -> builder.append("$columns.fieldName", e));
#end
        return StringEscapeUtils.unescapeJson(builder.toString());
    }
#end
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy