RuoYiConfig.java 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. package com.ruoyi.common.config;
  2. import org.springframework.boot.context.properties.ConfigurationProperties;
  3. import org.springframework.stereotype.Component;
  4. /**
  5. * 读取项目相关配置
  6. *
  7. * @author ruoyi
  8. */
  9. @Component
  10. @ConfigurationProperties(prefix = "ruoyi")
  11. public class RuoYiConfig
  12. {
  13. /** 项目名称 */
  14. private String name;
  15. /** 版本 */
  16. private String version;
  17. /** 版权年份 */
  18. private String copyrightYear;
  19. /** 实例演示开关 */
  20. private boolean demoEnabled;
  21. /** 上传路径 */
  22. private static String profile;
  23. /** 获取地址开关 */
  24. private static boolean addressEnabled;
  25. /** 验证码类型 */
  26. private static String captchaType;
  27. public String getName()
  28. {
  29. return name;
  30. }
  31. public void setName(String name)
  32. {
  33. this.name = name;
  34. }
  35. public String getVersion()
  36. {
  37. return version;
  38. }
  39. public void setVersion(String version)
  40. {
  41. this.version = version;
  42. }
  43. public String getCopyrightYear()
  44. {
  45. return copyrightYear;
  46. }
  47. public void setCopyrightYear(String copyrightYear)
  48. {
  49. this.copyrightYear = copyrightYear;
  50. }
  51. public boolean isDemoEnabled()
  52. {
  53. return demoEnabled;
  54. }
  55. public void setDemoEnabled(boolean demoEnabled)
  56. {
  57. this.demoEnabled = demoEnabled;
  58. }
  59. public static String getProfile()
  60. {
  61. return profile;
  62. }
  63. public void setProfile(String profile)
  64. {
  65. RuoYiConfig.profile = profile;
  66. }
  67. public static boolean isAddressEnabled()
  68. {
  69. return addressEnabled;
  70. }
  71. public void setAddressEnabled(boolean addressEnabled)
  72. {
  73. RuoYiConfig.addressEnabled = addressEnabled;
  74. }
  75. public static String getCaptchaType() {
  76. return captchaType;
  77. }
  78. public void setCaptchaType(String captchaType) {
  79. RuoYiConfig.captchaType = captchaType;
  80. }
  81. /**
  82. * 获取导入上传路径
  83. */
  84. public static String getImportPath()
  85. {
  86. return getProfile() + "/import";
  87. }
  88. /**
  89. * 获取头像上传路径
  90. */
  91. public static String getAvatarPath()
  92. {
  93. return getProfile() + "/avatar";
  94. }
  95. /**
  96. * 获取下载路径
  97. */
  98. public static String getDownloadPath()
  99. {
  100. return getProfile() + "/download/";
  101. }
  102. /**
  103. * 获取上传路径
  104. */
  105. public static String getUploadPath()
  106. {
  107. return getProfile() + "/upload";
  108. }
  109. }