RuoYiConfig.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 static String profile;
  21. /** 获取地址开关 */
  22. private static boolean addressEnabled;
  23. /** 验证码类型 */
  24. private static String captchaType;
  25. /** 上传路径 */
  26. private static String isYml;
  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 static String getProfile()
  52. {
  53. return profile;
  54. }
  55. public void setProfile(String profile)
  56. {
  57. RuoYiConfig.profile = profile;
  58. }
  59. public static boolean isAddressEnabled()
  60. {
  61. return addressEnabled;
  62. }
  63. public void setAddressEnabled(boolean addressEnabled)
  64. {
  65. RuoYiConfig.addressEnabled = addressEnabled;
  66. }
  67. public static String getCaptchaType() {
  68. return captchaType;
  69. }
  70. public void setCaptchaType(String captchaType) {
  71. RuoYiConfig.captchaType = captchaType;
  72. }
  73. public static String getIsYml() {
  74. return isYml;
  75. }
  76. public void setIsYml(String isYml) {
  77. RuoYiConfig.isYml = isYml;
  78. }
  79. /**
  80. * 获取导入上传路径
  81. */
  82. public static String getImportPath()
  83. {
  84. return getProfile() + "/import";
  85. }
  86. /**
  87. * 获取头像上传路径
  88. */
  89. public static String getAvatarPath()
  90. {
  91. return getProfile() + "/avatar";
  92. }
  93. /**
  94. * 获取下载路径
  95. */
  96. public static String getDownloadPath()
  97. {
  98. return getProfile() + "/download/";
  99. }
  100. /**
  101. * 获取上传路径
  102. */
  103. public static String getUploadPath()
  104. {
  105. return getProfile() + "/upload";
  106. }
  107. }