package cn.pluss.platform.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 划拨详情表
 * </p>
 *
 * @author crystal
 * @since 2022-03-31
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_pluss_device_transfer_detail")
@NoArgsConstructor
public class DeviceTransferDetail implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;


    /**
     * 划拨信息表ID
     */
    @TableField("tid")
    private Long tid;


    /**
     * 设备SN号
     */
    @TableField("deviceNo")
    private String deviceNo;


    /**
     * 创建时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "createTime", fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 创建时间 开始时间
     */
    @TableField(exist = false, condition = "createTime &gt; #{%s}")
    private Date createTimeStart;

    /**
     * 创建时间 截止时间
     */
    @TableField(exist = false, condition = "createTime &lt; #{%s}")
    private Date createTimeEnd;

    /**
     * 划拨批次号
     */
    @TableField("batchNo")
    private String batchNo;


    public DeviceTransferDetail(DeviceTransfer transfer, String deviceNo) {
        this.tid = transfer.getId();
        this.batchNo = transfer.getBatchNo();
        this.deviceNo = deviceNo;
    }
}