| | |
| | | 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);
|
| | | }
|
| | |
|
| | | }
|
| | | 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); |
| | | } |
| | | |
| | | } |