package com.storlead.system.pojo.dto;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.storlead.system.pojo.entity.NoteTagLibraryEntity;
import com.storlead.system.pojo.entity.SystemConfigItemEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.extern.log4j.Log4j2;

/**
 * @program: sp-sales-gotr
 * @description:
 * @author: chenkq
 * @create: 2023-07-26 15:14
 */
@Data
@Log4j2
public class SystemConfigItemDTO {

    @ApiModelProperty("配置项id")
    private Long itemId;

    @ApiModelProperty("配置项名称")
    private String itemName;

    @ApiModelProperty("配置默认值或校验规则")
    private String itemFormatValue;

    @ApiModelProperty(value = "是否启用(1:启用 0:禁用)")
    private Boolean enabled;

    public static SystemConfigItemEntity convertConfigItemEntity(SystemConfigItemDTO source) {

        try {
            if (null == source) {
                return null;
            }
            SystemConfigItemEntity target = new SystemConfigItemEntity();
            target.setItemId(source.getItemId());
            target.setItemName(source.getItemName());
            target.setItemFormatValue(source.getItemFormatValue());
            return target;
        }catch (Exception e) {
            log.error("convertConfigItemEntity -- error",e);
            return null;
        }
    }
}
