package cn.estsh.i3plus.pojo.wms.bean.dynamictable;

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;

/**
 * @Description : WMS列表元素表
 * @Reference :
 * @Author : sjc
 * @CreateDate : 2020-01-07 09:06
 * @Modify:
 **/
@Data
@Entity
@Table(name="WMS_LISTELEMENT", indexes = {
        @Index(columnList = "FIELD_NAME"),
        @Index(columnList = "USER_CODE")
})
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Api(value="WMS列表元素表",description = "WMS列表元素表")
public class WmsListElement extends BaseBean {

    private static final long serialVersionUID = 3903166651913139060L;

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

    @Column(name = "TITLE_NAME")
    @ApiParam(value = "标题名称")
    private String titleName;

    @Column(name = "SEQ")
    @ApiParam(value = "序列号:字段标题排序使用默认0（不排序）")
    private Integer seq;

    @Column(name = "IS_REQUIRE", nullable = false)
    @ColumnDefault("2")
    @ApiParam(value = "是否必选:默认1-必选，2-非必选")
    private Integer isRequire;

    @Column(name = "WIDTH", columnDefinition = "decimal(18,8)", nullable = false)
    @ApiParam(value = "宽度", example = "0")
    @ColumnDefault("0")
    private Double width;

    @Column(name = "SORT")
    @ApiParam(value = "排序规则:默认0-不排序，1-升序2-降序")
    private Integer sort;

    @Column(name = "IS_WIDER")
    @ApiParam(value = "是否加粗:默认1-加粗，2-非加粗")
    private Integer isWider;

    @Column(name = "IS_SELECT")
    @ApiParam(value = "是否勾选:默认1-勾选，2-非勾选")
    private Integer isSelect;

    @Column(name = "ISSHOW")
    @ApiParam(value = "是否表单字段展示:默认1-显示，2-隐藏")
    private Integer isShow;

    @Column(name = "DEFAULT_VALUE")
    @ApiParam(value = "表单字段默认值")
    private String defaultValue;

    @Column(name = "USER_CODE")
    @ApiParam(value = "用户编号")
    private String userCode;

    @Column(name = "FUNCTION_ID")
    @ApiParam(value = "功能菜单ID")
    private Long functionId;

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

    @Column(name = "DYNAMIC_FIELD_GET_WAY")
    @ApiParam(value = "下拉框规则")
    private Integer getValWay;

    @Column(name = "ENTITY_NAME")
    @ApiParam(value = "实体名称")
    private String entityName;

    @Column(name = "LIST_COLUMN_NAME")
    @ApiParam(value = "开窗列表显示列名称")
    private String listColumnName;

    @Column(name = "EXPLICIT_COLUMN_NAME")
    @ApiParam(value = "回显列名")
    private String explicitColumnName;

    public WmsListElement() {
    }

    public WmsListElement(Integer seq, String userCode, Long functionId, String organizeCode) {
        this.seq = seq;
        this.userCode = userCode;
        this.functionId = functionId;
        this.organizeCode = organizeCode;
    }
}
