/*
*  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 me.zhengjie.modules.dm.daypc.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseEntity;
import me.zhengjie.modules.dm.food.domain.DmFood;
import me.zhengjie.modules.dm.foodCate.domain.DmFoodCate;
import me.zhengjie.modules.dm.rfidTableware.domain.DmRfidTableware;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;

/**
* @website https://el-admin.vip
* @description /
* @author sunmz
* @date 2021-09-22
**/
@Entity
@Data
@Table(name="dm_day_pc")
public class DmDayPc implements Serializable {

    @Id
    @Column(name = "pcid")
    @ApiModelProperty(value = "pcid")
    private Long id;

//    @OneToOne
    @Column(name = "pid")
    @ApiModelProperty(value = "菜品id")
//    private DmFood food;
    private Long pid;

//    @OneToOne
    @Column(name = "id")//,referencedColumnName = "id"
    @ApiModelProperty(value = "餐盘id")
//    private DmRfidTableware rfidTableware;
    private Long cpid;

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

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

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

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

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

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

    @Column(name = "price")
    @ApiModelProperty(value = "价格")
    private BigDecimal price;

    @Column(name = "times")
    @ApiModelProperty(value = "餐别")
    private String times;

    @Column(name = "qty_book")
    @ApiModelProperty(value = "餐别")
    private String qtyBook;

    @OneToOne
    @JoinColumn(name = "cate",referencedColumnName = "cate_id")
    @ApiModelProperty(value = "菜品分类id")
    private DmFoodCate cate;

    @Column(name = "cate_name")
    @ApiModelProperty(value = "菜品分类名称")
    private String cateName;

    @Column(name = "window")
    @ApiModelProperty(value = "档口id")
    private Integer window;

    @Column(name = "window_name")
    @ApiModelProperty(value = "档口名称")
    private String windowName;

    @Column(name = "pstate")
    @ApiModelProperty(value = "菜品状态")
    private Integer pstate;

    @Column(name = "seq")
    @ApiModelProperty(value = "流水号")
    private Long seq;

    @Column(name = "date")
    @ApiModelProperty(value = "日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    private Timestamp date;

    @Column(name = "shopname")
    @ApiModelProperty(value = "餐厅名称")
    private String shopname;

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