package cc.smtweb.framework.core.db.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

/**
 * 字段定义
 * {name:"字段名，如id",fieldType:"字段类型，如编码字段", dataType:"数据类型，如ID/CODE/NAME等", null:"0-空/1-非空", default: "默认值", title:"中文名",link:"外键关联表",editor:"控件类型：TEXT/TextArea/NUMBER/COMBO"}
 */
@Data
public class ModelField {
    private String name;
    private String title;
    private String remark;
    //字段类型，如编码字段，参见FieldTypeDef
    private int fieldType;
    /**
     * 数据类型，参见DataType
     */
    private String dataType;
    /**
     * '禁止为空'
     */
    @JsonProperty("null")
    private int notNull;
    /**
     * '默认值'
     */
    @JsonProperty("default")
    private String defaultValue;
    //外键关联表
    private long link;
    //控件类型：TEXT/TextArea/NUMBER/COMBO
    private String editor;

    @JsonIgnore
    public boolean isNotNull() {
        return notNull == 1;
    }

}
