package com.fs.his.utils;

import com.alibaba.fastjson.JSON;
import com.fs.his.config.FsSysConfig;
import com.fs.system.domain.SysConfig;
import com.fs.system.mapper.SysConfigMapper;
import com.qcloud.cos.model.GetBucketLifecycleConfigurationRequest;
import com.qiniu.util.Json;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class ConfigUtil {
    FsSysConfig fsSysConfig;
    @Autowired
    SysConfigMapper sysConfigMapper;
    public FsSysConfig getSysConfig(){
        if (this.fsSysConfig==null){
            SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.config");
            String configValue = sysConfig.getConfigValue();
            FsSysConfig config = JSON.parseObject(configValue, FsSysConfig.class);
            this.fsSysConfig=config;
            return this.fsSysConfig;
        }else {
            return this.fsSysConfig ;
        }
    }
}
