package org.nl.acs.address.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 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-10
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("sys_interface_methods_address")
public class Address extends CommonModel<Address> implements Serializable {
    private static final long serialVersionUID = 1L;

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

    @ApiModelProperty(value = "方法编码")
    @NotBlank
    private String methods_code;

    @ApiModelProperty(value = "方法名称")
    @NotBlank
    private String methods_name;

    @ApiModelProperty(value = "请求地址")
    @NotBlank
    private String methods_url;

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

    @ApiModelProperty(value = "创建人")
    @NotNull
    private Long create_id;

    @ApiModelProperty(value = "创建人姓名")
    @NotBlank
    private String create_name;

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

    @ApiModelProperty(value = "修改人")
    private Long update_optid;

    @ApiModelProperty(value = "修改人姓名")
    private String update_optname;

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

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

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