RuoYiConfig.java 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. package com.emato.common.config;
  2. import org.springframework.boot.context.properties.ConfigurationProperties;
  3. import org.springframework.stereotype.Component;
  4. /**
  5. * 读取项目相关配置
  6. *
  7. * @author cadmin
  8. */
  9. @Component
  10. @ConfigurationProperties(prefix = "cadmin")
  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. 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 boolean isDemoEnabled()
  50. {
  51. return demoEnabled;
  52. }
  53. public void setDemoEnabled(boolean demoEnabled)
  54. {
  55. this.demoEnabled = demoEnabled;
  56. }
  57. public static String getProfile()
  58. {
  59. return profile;
  60. }
  61. public void setProfile(String profile)
  62. {
  63. RuoYiConfig.profile = profile;
  64. }
  65. public static boolean isAddressEnabled()
  66. {
  67. return addressEnabled;
  68. }
  69. public void setAddressEnabled(boolean addressEnabled)
  70. {
  71. RuoYiConfig.addressEnabled = addressEnabled;
  72. }
  73. /**
  74. * 获取头像上传路径
  75. */
  76. public static String getAvatarPath()
  77. {
  78. return getProfile() + "/avatar";
  79. }
  80. /**
  81. * 获取下载路径
  82. */
  83. public static String getDownloadPath()
  84. {
  85. return getProfile() + "/download/";
  86. }
  87. /**
  88. * 获取上传路径
  89. */
  90. public static String getUploadPath()
  91. {
  92. return getProfile() + "/upload";
  93. }
  94. }