package com.zd.laboratory.domain;

import cn.hutool.core.util.StrUtil;
import com.zd.common.core.annotation.Excel;
import com.zd.common.core.domain.qc.QCInterface;
import com.zd.common.core.utils.StringUtils;
import com.zd.laboratory.interfaces.SysProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.zd.common.core.web.domain.BaseEntity;
import org.hibernate.validator.constraints.Length;

/**
 * 危化品安全技术说明书对象 lab_hazard_book
 *
 * @author liubo
 * @date 2021-11-19
 */
@ApiModel("危化品安全技术说明书")
public class LabHazardBook extends BaseEntity implements QCInterface {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @ApiModelProperty(value = "${comment}")
    private Long id;
    /**
     * 名称
     */
    @Excel(name = "名称")
    @Length(message = "名称长度不能超过128")
    @ApiModelProperty(value = "名称")
    private String name;
    /** 首字母 */
    @Excel(name = "首字母")
    @Length(message = "首字母长度不能超过32")
    @ApiModelProperty(value = "首字母")
    private String pinYinChar;
    /** 名称全拼 */
    @Excel(name = "名称全拼")
    @Length(message = "名称全拼长度不能超过255")
    @ApiModelProperty(value = "名称全拼")
    private String pinYin;
    /**
     * 编号
     */
    @Excel(name = "编号")
    @Length(message = "编号长度不能超过32")
    @ApiModelProperty(value = "编号")
    private String code;
    /**
     * 内容
     */
    @Excel(name = "内容")
    @ApiModelProperty(value = "内容")
    private String content;
    /**
     * 二维码地址
     */
    @Excel(name = "二维码地址")
    @Length(message = "二维码地址长度不能超过255")
    @ApiModelProperty(value = "二维码地址")
    private String qrCodeUrl;
    /**
     * 查看次数
     */
    @Excel(name = "查看次数")
    @ApiModelProperty(value = "查看次数")
    private Integer scanCount = 0;

    /**
     * 化学品id
     */
    @Excel(name = "化学品id")
    @ApiModelProperty(value = "化学品id")
    private Long chemicalId;

    /**
     * 关联危险源技术说明书的id
     */
    @Excel(name = "关联危险源技术说明书的id")
    @ApiModelProperty(value = "关联危险源技术说明书的id")
    private Long joinHazardId;

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getContent() {
        return content;
    }

    public void setQrCodeUrl(String qrCodeUrl) {
        this.qrCodeUrl = qrCodeUrl;
    }


    public void setScanCount(Integer scanCount) {
        this.scanCount = scanCount;
    }

    public Integer getScanCount() {
        if(StringUtils.isNull(scanCount)){
            scanCount = 0;
        }
        return scanCount;
    }

    public String getPinYinChar() {
        return pinYinChar;
    }

    public void setPinYinChar(String pinYinChar) {
        this.pinYinChar = pinYinChar;
    }

    public String getPinYin() {
        return pinYin;
    }

    public void setPinYin(String pinYin) {
        this.pinYin = pinYin;
    }

    @Override
    public String getQrCodeUrl() {
        return StrUtil.format(SysProperties.getQrcodeFormat(),id,1) ;
    }

    public Long getChemicalId() {
        return chemicalId;
    }

    public void setChemicalId(Long chemicalId) {
        this.chemicalId = chemicalId;
    }

    public Long getJoinHazardId() {
        return joinHazardId;
    }

    public void setJoinHazardId(Long joinHazardId) {
        this.joinHazardId = joinHazardId;
    }
}
