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 java.sql.Timestamp;
import java.io.Serializable;

@Entity
@Data
@Table(name="tb_shop_storage")
public class TbShopStorage  implements Serializable {

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

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

    @Column(name = "`img_url`")
    @ApiModelProperty(value = "酒品图")
    private String imgUrl;

    @Column(name = "`unit`")
    @ApiModelProperty(value = "单位")
    private String unit;

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

    @Column(name = "`status`")
    @ApiModelProperty(value = "0：已取完；1：未取完")
    private Integer status;

    @Column(name = "`exp_time`")
    @ApiModelProperty(value = "到期时间")
    private Timestamp expTime;

    @Column(name = "`sav_time`")
    @ApiModelProperty(value = "存酒时间")
    private Timestamp savTime;

    @Column(name = "`user_id`")
    @ApiModelProperty(value = "用户Id")
    private Integer userid;

    @Column(name = "`head_img`")
    @ApiModelProperty(value = "用户头像")
    private String headImg;

    @Column(name = "`nick_name`")
    @ApiModelProperty(value = "用户昵称")
    private String nickname;

    @Column(name = "`telphone`")
    @ApiModelProperty(value = "用户电话")
    private String telphone;

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

    @Transient
    private Integer expDay;

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