diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/cache/ParamCache.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/cache/ParamCache.java
new file mode 100644
index 00000000..5806c011
--- /dev/null
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/cache/ParamCache.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.system.cache;
+
+import org.springblade.core.cache.utils.CacheUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.SpringUtil;
+import org.springblade.system.entity.Param;
+import org.springblade.system.feign.ISysClient;
+
+import static org.springblade.core.cache.constant.CacheConstant.PARAM_CACHE;
+
+/**
+ * 参数缓存工具类
+ *
+ * @author Chill
+ */
+public class ParamCache {
+
+ private static final String PARAM_ID = "param:id:";
+ private static final String PARAM_VALUE = "param:value:";
+
+ private static ISysClient sysClient;
+
+ private static ISysClient getSysClient() {
+ if (sysClient == null) {
+ sysClient = SpringUtil.getBean(ISysClient.class);
+ }
+ return sysClient;
+ }
+
+ /**
+ * 获取参数实体
+ *
+ * @param id 主键
+ * @return Param
+ */
+ public static Param getById(Long id) {
+ return CacheUtil.get(PARAM_CACHE, PARAM_ID, id, () -> {
+ R result = getSysClient().getParam(id);
+ return result.getData();
+ });
+ }
+
+ /**
+ * 获取参数配置
+ *
+ * @param paramKey 参数值
+ * @return String
+ */
+ public static String getValue(String paramKey) {
+ return CacheUtil.get(PARAM_CACHE, PARAM_VALUE, paramKey, () -> {
+ R result = getSysClient().getParamValue(paramKey);
+ return result.getData();
+ });
+ }
+
+}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java
index d5cd5aea..76bf0f8a 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java
@@ -18,10 +18,7 @@ package org.springblade.system.feign;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.tool.api.R;
-import org.springblade.system.entity.Dept;
-import org.springblade.system.entity.Menu;
-import org.springblade.system.entity.Role;
-import org.springblade.system.entity.Tenant;
+import org.springblade.system.entity.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -51,6 +48,8 @@ public interface ISysClient {
String ROLE_ALIAS = API_PREFIX + "/role-alias";
String ROLE_ALIASES = API_PREFIX + "/role-aliases";
String TENANT = API_PREFIX + "/tenant";
+ String PARAM = API_PREFIX + "/param";
+ String PARAM_VALUE = API_PREFIX + "/param-value";
/**
* 获取菜单
@@ -146,9 +145,27 @@ public interface ISysClient {
* 获取租户
*
* @param id 主键
- * @return Tenant>
+ * @return Tenant
*/
@GetMapping(TENANT)
R getTenant(@RequestParam("id") Long id);
+ /**
+ * 获取参数
+ *
+ * @param id 主键
+ * @return Param
+ */
+ @GetMapping(PARAM)
+ R getParam(@RequestParam("id") Long id);
+
+ /**
+ * 获取参数配置
+ *
+ * @param paramKey 参数key
+ * @return String
+ */
+ @GetMapping(PARAM_VALUE)
+ R getParamValue(@RequestParam("paramKey") String paramKey);
+
}
diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClientFallback.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClientFallback.java
index 357de13d..8a117f73 100644
--- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClientFallback.java
+++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClientFallback.java
@@ -17,10 +17,7 @@
package org.springblade.system.feign;
import org.springblade.core.tool.api.R;
-import org.springblade.system.entity.Dept;
-import org.springblade.system.entity.Menu;
-import org.springblade.system.entity.Role;
-import org.springblade.system.entity.Tenant;
+import org.springblade.system.entity.*;
import org.springframework.stereotype.Component;
import java.util.List;
@@ -87,4 +84,14 @@ public class ISysClientFallback implements ISysClient {
public R getTenant(Long id) {
return R.fail("获取数据失败");
}
+
+ @Override
+ public R getParam(Long id) {
+ return R.fail("获取数据失败");
+ }
+
+ @Override
+ public R getParamValue(Long paramKey) {
+ return R.fail("获取数据失败");
+ }
}
diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/feign/SysClient.java b/blade-service/blade-system/src/main/java/org/springblade/system/feign/SysClient.java
index b7f703b6..cc20896d 100644
--- a/blade-service/blade-system/src/main/java/org/springblade/system/feign/SysClient.java
+++ b/blade-service/blade-system/src/main/java/org/springblade/system/feign/SysClient.java
@@ -16,17 +16,10 @@
*/
package org.springblade.system.feign;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
-import org.springblade.system.entity.Dept;
-import org.springblade.system.entity.Menu;
-import org.springblade.system.entity.Role;
-import org.springblade.system.entity.Tenant;
-import org.springblade.system.service.IDeptService;
-import org.springblade.system.service.IMenuService;
-import org.springblade.system.service.IRoleService;
-import org.springblade.system.service.ITenantService;
+import org.springblade.system.entity.*;
+import org.springblade.system.service.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
@@ -51,6 +44,8 @@ public class SysClient implements ISysClient {
private ITenantService tenantService;
+ private IParamService paramService;
+
@Override
@GetMapping(MENU)
public R