From 010ef2a907e66efd4702443c06cdd18f8a7ffa5b Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 30 十月 2024 14:08:53 +0800 Subject: [PATCH] IP归属地查询接口集成 --- src/main/java/com/yeshi/buwan/service/imp/DetailSystemConfigService.java | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/service/imp/DetailSystemConfigService.java b/src/main/java/com/yeshi/buwan/service/imp/DetailSystemConfigService.java index 8065df3..e8caf3d 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/DetailSystemConfigService.java +++ b/src/main/java/com/yeshi/buwan/service/imp/DetailSystemConfigService.java @@ -24,6 +24,22 @@ return configDao.listBySystemIdAndMaxVersion(systemId, version); } + public DetailSystemConfig getConfig(int id) { + return configDao.find(DetailSystemConfig.class, id); + } + + public void saveConfig(DetailSystemConfig config) { + configDao.save(config); + } + + public List<DetailSystemConfig> listConfig(Long systemId, String key) { + return configDao.list(systemId, key); + } + + public List<DetailSystemConfig> listConfigByValue(Long systemId, String value) { + return configDao.listByValue(systemId, value); + } + @Cacheable(value = "configCache", key = "'getConfigAsMap-'+#system.id+'-'+#version") public Map<String, String> getConfigAsMap(DetailSystem system, int version) { Map<String, String> map = new HashMap<String, String>(); @@ -38,6 +54,14 @@ return configDao.selectByKey(key, Long.parseLong(system.getId()), version); } + @Cacheable(value = "configCache", key = "'getConfigValueByKey-'+#key+'-'+#detailSystemId+'-'+#version") + public String getConfigValueByKey(String key, String detailSystemId, int version) { + DetailSystemConfig detailSystemConfig = configDao.selectByKey(key, Long.parseLong(detailSystemId), version); + if (detailSystemConfig == null) + return null; + return detailSystemConfig.getValue(); + } + // 鏇存柊鏌愪釜閰嶇疆鏂囦欢 public void updateConfig(final DetailSystemConfig cg) { configDao.excute(new HibernateCallback() { -- Gitblit v1.8.0