package cn.estsh.i3plus.pojo.screen.bean;

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;

/**
 * @author Wynne.Lu
 * @date 2021/3/11 下午12:29
 * @desc
 */
@Entity
@Table(name = "SCR_MODEL_FIELD")
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@DynamicUpdate
@DynamicInsert
@Builder
@ApiModel("model字段")
public class ScrModelField extends BaseBean implements Serializable {
    private static final long serialVersionUID = 3893137576091823152L;

    @Column(name = "MODEL_CODE")
    @ApiModelProperty("model代码")
    private String modelCode;

    @Column(name = "FIELD_CODE")
    @ApiModelProperty("字段代码")
    private String fieldCode;

    @Column(name = "FIELD_NAME")
    @ApiModelProperty("字段名称")
    private String fieldName;

    @Column(name = "DISPLAY_NAME")
    @ApiModelProperty("显示名称")
    private String displayName;

    @Column(name = "FIELD_TYPE")
    @ApiModelProperty(value = "字段类型")
    private Integer fieldType;

    @Column(name = "IS_FUZZY_SEARCH")
    @ApiModelProperty("是否支持模糊查询")
    private Integer isFuzzySearch;

    @Column(name = "IS_SHOW_IN_NEW")
    @ApiModelProperty("是否在新增时展示")
    private Integer isShowInNew;

    @Column(name = "IS_SHOW_IN_EDIT")
    @ApiModelProperty("是否在编辑时展示")
    private Integer isShowInEdit;

    @Column(name = "IS_ALLOW_SORT")
    @ApiModelProperty("是否支持排序")
    private Integer isAllowSort;

    @Column(name = "IS_ALLOW_MODIFY")
    @ApiModelProperty("是否支持修改")
    private Integer isAllowModify;

    @Column(name = "IS_REQUIRED")
    @ApiModelProperty("是否必填")
    private Integer isRequired;

    @Column(name = "SEQ", columnDefinition = "int(11) default 0")
    @ApiModelProperty("表单顺序")
    private Integer seq;

    @Column(name = "VALIDATION")
    @ApiModelProperty("校验")
    private String regexValidation;

    @Column(name = "IS_VIRTUAL")
    @ApiModelProperty("是否是虚拟的")
    private Integer isVirtual;

    @Column(name = "MODEL_FIELD_SOURCE")
    @ApiModelProperty("字段数据来源")
    private Integer modelFieldSource;

    @Column(name = "MODEL_FIELD_SOURCE_PROPS")
    @ApiModelProperty("model字段来源属性")
    private String modelFieldSourceProps;

    @Transient
    @ApiModelProperty(value="模型字段值")
    private Object fieldValue;

}
