/*
*  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.dmVisitorsUser.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.dmVisitorsApply.domain.DmVisitorsApply;
import me.zhengjie.modules.system.domain.Dept;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.sql.Timestamp;

/**
* @website https://el-admin.vip
* @description /
* @author juan
* @date 2021-11-19
**/
@Entity
@Data
@Table(name="dm_visitors_user")
public class DmVisitorsUser implements Serializable {

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

    @Column(name = "visitor_name")
    @ApiModelProperty(value = "访客姓名")
    private String visitorName;

    @Column(name = "visitor_phone")
    @ApiModelProperty(value = "访客电话")
    private String visitorPhone;

    @OneToOne
    @JoinColumn(name = "dept_id")
    @ApiModelProperty(value = "部门")
    private Dept dept;

    @Column(name = "plate_number")
    @ApiModelProperty(value = "车牌")
    private String plateNumber;

    @Column(name = "visitor_image")
    @ApiModelProperty(value = "访客照片")
    private String visitorImage;

    @Column(name = "visitor_identity_card")
    @ApiModelProperty(value = "访客身份证信息")
    private String visitorIdentityCard;

    @OneToOne
    @JoinColumn(name = "apply_id")
    @ApiModelProperty(value = "访客申请id")
    private DmVisitorsApply visitorsApply;

    @Column(name = "start_time")
    @ApiModelProperty(value = "到访开始时间")
    private Timestamp startTime;

    @Column(name = "end_time")
    @ApiModelProperty(value = "到访结束时间")
    private Timestamp endTime;

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