/*
*  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.dmPlateTraffic.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.modules.dm.dmCard.domain.DmCard;
import me.zhengjie.modules.dmuser.domain.DmUser;
import me.zhengjie.ykt.domain.DmPlateNumber;
import me.zhengjie.ykt.domain.DmRoomDevice;

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

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

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

    @OneToOne
    @JoinColumn(name = "user_number",referencedColumnName="id")
    @ApiModelProperty(value = "DM用户")
    private DmUser dmUser;

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

    @OneToOne
    @JoinColumn(name = "room_device")
    @ApiModelProperty(value = "设备编号")
    private DmRoomDevice roomDevice;

    @Column(name = "come_go_out")
    @ApiModelProperty(value = "出入(00-进入、01-离开)")
    private String comeGoOut;

    @Column(name = "build_address")
    @ApiModelProperty(value = "设备安装位置")
    private String buildAddress;

    @Column(name = "access_time")
    @ApiModelProperty(value = "通行时间")
    private Timestamp accessTime;

    @Column(name = "mthtype")
    @ApiModelProperty(value = "车辆类型")
    private String mthtype;

    @Column(name = "intime")
    @ApiModelProperty(value = "入场时间")
    private String intime;

    @Column(name = "outtime")
    @ApiModelProperty(value = "出场时间")
    private String outtime;

    @Column(name = "ingatename")
    @ApiModelProperty(value = "入场车道名称")
    private String ingatename;

    @Column(name = "outgatename")
    @ApiModelProperty(value = "出场车道名称")
    private String outgatename;

    @Column(name = "ysje")
    @ApiModelProperty(value = "应收金额")
    private String ysje;

    @Column(name = "sfje")
    @ApiModelProperty(value = "收费金额")
    private String sfje;

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