mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-25 00:15:06 +08:00
【功能新增】INFRA:增加 ConfigApi,支持参数配置的读取
This commit is contained in:
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.infra.api.config;
|
||||
|
||||
/**
|
||||
* 参数配置 API 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface ConfigApi {
|
||||
|
||||
/**
|
||||
* 根据参数键查询参数值
|
||||
*
|
||||
* @param key 参数键
|
||||
* @return 参数值
|
||||
*/
|
||||
String getConfigValueByKey(String key);
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.infra.api.config;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
||||
import cn.iocoder.yudao.module.infra.service.config.ConfigService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* 参数配置 API 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ConfigApiImpl implements ConfigApi {
|
||||
|
||||
@Resource
|
||||
private ConfigService configService;
|
||||
|
||||
@Override
|
||||
public String getConfigValueByKey(String key) {
|
||||
ConfigDO config = configService.getConfigByKey(key);
|
||||
return config != null ? config.getValue() : null;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user