package ${packageName}.admin.validate.${moduleName};

import com.hxkj.common.validator.annotation.IDMust;
import com.hxkj.common.validator.annotation.IntegerContains;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import lombok.Data;
import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * ${functionName}参数
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class ${EntityName}Param implements Serializable {

    private static final long serialVersionUID = 1L;

    public interface create{}
    public interface update{}
    public interface delete{}

#foreach ($column in $columns)
  #if($column.isInsert || $column.isEdit || $column.isPk==1)
    #if($column.isPk)
    @IDMust(message = "${column.javaField}参数必传且需大于0", groups = {update.class, delete.class})
    #end
    #if(!$column.isPk && $column.isRequired  && !$column.columnType.equals('text'))
    @NotNull(message = "${column.javaField}参数缺失", groups = {#if($column.isInsert)create.class#end#if($column.isInsert&&$column.isEdit), #end#if($column.isEdit)update.class#end})
    #end
    #if(!$column.isPk && $column.javaType.equals("String") && !$column.columnType.equals('text'))
    @Length(max = ${column.columnLength}, message = "${column.javaField}参数不能超出${column.columnLength}个字符", groups = {#if($column.isInsert)create.class#end#if($column.isInsert&&$column.isEdit), #end#if($column.isEdit)update.class#end})
    #end
    #if(!$column.isPk && $column.javaField.substring(0,2)!="is" && ($column.javaType.equals("Integer") || $column.javaType.equals("Long")))
    @DecimalMin(value = "0", message = "${column.javaField}参数值不能少于0", groups = {#if($column.isInsert)create.class#end#if($column.isInsert&&$column.isEdit), #end#if($column.isEdit)update.class#end})
    #end
    #if(!$column.isPk && $column.javaField.substring(0,2)=="is" && $column.javaType.equals("Integer"))
    @IntegerContains(values = {0, 1}, message = "${column.javaField}参数值不在符合范围", groups = {#if($column.isInsert)create.class#end#if($column.isInsert&&$column.isEdit), #end#if($column.isEdit)update.class#end})
    #end
    private ${column.javaType} ${column.javaField};

  #end
#end
}
