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

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-22
**/
@Entity
@Data
@Table(name="tb_shop_purveyor")
public class TbShopPurveyor 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 = "`sort`")
    @ApiModelProperty(value = "排序")
    private Integer sort;

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

    @Column(name = "`purveyor_name`")
    @ApiModelProperty(value = "联系人名字")
    private String purveyorName;

    @Column(name = "`purveyor_telephone`")
    @ApiModelProperty(value = "联系人电话")
    private String purveyorTelephone;

    @Column(name = "`period`")
    @ApiModelProperty(value = "结算周期（日）")
    private Integer period;

    @Column(name = "`address`")
    @ApiModelProperty(value = "供应商地址")
    private String address;

    @Column(name = "`tip`")
    @ApiModelProperty(value = "标签")
    private String tip;

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

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

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

    @Column(name = "`last_transact_at`")
    @ApiModelProperty(value = "最后一次交易时间(主要做排序)")
    private Long lastTransactAt;

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