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

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.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @Description :产品流程配置操作参数表
 * @Reference :
 * @Author : jack.jia
 * @CreateDate : 2019-04-02
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_PROD_ROUTE_OPT_PARAM", indexes = {
        @Index(columnList = "ROUTE_CODE"),
        @Index(columnList = "PROCESS_CODE"),
        @Index(columnList = "STEP_CODE")
})
@Api("产品流程配置操作参数表")
public class MesProdRouteOptParam extends BaseBean implements Serializable {
    private static final long serialVersionUID = -5043197912658757665L;
    @Column(name = "PROD_ROUTE_CFG_ID")
    @ApiParam("产品流程ID")
    private Long prodRouteCfgId;

    @Column(name = "ROUTE_CODE")
    @ApiParam("流程代码")
    private String routeCode;

    @Column(name = "PROCESS_CODE")
    @ApiParam("工序代码")
    private String processCode;

    @Column(name = "SM_CODE")
    @ApiParam("状态机代码")
    private String smCode;

    @Column(name = "STATUS_CODE")
    @ApiParam("状态代码")
    private String statusCode;

    @Column(name = "AMG_ID")
    @ApiParam("工步集代码")
    private Long amgId;

    @Column(name = "STEP_CODE")
    @ApiParam("工步代码")
    private String stepCode;

    @Column(name = "STEP_SEQ")
    @ApiParam("工步顺序")
    private Integer stepSeq;

    @Column(name = "PARAM_CODE")
    @ApiParam("工步参数代码")
    private String paramCode;

    @Column(name = "PARAM_TYPE")
    @ApiParam("工步参数类型")
    private Integer paramType;

    @Column(name = "PARAM_VALUE")
    @ApiParam("工步参数值")
    private String paramValue;

    @Column(name = "IS_ACTIVE")
    @ApiParam("是否执行 1=是 2=否")
    private Integer isActive;

    @Column(name = "STEP_DISPLAY_NAME")
    @ApiParam("工步展示名称")
    private String stepDisplayName;

    @Transient
    @Column(name = "PARAM_ATTRIBUTE")
    @ApiParam("参数属性")
    private String paramAttribute;

    public long getProdRouteCfgIdVal() {
        return this.prodRouteCfgId == null ? 0l : this.prodRouteCfgId;
    }

    public int getStepSeq() {
        return this.stepSeq == null ? 0 : this.stepSeq;
    }

    public void setStepSeq(int stepSeq) {
        this.stepSeq = stepSeq;
    }

    public int getParamTypeVal() {
        return this.paramType == null ? 0 : this.paramType;
    }
}
