package org.nl.acs.route.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.nl.acs.common.base.CommonModel;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

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

    @ApiModelProperty(value = "方案标识")
    @TableId(type= IdType.ASSIGN_ID)
    private String plan_uuid;

    @ApiModelProperty(value = "方案编码")
    @NotBlank
    private String plan_code;

    @ApiModelProperty(value = "方案名称")
    @NotBlank
    private String plan_name;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "是否启用")
    @NotBlank
    private String is_active;

    @ApiModelProperty(value = "是否删除")
    @NotBlank
    private String is_delete;

    @ApiModelProperty(value = "创建者")
    @NotBlank
    @TableField(fill= FieldFill.INSERT)
    private String create_by;

    @ApiModelProperty(value = "创建时间")
    @NotBlank
    @TableField(fill= FieldFill.INSERT)
    private String create_time;

    @ApiModelProperty(value = "修改者")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private String update_by;

    @ApiModelProperty(value = "修改时间")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private String update_time;

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