125 lines
2.4 KiB
Java
Raw Normal View History

2018-10-07 14:16:47 +08:00
package com.ruoyi.common.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
2018-10-07 14:16:47 +08:00
/**
* 全局配置类
*
* @author ruoyi
*/
@Component
@ConfigurationProperties(prefix = "ruoyi")
public class RuoYiConfig
2018-10-07 14:16:47 +08:00
{
/** 项目名称 */
private static String name;
2018-10-07 14:16:47 +08:00
/** 版本 */
private static String version;
2018-10-07 14:16:47 +08:00
/** 版权年份 */
private static String copyrightYear;
2018-10-07 14:16:47 +08:00
/** 实例演示开关 */
private static boolean demoEnabled;
/** 上传路径 */
private static String profile;
2018-10-07 14:16:47 +08:00
/** 获取地址开关 */
private static boolean addressEnabled;
public static String getName()
2018-10-07 14:16:47 +08:00
{
return name;
2018-10-07 14:16:47 +08:00
}
public void setName(String name)
2018-10-07 14:16:47 +08:00
{
RuoYiConfig.name = name;
2018-10-07 14:16:47 +08:00
}
public static String getVersion()
2018-10-07 14:16:47 +08:00
{
return version;
2018-10-07 14:16:47 +08:00
}
public void setVersion(String version)
2018-10-07 14:16:47 +08:00
{
RuoYiConfig.version = version;
2018-10-07 14:16:47 +08:00
}
public static String getCopyrightYear()
2018-10-07 14:16:47 +08:00
{
return copyrightYear;
2018-10-07 14:16:47 +08:00
}
public void setCopyrightYear(String copyrightYear)
2018-10-07 14:16:47 +08:00
{
RuoYiConfig.copyrightYear = copyrightYear;
2019-06-03 09:19:57 +08:00
}
public static boolean isDemoEnabled()
2019-06-03 09:19:57 +08:00
{
return demoEnabled;
2018-10-07 14:16:47 +08:00
}
public void setDemoEnabled(boolean demoEnabled)
2018-10-07 14:16:47 +08:00
{
RuoYiConfig.demoEnabled = demoEnabled;
2018-10-07 14:16:47 +08:00
}
public static String getProfile()
{
return profile;
}
public void setProfile(String profile)
{
RuoYiConfig.profile = profile;
}
public static boolean isAddressEnabled()
{
return addressEnabled;
}
public void setAddressEnabled(boolean addressEnabled)
{
RuoYiConfig.addressEnabled = addressEnabled;
2018-10-07 14:16:47 +08:00
}
2021-08-11 09:35:05 +08:00
/**
* 获取导入上传路径
*/
public static String getImportPath()
{
return getProfile() + "/import";
}
2018-10-07 14:16:47 +08:00
/**
* 获取头像上传路径
*/
public static String getAvatarPath()
{
2019-07-17 09:28:15 +08:00
return getProfile() + "/avatar";
2018-10-07 14:16:47 +08:00
}
/**
2019-01-16 14:56:27 +08:00
* 获取下载路径
2018-10-07 14:16:47 +08:00
*/
public static String getDownloadPath()
{
2019-08-23 10:36:03 +08:00
return getProfile() + "/download/";
2018-10-07 14:16:47 +08:00
}
2019-01-16 14:56:27 +08:00
/**
* 获取上传路径
*/
public static String getUploadPath()
{
2019-07-17 09:28:15 +08:00
return getProfile() + "/upload";
2019-01-16 14:56:27 +08:00
}
2018-10-07 14:16:47 +08:00
}