| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | @Service |
| | | public class SystemConfigServiceImpl implements SystemConfigService { |
| | |
| | | public SystemConfig getConfigByKeyCache(String key) { |
| | | return getConfigByKey(key); |
| | | } |
| | | |
| | | @Cacheable(value = "configCache", key = "'system-getConfigValueByKey'+'-'+#key") |
| | | @Override |
| | | public String getConfigValueByKeyCache(String key) { |
| | | SystemConfig config = getConfigByKeyCache(key); |
| | | if (config == null) |
| | | return null; |
| | | return config.getValue(); |
| | | } |
| | | |
| | | @Override |
| | | public void setValue(String key, String value) { |
| | | SystemConfig config = getConfigByKeyCache(key); |
| | | if (config == null) |
| | | return; |
| | | config.setValue(value); |
| | | config.setUpdateTime(new Date()); |
| | | systemConfigDao.save(config); |
| | | |
| | | } |
| | | } |