package com.zbf.system.domain;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zbf.common.annotation.Excel;
import com.zbf.common.core.domain.TreeEntity;

import java.lang.reflect.Field;

/**
 * 物料bom对象 t_base_goods_bom
 *
 * @author tony
 * @date 2024-06-16
 */
@TableName(resultMap = "com.zbf.system.mapper.TBaseGoodsBomMapper.TBaseGoodsBomResult")
public class TBaseGoodsBom extends TreeEntity {
private static final long serialVersionUID = 1L;

    /** 主键 */
    @Excel(name = "主键")
    @TableId(value = "id",type = IdType.AUTO)
    private Long id;

    /** 父id */
    @Excel(name = "父id")
    private Long pid;

    /** 物料ID */
    @Excel(name = "物料ID")
    private String goodsId;

    /** 物料名称 */
    @Excel(name = "物料名称")
    private String goodsName;

    /** 物料类别 0：总成 1：分总成 2：小总成 3：小小总成 4：物料 */
    @Excel(name = "物料类别")
    private Integer goodsType;

    /** 序号 */
    @Excel(name = "序号")
    private String serialNumber;

    /** 数量 */
    @Excel(name = "数量")
    private Long goodsNum;

    public static JSONArray getColumnsJson() {
        JSONArray columns = new JSONArray();
        Field[] fields = TBaseGoodsBom.class.getDeclaredFields();
        int key = 0;
        for (Field field : fields) {
            Excel excelAnnotation = field.getAnnotation(Excel.class);
            if (excelAnnotation != null) {
                JSONObject column = new JSONObject();
                column.put("seq", key++);
                column.put("key", field.getName());
                column.put("label", excelAnnotation.name());
                column.put("visible", true);  // 假设所有列默认都是可见的
                column.put("columnName", field.getName());  // 设置列ID
                columns.put(column);
            }
        }
        return columns;
    }

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

    public Long getId()
            {
            return id;
            }
    public void setPid(Long pid)
            {
            this.pid = pid;
            }

    public Long getPid()
            {
            return pid;
            }
    public void setGoodsId(String goodsId)
            {
            this.goodsId = goodsId;
            }

    public String getGoodsId()
            {
            return goodsId;
            }
    public void setGoodsName(String goodsName)
            {
            this.goodsName = goodsName;
            }

    public String getGoodsName()
            {
            return goodsName;
            }
    public void setGoodsType(Integer goodsType)
            {
            this.goodsType = goodsType;
            }

    public Integer getGoodsType()
            {
            return goodsType;
            }
    public void setSerialNumber(String serialNumber)
            {
            this.serialNumber = serialNumber;
            }

    public String getSerialNumber()
            {
            return serialNumber;
            }
    public void setGoodsNum(Long goodsNum)
            {
            this.goodsNum = goodsNum;
            }

    public Long getGoodsNum()
            {
            return goodsNum;
            }

@Override
public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("pid", getPid())
            .append("goodsId", getGoodsId())
            .append("goodsName", getGoodsName())
            .append("goodsType", getGoodsType())
            .append("serialNumber", getSerialNumber())
            .append("goodsNum", getGoodsNum())
            .append("remark", getRemark())
            .append("createTime", getCreateTime())
            .append("updateTime", getUpdateTime())
        .toString();
        }
}


















