package {{packageName}}.client.{{apis}}.feign.dto;

import java.sql.Timestamp;
import java.util.List;
import java.math.BigDecimal;

import net.ibizsys.central.util.EntityDTO;

import com.fasterxml.jackson.annotation.JsonIgnore;
import net.ibizsys.runtime.util.DataTypeUtils;

public class {{apiDto.codeName}} extends EntityDTO {


{{#each apiDto.apiDtoFields as |field|}}
    /**
    * {{field.logicName}}
    */
    public final static String FIELD_{{upperCase field.codeName}} = "{{field.codeName}}";

    /**
     * 设置「{{field.logicName}}」
     *
     * @param {{camelCase codeName}}
    */
    @JsonIgnore
    public {{apiDto.codeName}} set{{pascalCase codeName}}({{javaType}} {{camelCase codeName}}) {
        this._set(FIELD_{{upperCase field.codeName}}, {{camelCase codeName}});
        return this;
    }

    /**
     * 获取「{{field.logicName}}」值
     *
    */
    @JsonIgnore
    public {{javaType}} get{{pascalCase codeName}}() {
        {{#if (or (eq javaType 'Integer') (eq javaType 'Long') (eq javaType 'Double') (eq javaType 'BigInteger') (eq javaType 'BigDecimal') (eq javaType 'Timestamp'))}}
        try{
        {{#if (eq javaType 'Timestamp')}}
            return DataTypeUtils.getDateTimeValue(this._get(FIELD_{{upperCase field.codeName}}),null);
        {{else}}
            return DataTypeUtils.get{{javaType}}Value(this._get(FIELD_{{upperCase field.codeName}}),null);
        {{/if}}
        }catch (Exception e){
            throw new RuntimeException(e);
        }
        {{else}}
        return ({{javaType}}) this._get(FIELD_{{upperCase field.codeName}});
        {{/if}}
    }

    /**
     * 判断 「{{field.logicName}}」是否有值
     *
    */
    @JsonIgnore
    public boolean contains{{pascalCase codeName}}() {
        return this._contains(FIELD_{{upperCase field.codeName}});
    }

    /**
     * 重置 「{{field.logicName}}」
     *
    */
    @JsonIgnore
    public {{apiDto.codeName}} reset{{pascalCase codeName}}() {
        this._reset(FIELD_{{upperCase field.codeName}});
        return this;
    }

{{/each}}

}
