package com.ruoyi.common.utils; import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.spring.SpringUtils; import java.util.Map; /** * @Description: 配置工具类 * @ClassName: ConfigUtils * @Author: 刘苏义 * @Date: 2023年08月23日16:12:09 * @Version: 1.0 **/ public class ConfigUtils { /** * 根据配置key获取配置value值 * * @return configValue 配置value值 */ public static String getConfigValue(String key) { String configValue = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key)); if (StringUtils.isNotNull(configValue)) { return configValue; } return null; } /** * 获取所有配置信息 * * @return configMap 配置信息map */ public static Map getConfigMap() { Map configMap = SpringUtils.getBean(RedisCache.class).getMapKey(CacheConstants.SYS_CONFIG_KEY); if (StringUtils.isNotNull(configMap)) { return configMap; } return null; } /** * 设置cache key * * @param configKey 参数键 * @return 缓存键key */ public static String getCacheKey(String configKey) { return CacheConstants.SYS_CONFIG_KEY + configKey; } }