RuoYiConfig.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. package com.ruoyi.framework.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. private String requestJumpPath;
  26. public String getRequestJumpPath() {
  27. return requestJumpPath;
  28. }
  29. public void setRequestJumpPath(String requestJumpPath) {
  30. this.requestJumpPath = requestJumpPath;
  31. }
  32. public String getName()
  33. {
  34. return name;
  35. }
  36. public void setName(String name)
  37. {
  38. this.name = name;
  39. }
  40. public String getVersion()
  41. {
  42. return version;
  43. }
  44. public void setVersion(String version)
  45. {
  46. this.version = version;
  47. }
  48. public String getCopyrightYear()
  49. {
  50. return copyrightYear;
  51. }
  52. public void setCopyrightYear(String copyrightYear)
  53. {
  54. this.copyrightYear = copyrightYear;
  55. }
  56. public boolean isDemoEnabled()
  57. {
  58. return demoEnabled;
  59. }
  60. public void setDemoEnabled(boolean demoEnabled)
  61. {
  62. this.demoEnabled = demoEnabled;
  63. }
  64. public static String getProfile()
  65. {
  66. return profile;
  67. }
  68. public void setProfile(String profile)
  69. {
  70. RuoYiConfig.profile = profile;
  71. }
  72. public static boolean isAddressEnabled()
  73. {
  74. return addressEnabled;
  75. }
  76. public void setAddressEnabled(boolean addressEnabled)
  77. {
  78. RuoYiConfig.addressEnabled = addressEnabled;
  79. }
  80. /**
  81. * 获取头像上传路径
  82. */
  83. public static String getAvatarPath()
  84. {
  85. return getProfile() + "/avatar";
  86. }
  87. /**
  88. * 获取下载路径
  89. */
  90. public static String getDownloadPath()
  91. {
  92. return getProfile() + "/download/";
  93. }
  94. /**
  95. * 获取上传路径
  96. */
  97. public static String getUploadPath()
  98. {
  99. return getProfile() + "/upload";
  100. }
  101. /**
  102. * 获取上传路径
  103. */
  104. public static String getFilePath(String dir)
  105. {
  106. return getProfile() + dir;
  107. }
  108. }