package org.nl.acs.opc.domain;

import org.nl.acs.common.base.CommonModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;

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_opc_plc")
public class OpcPlc extends CommonModel<OpcPlc> implements Serializable {
    private static final long serialVersionUID = 1L;

    
    @TableId(type = IdType.ASSIGN_ID)
    private String plc_id;

    
    @NotBlank
    private String plc_code;

    
    @NotBlank
    private String plc_name;

    
    private String plc_host;

    
    private String opc_server_id;

    
    private String remark;

    
    @NotBlank
    private String is_active;

    
    @NotBlank
    private String is_delete;

    
    @NotBlank
    @TableField(fill = FieldFill.INSERT)
    private String create_by;

    
    @NotBlank
    @TableField(fill = FieldFill.INSERT)
    private String create_time;

    
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String update_by;

    
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String update_time;

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