提交 | 用户 | 时间
|
a6de49
|
1 |
package com.iailab.module.infra.api.config; |
H |
2 |
|
|
3 |
import com.iailab.framework.common.pojo.CommonResult; |
325d2f
|
4 |
import com.iailab.module.infra.dal.dataobject.config.ConfigDO; |
a6de49
|
5 |
import com.iailab.module.infra.service.config.ConfigService; |
4a47e4
|
6 |
import org.apache.commons.lang3.ObjectUtils; |
a6de49
|
7 |
import org.springframework.validation.annotation.Validated; |
H |
8 |
import org.springframework.web.bind.annotation.RestController; |
|
9 |
|
|
10 |
import javax.annotation.Resource; |
|
11 |
|
|
12 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
13 |
|
|
14 |
@RestController // 提供 RESTful API 接口,给 Feign 调用 |
|
15 |
@Validated |
|
16 |
public class ConfigApiImpl implements ConfigApi { |
|
17 |
|
|
18 |
@Resource |
|
19 |
private ConfigService configService; |
|
20 |
|
|
21 |
@Override |
4a47e4
|
22 |
public String queryConfigByCode(String configCode) { |
H |
23 |
ConfigDO configByKey = configService.getConfigByKey(configCode); |
|
24 |
return ObjectUtils.isNotEmpty(configByKey) ? configByKey.getValue() : ""; |
|
25 |
} |
|
26 |
|
|
27 |
@Override |
325d2f
|
28 |
public CommonResult<String> getConfigValueByKey(String key) { |
H |
29 |
ConfigDO config = configService.getConfigByKey(key); |
|
30 |
return success(config != null ? config.getValue() : null); |
a6de49
|
31 |
} |
H |
32 |
|
325d2f
|
33 |
|
a6de49
|
34 |
} |