package com.thinkgem.jeesite.common.config;

import java.util.Map;

import org.springframework.util.Assert;

import com.google.common.collect.Maps;
import com.thinkgem.jeesite.common.utils.PropertiesLoader;

/**
 * 全局配置类
 * @author Thinkgem
 *
 */
public class Global {
	/**
	 * 保存全局属性的值
	 */
	private static Map<String,String> map = Maps.newHashMap();
	/**
	 * 属性文件加载对象
	 */
	private static PropertiesLoader propertiesLoader = new PropertiesLoader("jeesite.properties");
	/**
	 * 获取配置
	 */
	public static String getConfig(String key){
		String value = map.get(key);
		if(value ==  null){
			value = propertiesLoader.getProperty(key);
			map.put(key, value);
		}
		return value;
	}

	/**
	 * 获取管理端根路径
	 */
	public static String getAdminPath(){
		return getConfig("adminPath");
	}
	/**
	 * 获取前端根路径
	 */
	public static String getFrontPath(){
		return getConfig("frontPath");
	}
	/**
	 * 获取URL后缀
	 */
	public static String getUrlSuffix(){
		return getConfig("urlSuffix");
	}
	/**
	 * 判断是否是演示模式,演示模式下不能修改用户、角色、密码、菜单、授权
	 */
	public static Boolean isDemoMode(){
		String dm = getConfig("demoMode");;
		return "true".endsWith(dm) || "1".equals(dm);
	}
	/**
	 * 获取CKFinder上传文件的根目录
	 */
	
	public static String getCkBaseDir(){
		String dir = getConfig("userfiles.basedir");
		Assert.hasText(dir,"配置文件里没有配置userfiles.basedir属性");
		if(!dir.endsWith("/")){
			dir += "/";
		}
		return dir;
	}

}
最近下载更多
heng356  LV1 2月11日
zshldehao1  LV2 2月5日
zwjxxyxqf  LV1 2024年11月1日
colecole  LV3 2024年10月8日
HTML-WEB  LV1 2024年5月22日
educationAAA  LV11 2024年5月3日
2860615178  LV4 2024年5月1日
managment  LV3 2024年4月17日
vluobo  LV1 2024年3月19日
formatself1  LV2 2024年1月28日
最近浏览更多
missliu  LV8 前天
哪里的完整版  LV8 4月1日
GakkiMarryMe  LV9 3月25日
akittyboy  LV9 2月24日
heng356  LV1 2月11日
林kkkkkk  LV6 2月10日
zshldehao1  LV2 2月5日
sureivv  LV2 1月9日
微信网友_7290593889931264 2024年12月10日
暂无贡献等级
sjwc88  LV3 2024年12月4日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友