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

crud.entityUpdateDTO.vm Maven / Gradle / Ivy

The newest version!
package ${basePackage}.${DTOPackage};

#foreach($pkg in ${table.importPackages})
import ${pkg};
#end
#if(${enableValidated})
#foreach($field in ${table.fields})
    #if(${field.metaInfo.nullable}==false && ${field.keyFlag})
import ${javaApiPackage}.validation.constraints.NotNull;
    #if(${field.metaInfo.nullable}==false && ${field.keyFlag} && ${field.propertyType}=="String")
import ${javaApiPackage}.validation.constraints.NotBlank;
    #end
    #break
    #end
#end
#foreach($field in ${table.fields})
    #if(${field.versionField})
import ${javaApiPackage}.validation.constraints.NotNull;
    #break
    #end
#end
#foreach($field in ${table.fields})
    #if(${field.propertyType}=="String")
import ${javaApiPackage}.validation.constraints.Size;
    #break
    #end
#end
#end
#if(${springdoc})
import io.swagger.v3.oas.annotations.media.Schema;
#elseif(${swagger})
##import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
#end
#if(${entityLombokModel})
import lombok.Data;
#if(${chainModel})
import lombok.experimental.Accessors;
#end
#end

/**
 * $!{table.comment}更新DTO
 *
 * @author ${author}
 * @since ${date}
 */
#if(${entityLombokModel})
@Data
  #if(${chainModel})
@Accessors(chain = true)
  #end
#end
###if(${springdoc})
##@Schema(name = "${entity}UpdateDTO", description = "$!{table.comment}更新DTO")
###elseif(${swagger})
##@ApiModel(value = "${entity}UpdateDTO对象", description = "$!{table.comment}更新DTO")
###end
public class ${entity}UpdateDTO {
#if(${entitySerialVersionUID})
##
##    private static final long serialVersionUID = 1L;
#end
## ----------  BEGIN 字段循环遍历  ----------
#foreach($field in ${table.fields})
#if(($updateExcludeFields.contains(${field.propertyName})))
#elseif(${field.logicDeleteField})
#else

#if("$!field.comment" != "")
  #if(${springdoc})
    @Schema(description = "${field.comment}")
  #elseif(${swagger})
    @ApiModelProperty("${field.comment}")
  #else
    /**
     * ${field.comment}
     */
  #end
#end
#if(${enableValidated})
#if(${field.keyFlag})
## 主键
    @NotNull(message = "${field.comment}不能为空")
    #if(${field.propertyType}=="String")
    @NotBlank(message = "${field.comment}不能为空")
    #end
#end
## 乐观锁注解
#if(${field.versionField})
    @NotNull(message = "${field.comment}不能为空")
    #if(${field.propertyType}=="String")
    @NotBlank(message = "${field.comment}不能为空")
    #end
#end
    #if(${field.propertyType} == "String")
    @Size(message = "${field.comment}长度不能超过${field.metaInfo.length}", max = ${field.metaInfo.length})
    #end
#end
    private ${field.propertyType} ${field.propertyName};
#end
#end
## ----------  END 字段循环遍历  ----------
#if(!${entityLombokModel})
#foreach($field in ${table.fields})
#if($updateExcludeFields.contains(${field.propertyName}))
#elseif(${field.logicDeleteField})
#else
  #if(${field.propertyType.equals("boolean")})
    #set($getprefix="is")
  #else
    #set($getprefix="get")
  #end

    public ${field.propertyType} ${getprefix}${field.capitalName}() {
        return ${field.propertyName};
    }

  #if(${chainModel})
    public ${entity}UpdateDTO set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
  #else
    public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
  #end
        this.${field.propertyName} = ${field.propertyName};
  #if(${chainModel})
        return this;
  #end
    }
#end
#end
## --foreach end---
#end
## --end of #if(!${entityLombokModel})--

#if(!${entityLombokModel})

    @Override
    public String toString() {
        return "${entity}{" +
  #foreach($field in ${table.fields})
  #if($updateExcludeFields.contains(${field.propertyName}))
  #elseif(${field.logicDeleteField})
  #else
    #if($!{foreach.index}==0)
        "${field.propertyName} = " + ${field.propertyName} +
    #else
        ", ${field.propertyName} = " + ${field.propertyName} +
    #end
  #end
  #end
        "}";
    }
#end
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy