/*
*  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 com.youchain.businessdata.domain;

import com.youchain.base.BaseEntity;
import com.youchain.basicdata.domain.BigItem;
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.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author ShenYinAn
* @date 2024-01-30
**/
@Entity
@Data
@Table(name="data_spareparts")
public class Spareparts  extends BaseEntity implements Serializable {

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

    @Column(name = "`station_type`")
    @ApiModelProperty(value = "工位")
    private String stationType;

    @Column(name = "`date`")
    @ApiModelProperty(value = "下线日期")
    private Timestamp date;

    @OneToOne
    @JoinColumn(name = "`big_item_id`")
    @ApiModelProperty(value = "型式名")
    private BigItem bigItemId;

    @Column(name = "`order_quantity`")
    @ApiModelProperty(value = "数量")
    private Integer orderQuantity;

    @Column(name = "`status`")
    @ApiModelProperty(value = "状态")
    private String status;

    @Column(name = "`start_number`")
    @ApiModelProperty(value = "起始机号")
    private String startNumber;

    @Column(name = "`end_number`")
    @ApiModelProperty(value = "结束机号")
    private String endNumber;

    @Column(name = "`description`")
    @ApiModelProperty(value = "备注")
    private String description;

    @Column(name = "`hy_by`")
    @ApiModelProperty(value = "耗用")
    private String hyBy;
//
//    @Column(name = "`update_by`")
//    @ApiModelProperty(value = "更新人")
//    private String updateBy;
//
    @Column(name = "`hy_time`")
    @ApiModelProperty(value = "耗用时间")
    private Timestamp hyTime;
//
//    @Column(name = "`update_time`")
//    @ApiModelProperty(value = "修改时间")
//    private Timestamp updateTime;
//
    @Column(name = "`dept_id`")
    @ApiModelProperty(value = "仓库ID")
    private Long deptId;

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