admin
2020-07-04 9d35ba657fa5e3add766405d76e3ff8c4dcd4ad4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.yeshi.fanli.service.impl.common;
 
import com.yeshi.fanli.dao.mybatis.common.CommonConfigMapper;
import com.yeshi.fanli.entity.config.CommonConfig;
import com.yeshi.fanli.service.inter.common.CommonConfigService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
 
@Service
public class CommonConfigServiceImpl implements CommonConfigService {
 
    @Resource
    private CommonConfigMapper commonConfigMapper;
 
    @Override
    public String getValue(String key) {
        CommonConfig config = commonConfigMapper.selectByKey(key);
        if (config == null)
            return null;
        return config.getValue();
    }
 
    @Cacheable(value = "config", key = "'Common-getValue-'+#key")
    @Override
    public String getValueCache(String key) {
        return getValue(key);
    }
}