package com.ruoyi.oa.domain;

import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.entity.SysUser;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * cmc耗材购买对象 cmc_material_buy
 * 
 * @author cmc
 * @date 2024-07-31
 */
public class CmcMaterialBuy extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 耗材购买id */
    private Integer buyId;

    /** 耗材id */
    @Excel(name = "耗材名称")
    private String name;
    @Excel(name = "品牌")
    private String brand;
    @Excel(name = "系列")
    private String series;
    private Integer materialId;

    /** 采购日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "采购日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date buyTime;

    /** 采购地点 */
    @Excel(name = "采购地点")
    private String place;

    /** 采购数量 */
    @Excel(name = "采购数量")
    private Double totalNum;

    /** 单价 */
    @Excel(name = "单价")
    private BigDecimal price;

    /** 总价 */
    @Excel(name = "总价")
    private BigDecimal amount;

    /** 采购人 */
    @Excel(name = "采购人")
    private String buyUserName;
    private Long buyer;

    private SysUser buyUser;

    private CmcMaterial material;

    public void setBuyId(Integer buyId) 
    {
        this.buyId = buyId;
    }

    public Integer getBuyId() 
    {
        return buyId;
    }

    public void setMaterial(CmcMaterial material)
    {
        this.material = material;
        if (material != null) {
            this.brand = material.getBrand();
            this.series = material.getSeries();
            this.name = material.getName();
        }
    }

    public CmcMaterial getMaterial()
    {
        return material;
    }
    public void setMaterialId(Integer materialId) 
    {
        this.materialId = materialId;
    }

    public Integer getMaterialId() 
    {
        return materialId;
    }
    public void setBuyTime(Date buyTime) 
    {
        this.buyTime = buyTime;
    }

    public Date getBuyTime() 
    {
        return buyTime;
    }
    public void setPlace(String place) 
    {
        this.place = place;
    }

    public String getPlace() 
    {
        return place;
    }
    public void setTotalNum(Double totalNum) 
    {
        this.totalNum = totalNum;
    }

    public Double getTotalNum() 
    {
        return totalNum;
    }
    public void setPrice(BigDecimal price) 
    {
        this.price = price;
    }

    public BigDecimal getPrice() 
    {
        return price;
    }
    public void setAmount(BigDecimal amount) 
    {
        this.amount = amount;
    }

    public BigDecimal getAmount() 
    {
        return amount;
    }
    public void setBuyer(Long buyer) 
    {
        this.buyer = buyer;
    }

    public Long getBuyer() 
    {
        return buyer;
    }
    public void setBuyUser(SysUser buyUser)
    {
        this.buyUser = buyUser;
        this.buyUserName = buyUser == null ? "" : buyUser.getNickName();
    }

    public SysUser getBuyUser()
    {
        return buyUser;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("buyId", getBuyId())
            .append("materialId", getMaterialId())
            .append("buyTime", getBuyTime())
            .append("place", getPlace())
            .append("totalNum", getTotalNum())
            .append("price", getPrice())
            .append("amount", getAmount())
            .append("buyer", getBuyer())
            .append("remark", getRemark())
            .toString();
    }
}
