/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package cn.ysk.cashier.cons.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @author admin
* @date 2024-06-22
**/
@Entity
@Data
@Table(name="tb_cons_info_flow")
public class TbConsInfoFlow implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`cons_id`")
    @ApiModelProperty(value = "耗材id")
    private Integer consId;



    @Column(name = "`pro_sku_id`")
    @ApiModelProperty(value = "规格id")
    private Integer   proSkuId;

    @Column(name = "`con_name`")
    @ApiModelProperty(value = "耗材名称")
    private String conName;

    @Column(name = "`amount`")
    @ApiModelProperty(value = "变化值")
    private BigDecimal amount;

    @Column(name = "`balance`")
    @ApiModelProperty(value = "变化后的值")
    private BigDecimal balance;

    @Column(name = "`biz_code`")
    @ApiModelProperty(value = "操作代码")
    private String bizCode;

    @Column(name = "`biz_name`")
    @ApiModelProperty(value = "操作说明")
    private String bizName;

    @Column(name = "`biz_type`")
    @ApiModelProperty(value = "加减标识+/-")
    private String bizType;

    @Column(name = "`create_time`")
    @ApiModelProperty(value = "createTime")
    private Timestamp createTime;

    @Column(name = "`update_time`")
    @ApiModelProperty(value = "updateTime")
    private Timestamp updateTime;

    @Column(name = "`shop_id`")
    @ApiModelProperty(value = "店铺id")
    private Integer shopId;



    @Column(name = "`order_id`")
    @ApiModelProperty(value = "订单id")
    private Integer orderId;


    @Column(name = "`order_no`")
    @ApiModelProperty(value = "订单编号")
    private String orderNo;

    @Transient
    @TableField(exist = false)
    private String productName;

    public void copy(TbConsInfoFlow source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
