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

templates.dto.ftl Maven / Gradle / Ivy

There is a newer version: 1.1.26
Show newest version
package ${package.DTO};

import com.fasterxml.jackson.annotation.JsonFormat;
<#list table.importPackages as pkg>
    <#if !pkg?string?contains('com.baomidou.mybatisplus.annotation.') && !pkg?string?contains('BaseEntity')>
import ${pkg};
    

<#if springdoc>
import io.swagger.v3.oas.annotations.media.Schema;
<#elseif swagger>
<#if superDTOClassPackage??>
import ${superDTOClassPackage};

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

<#if dtoLombokModel>
import lombok.Getter;
import lombok.Setter;

    <#if chainModel>
import lombok.experimental.Accessors;
    

<#if childTableList??>
    <#list childTableList as child>
import ${packageBaseParent}.${child}.entity.${child?cap_first};
    
import java.util.List;


/**
 * 

* ${table.comment!} *

* * @author ${author} * @since ${date} */ <#if dtoLombokModel> @Getter @Setter <#if chainModel> @Accessors(chain = true) <#if springdoc> @Schema(name = "${dtoName}", description = "$!{table.comment}") <#elseif swagger> @ApiModel(value = "${dtoName}", description = "${table.comment!}") <#if superDTOClass??> public class ${dtoName} implements ${superDTOClass}<#if activeRecord><${dtoName}> { <#elseif activeRecord> public class ${dtoName} extends Model<${dtoName}> { <#elseif dtoSerialVersionUID> public class ${dtoName} implements Serializable { <#else> public class ${dtoName} { <#if dtoSerialVersionUID> private static final long serialVersionUID = 1L; <#-- ---------- BEGIN 字段循环遍历 ----------> <#list table.fields as field> <#if field.keyFlag> <#assign keyPropertyName="${field.propertyName}"/> <#if field.comment!?length gt 0> <#if springdoc> @Schema(description = "${field.comment}") <#elseif swagger> @ApiModelProperty("${field.comment}") <#else> /** * ${field.comment} */ <#if field.propertyType=="LocalDateTime"> @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss", timezone = "GMT+8") <#if field.propertyType=="Date" || field.propertyType=="LocalDate"> @JsonFormat(pattern = "yyyy/MM/dd", timezone = "GMT+8") private ${field.propertyType} ${field.propertyName}; <#if childTableList??> <#list childTableList as child> private List<${child?cap_first}> ${child?lower_case}List; <#------------ END 字段循环遍历 ----------> <#if !dtoLombokModel> <#list table.fields as field> <#if field.propertyType == "boolean"> <#assign getprefix="is"/> <#else> <#assign getprefix="get"/> public ${field.propertyType} ${getprefix}${field.capitalName}() { return ${field.propertyName}; } <#if chainModel> public ${dtoName} set${field.capitalName}(${field.propertyType} ${field.propertyName}) { <#else> public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) { this.${field.propertyName} = ${field.propertyName}; <#if chainModel> return this; } <#if dtoColumnConstant> <#list table.fields as field> public static final String ${field.name?upper_case} = "${field.name}"; <#if activeRecord> @Override public Serializable pkVal() { <#if keyPropertyName??> return this.${keyPropertyName}; <#else> return null; } <#if !dtoLombokModel> @Override public String toString() { return "${dtoName}{" + <#list table.fields as field> <#if field_index==0> "${field.propertyName} = " + ${field.propertyName} + <#else> ", ${field.propertyName} = " + ${field.propertyName} + "}"; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy