admin
2021-04-24 77e706cca33c97a4428879cc9a6f98aae085c142
src/main/java/com/yeshi/buwan/service/imp/system/SystemConfigServiceImpl.java
@@ -7,6 +7,7 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
@Service
public class SystemConfigServiceImpl implements SystemConfigService {
@@ -25,4 +26,24 @@
    public SystemConfig getConfigByKeyCache(String key) {
        return getConfigByKey(key);
    }
    @Cacheable(value = "configCache", key = "'system-getConfigValueByKey'+'-'+#key")
    @Override
    public String getConfigValueByKeyCache(String key) {
        SystemConfig config = getConfigByKeyCache(key);
        if (config == null)
            return null;
        return config.getValue();
    }
    @Override
    public void setValue(String key, String value) {
        SystemConfig config = getConfigByKeyCache(key);
        if (config == null)
            return;
        config.setValue(value);
        config.setUpdateTime(new Date());
        systemConfigDao.save(config);
    }
}