package com.xisc.pm.domain.entity;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.choerodon.mybatis.annotation.ModifyAudit;
import io.choerodon.mybatis.annotation.VersionAudit;
import io.choerodon.mybatis.domain.AuditDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Objects;


/**
 * 钢板轧制规格对应收得率基准表(PmPlateSpecYieldBt)实体类
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-23 16:29:24
 */

@Getter
@Setter
@ApiModel("钢板轧制规格对应收得率基准表")
@VersionAudit
@ModifyAudit
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@Table(name = "PM_PLATE_SPEC_YIELD_BT")
public class PmPlateSpecYieldBt extends AuditDomain implements Serializable {
    private static final long serialVersionUID = -54811098451052179L;

    public static final String FIELD_PPSYB_ID = "ppsybId";
    public static final String FIELD_APN = "apn";
    public static final String FIELD_ST_NO = "stNo";
    public static final String FIELD_CC_TYPE = "ccType";
    public static final String FIELD_PLATE_THICK_FROM = "plateThickFrom";
    public static final String FIELD_PLATE_THICK_TO = "plateThickTo";
    public static final String FIELD_COMBINE_PLATE_WIDTH_FROM = "combinePlateWidthFrom";
    public static final String FIELD_COMBINE_PLATE_WIDTH_TO = "combinePlateWidthTo";
    public static final String FIELD_YIELD = "yield";
    public static final String FIELD_MAX_YIELD = "maxYield";
    public static final String FIELD_TENANT_ID = "tenantId";
    public static final String FIELD_ATTRIBUTE1 = "attribute1";
    public static final String FIELD_ATTRIBUTE2 = "attribute2";
    public static final String FIELD_ATTRIBUTE3 = "attribute3";
    public static final String FIELD_ATTRIBUTE4 = "attribute4";
    public static final String FIELD_ATTRIBUTE5 = "attribute5";
    public static final String FIELD_ROLL_LINE_NO = "rollLineNo";

    @ApiModelProperty("主键ID")
    @Id
    @GeneratedValue
    private Long ppsybId;


    @ApiModelProperty(value = "最终用途码", required = true)
    @NotBlank
    private String apn;


    @ApiModelProperty(value = "内部钢种")
    private String stNo;

    @ApiModelProperty(value = "连铸机类型", required = true)
    @NotBlank
    private String ccType;

    @Transient
    @ApiModelProperty(value = "连铸机类型含义")
    private String ccTypeDesc;

    @ApiModelProperty(value = "钢板厚度起", required = true)
    @NotNull
    private BigDecimal plateThickFrom;

    @ApiModelProperty(value = "钢板厚度止", required = true)
    @NotNull
    private BigDecimal plateThickTo;

    @ApiModelProperty(value = "组合板宽度起", required = true)
    @NotNull
    private BigDecimal combinePlateWidthFrom;

    @ApiModelProperty(value = "组合板宽度止", required = true)
    @NotNull
    private BigDecimal combinePlateWidthTo;

    @ApiModelProperty(value = "收得率", required = true)
    @NotNull
    private BigDecimal yield;


    @ApiModelProperty(value = "最大收得率", required = true)
    @NotNull
    private BigDecimal maxYield;

    @ApiModelProperty(value = "租户ID", required = true)
    @NotNull
    private Long tenantId;

    @ApiModelProperty(value = "轧制产线号", required = true)
    @NotNull
    private String rollLineNo;

    @Transient
    @ApiModelProperty(value = "轧制产线号含义")
    private String rollLineNoDesc;


    private String attribute1;

    private String attribute2;

    private String attribute3;

    private String attribute4;

    private String attribute5;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        PmPlateSpecYieldBt that = (PmPlateSpecYieldBt) o;
        return Objects.equals(apn, that.apn) && Objects.equals(stNo, that.stNo) && Objects.equals(ccType, that.ccType) &&
                Objects.equals(ccTypeDesc, that.ccTypeDesc) && Objects.equals(plateThickFrom, that.plateThickFrom) &&
                Objects.equals(plateThickTo, that.plateThickTo) && Objects.equals(combinePlateWidthFrom, that.combinePlateWidthFrom) &&
                Objects.equals(combinePlateWidthTo, that.combinePlateWidthTo) && Objects.equals(yield, that.yield) &&
                Objects.equals(maxYield, that.maxYield) && Objects.equals(tenantId, that.tenantId) &&
                Objects.equals(rollLineNo, that.rollLineNo) && Objects.equals(rollLineNoDesc, that.rollLineNoDesc);
    }

    @Override
    public int hashCode() {
        return Objects.hash(apn, stNo, ccType, ccTypeDesc, plateThickFrom, plateThickTo, combinePlateWidthFrom,
                combinePlateWidthTo, yield, maxYield, tenantId, rollLineNo, rollLineNoDesc);
    }
}
