package org.nl.acs.device.domain;

import org.nl.acs.common.base.CommonModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.io.Serializable;

/**
* @author jiaolm
* @date 2023-05-09
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("acs_device_erpmapping")
public class DeviceErpmapping extends CommonModel<DeviceErpmapping> implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "设备标识")
    @TableId(type= IdType.ASSIGN_ID)
    private String device_id;

    @ApiModelProperty(value = "设备编码")
    @NotBlank
    private String device_code;

    @ApiModelProperty(value = "设备名字")
    @NotBlank
    private String device_name;

    @ApiModelProperty(value = "设备类型")
    @NotBlank
    private String device_type;

    @ApiModelProperty(value = "设备驱动类型")
    @NotBlank
    private String driver_code;

    @ApiModelProperty(value = "所属ERP设备")
    @NotBlank
    private String erp_code;

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