All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.quhaodian.web.data.common.InitConfig Maven / Gradle / Ivy

package com.quhaodian.web.data.common;

import com.quhaodian.web.data.entity.WebConfig;
import com.quhaodian.web.data.service.WebConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.persistence.Column;

/**
 * Author: XiaoBingBy
 * Email: [email protected]
 * Date: 2017/3/5
 * Time: 15:40
 * Describe: 网站配置初始化
 */
public class InitConfig {

    @Autowired
    private WebConfigService webConfigMapper;

    private static WebConfig webConfig;


    public void initWebConfig() {
        webConfig = webConfigMapper.findById(1L);
        if (webConfig==null){
            webConfig=new WebConfig();
            webConfig.setTheme("default");
            webConfigMapper.save(webConfig);
        }
    }

    public static WebConfig getWebConfig() {
        if (webConfig==null){
            webConfig=new WebConfig();
            webConfig.setTheme("default");
        }
        return webConfig;
    }

    public static void setWebConfig(WebConfig webConfig) {
        InitConfig.webConfig = webConfig;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy