package com.fzm.mall.server.admin.system.model;

import com.baomidou.mybatisplus.annotation.*;
import com.fzm.mall.server.admin.util.UUIDUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * <p>
 * 系统配置表
 * </p>
 *
 * @author wulixian
 * @since 2021-03-29
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "SysConfig对象", description = "系统配置表")
@TableName("sys_config")
public class SysConfig implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 默认所属模块
     */
    private static final Integer DEFAULT_TYPE = 1;

    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "配置编号")
    private String configId;

    @ApiModelProperty(value = "key")
    private String dictKey;

    @ApiModelProperty(value = "值")
    private String dictValue;

    @ApiModelProperty(value = "配置所属模块（暂时没意义）")
    private Integer type;

    @ApiModelProperty(value = "备注说明")
    private String comm;

    @ApiModelProperty(value = "是否删除(0--否 1--是 )")
    private Integer status;

    @ApiModelProperty(value = "是否可用(0--否 1--是 )")
    private Integer validState;

    @ApiModelProperty(value = "信息入库时间")
    @TableField(fill = FieldFill.INSERT)
    private Long createTime;

    @ApiModelProperty(value = "信息修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateTime;

    /**
     * 初始化
     */
    public void init() {
        setConfigId(UUIDUtil.getUUID());
        setStatus(0);
        setValidState(1);
        setType(DEFAULT_TYPE);
    }
}
