admin
2020-05-20 98b1a0affd69bbe63223c21fdd2c404e8bedfccb
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.yeshi.fanli.service.impl.taobao;
 
import java.util.List;
 
import javax.annotation.Resource;
 
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
 
import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoUnionConfigMapper;
import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
 
@Service
public class TaoBaoUnionConfigServiceImpl implements TaoBaoUnionConfigService {
 
    @Resource
    private TaoBaoUnionConfigMapper taoBaoUnionConfigMapper;
 
    @Override
    public List<TaoBaoUnionConfig> getConfigByType(int type) {
        return taoBaoUnionConfigMapper.selectByType(type);
    }
 
    @Cacheable(value = "configCache", key = "'getConfigByType-'+#type")
    @Override
    public List<TaoBaoUnionConfig> getConfigByTypeCache(int type) {
        return getConfigByType(type);
    }
 
    @Override
    public void addConfig(TaoBaoUnionConfig config) {
        TaoBaoUnionConfig oldConfig = getConfigByAppId(config.getAppId());
        if (oldConfig == null) {
            taoBaoUnionConfigMapper.insertSelective(config);
        }
    }
 
    @Override
    public TaoBaoUnionConfig getConfigByAppId(String appId) {
        return taoBaoUnionConfigMapper.selectByAppId(appId);
    }
 
    @Cacheable(value = "configCache", key = "'getConfigByAppId-'+#appId")
    @Override
    public TaoBaoUnionConfig getConfigByAppIdCache(String appId) {
        return getConfigByAppId(appId);
    }
 
    @Cacheable(value = "configCache", key = "'getConfigByAppKeyCache-'+#appKey")
    @Override
    public TaoBaoUnionConfig getConfigByAppKeyCache(String appKey) {
        return taoBaoUnionConfigMapper.selectByAppKey(appKey);
    }
 
}