RuoYiConfig.java 2.5 KB

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