/*
*  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.pojo.product;

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.io.Serializable;

/**
* @website https://eladmin.vip
* @description 操作记录
* @author lyf
* @date 2024-01-25
**/
@Entity
@Data
@Table(name="tb_product_stock_operate")
public class TbProductStockOperate implements Serializable {

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

    @Column(name = "`shop_id`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "店铺Id")
    private String shopId;

    @Column(name = "`stock_snap`")
    @ApiModelProperty(value = "操作镜像")
    private String stockSnap;

    @Column(name = "`type`")
    @ApiModelProperty(value = "type")
    private String type;

    @Column(name = "`sub_type`")
    @ApiModelProperty(value = "subType")
    private Integer subType;

    @Column(name = "`batch_number`")
    @ApiModelProperty(value = "批次")
    private String batchNumber;

    @Column(name = "`remark`")
    @ApiModelProperty(value = "remark")
    private String remark;

    @Column(name = "`stock_time`")
    @ApiModelProperty(value = "操作时间")
    private Long stockTime;

    @Column(name = "`operator_snap`")
    @ApiModelProperty(value = "操作人")
    private String operatorSnap;

    @Column(name = "`created_at`")
    @ApiModelProperty(value = "createdAt")
    private Long createdAt;

    @Column(name = "`updated_at`")
    @ApiModelProperty(value = "updatedAt")
    private Long updatedAt;

    @Column(name = "`purveyor_id`")
    @ApiModelProperty(value = "供应商Id")
    private String purveyorId;

    @Column(name = "`purveyor_name`")
    @ApiModelProperty(value = "供应商名称")
    private String purveyorName;

    @Column(name = "`status`")
    @ApiModelProperty(value = "nullify作废normal正常")
    private String status;

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