package com.heketai.website.entity;

import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;

/**
 * author xjl
 * since 2019-12-17
 */
@TableName("product")
@Data
public class Product extends Model<Product> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("分类id")
    @TableField("category_id")
    private Integer categoryId;

    @ApiModelProperty("产品型号")
    @TableField("goods_type")
    private String goodsType;

    @ApiModelProperty("制造商料号")
    @TableField("goods_sn")
    private String goodsSn;

    @ApiModelProperty("商品图")
    @TableField("img")
    private String img;

    @ApiModelProperty("中文网站商品手册")
    @TableField("manual")
    private String manual;

    @ApiModelProperty("英文网站商品手册")
    @TableField("manual_ch")
    private String manualCh;
    @ApiModelProperty("封装规格")
    @TableField("package_specification")
    private String packageSpecification;

    @ApiModelProperty("应用ids")
    @TableField("app_ids")
    private String appIds;

    @ApiModelProperty("属性1")
    @TableField("attr_1")
    private String attr1;

    @ApiModelProperty("属性2")
    @TableField("attr_2")
    private String attr2;

    @ApiModelProperty("属性3")
    @TableField("attr_3")
    private String attr3;

    @ApiModelProperty("属性4")
    @TableField("attr_4")
    private String attr4;

    @ApiModelProperty("属性5")
    @TableField("attr_5")
    private String attr5;

    @ApiModelProperty("属性6")
    @TableField("attr_6")
    private String attr6;

    @ApiModelProperty("属性7")
    @TableField("attr_7")
    private String attr7;

    @ApiModelProperty("属性8")
    @TableField("attr_8")
    private String attr8;

    @ApiModelProperty("属性9")
    @TableField("attr_9")
    private String attr9;

    @ApiModelProperty("属性10")
    @TableField("attr_10")
    private String attr10;


    @TableField(exist = false)
    private String isSummary;

    @ApiModelProperty("分类(0.代表分离器件。1.代表阻容)")
    @TableField("sort")
    private Integer sort;

    @ApiModelProperty("丝印")
    @TableField("silk_screen")
    private String silkScreen;

    @ApiModelProperty("备注")
    @TableField("remarks")
    private String remarks;

    @ApiModelProperty("产品唯一编码")
    @TableField("only_coding")
    private String onlyCoding;

    public void SetAttr(int i, String value) {
        switch (i) {
            case 1:
                setAttr1(value);
                break;
            case 2:
                setAttr2(value);
                break;
            case 3:
                setAttr3(value);
                break;
            case 4:
                setAttr4(value);
                break;
            case 5:
                setAttr5(value);
                break;
            case 6:
                setAttr6(value);
                break;
            case 7:
                setAttr7(value);
                break;
            case 8:
                setAttr8(value);
                break;
            case 9:
                setAttr9(value);
                break;
            case 10:
                setAttr10(value);
                break;
        }
    }

    public String GetAttr(int i) {
        switch (i) {
            case 1:
                return getAttr1();
            case 2:
                return getAttr2();
            case 3:
                return getAttr3();
            case 4:
                return getAttr4();
            case 5:
                return getAttr5();
            case 6:
                return getAttr6();
            case 7:
                return getAttr7();
            case 8:
                return getAttr8();
            case 9:
                return getAttr9();
            case 10:
                return getAttr10();
            default:
                return null;
        }
    }


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
