package easydo.technology.system.domain;

import com.baomidou.mybatisplus.annotation.*;
import easydo.technology.system.dto.DictSmallDto;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @author jinjin
 * @date 2020-09-24
 */
@Data
@TableName("sys_dict_detail")
public class DictDetail implements Serializable {

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

    @NotNull
    private Long dictId;

    @NotNull
    @TableField(exist = false)
    private DictSmallDto dict;

    @NotBlank
    private String label;

    @NotBlank
    private String value;

    private Integer dictSort;

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

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

    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    public void copyFrom(DictDetail source) {
        BeanUtils.copyProperties(source, this);
    }
}
