| | |
| | | package com.yeshi.fanli.service.impl.tlj;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.tlj.ConfigTaoLiJinMapper;
|
| | | import com.yeshi.fanli.entity.bus.tlj.ConfigTaoLiJin;
|
| | | import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
|
| | |
|
| | | @Service
|
| | | public class ConfigTaoLiJinServiceImpl implements ConfigTaoLiJinService{
|
| | |
|
| | | @Resource
|
| | | private ConfigTaoLiJinMapper configTaoLiJinMapper;
|
| | |
|
| | | @Override
|
| | | public ConfigTaoLiJin getByKey(String key) {
|
| | | return configTaoLiJinMapper.getByKey(key);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | @Cacheable(value = "config", key = "'getValueByKey-' + #key")
|
| | | public String getValueByKey(String key) {
|
| | | ConfigTaoLiJin config = configTaoLiJinMapper.getByKey(key);
|
| | | if(config != null) {
|
| | | return config.getValue();
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | |
| | | |
| | | }
|
| | | package com.yeshi.fanli.service.impl.tlj; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.yeshi.fanli.dao.mybatis.tlj.ConfigTaoLiJinMapper; |
| | | import com.yeshi.fanli.entity.bus.tlj.ConfigTaoLiJin; |
| | | import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService; |
| | | |
| | | @Service |
| | | public class ConfigTaoLiJinServiceImpl implements ConfigTaoLiJinService { |
| | | |
| | | @Resource |
| | | private ConfigTaoLiJinMapper configTaoLiJinMapper; |
| | | |
| | | @Override |
| | | public ConfigTaoLiJin getByKey(String key) { |
| | | return configTaoLiJinMapper.getByKey(key, new Date()); |
| | | } |
| | | |
| | | @Override |
| | | @Cacheable(value = "config", key = "'getValueByKey-' + #key") |
| | | public String getValueByKey(String key) { |
| | | ConfigTaoLiJin config = configTaoLiJinMapper.getByKey(key, new Date()); |
| | | if (config != null) { |
| | | return config.getValue(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public ConfigTaoLiJin getByKey(String key, Date date) { |
| | | if (date == null) |
| | | return getByKey(key); |
| | | return configTaoLiJinMapper.getByKey(key, date); |
| | | } |
| | | |
| | | @Override |
| | | public String getValueByKey(String key, Date date) { |
| | | if (date == null) |
| | | return getValueByKey(key); |
| | | ConfigTaoLiJin config = configTaoLiJinMapper.getByKey(key, date); |
| | | if (config != null) { |
| | | return config.getValue(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |