package com.fjhx.service.common;

import cn.hutool.core.convert.Convert;
import com.fjhx.base.StorageBaseService;
import com.fjhx.entity.common.CommonConfig;

import java.math.BigDecimal;

/**
 * <p>
 * 公共配置 服务类
 * </p>
 *
 * @author ${author}
 * @since 2022-08-05
 */
public interface CommonConfigService extends StorageBaseService<CommonConfig> {

    String getValue(String key);

    /**
     * int类型配置
     */
    default Integer getValueToInt(String key) {
        return Convert.toInt(getValue(key));
    }

    /**
     * BigDecimal类型配置
     */
    default BigDecimal getValueToBigDecimal(String key) {
        return Convert.toBigDecimal(getValue(key));
    }

    void updateValue(String key, String value);

}
