From f7b2baec57a19039ca85880bbba4e17fe27f0511 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 10 三月 2021 18:21:13 +0800 Subject: [PATCH] 删除冗余代码,初步优化首页的推荐专题,3.8.7之后在我的里面添加VIP分类 --- src/main/java/com/yeshi/buwan/service/imp/DetailSystemConfigService.java | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/service/imp/ConfigService.java b/src/main/java/com/yeshi/buwan/service/imp/DetailSystemConfigService.java similarity index 75% rename from src/main/java/com/yeshi/buwan/service/imp/ConfigService.java rename to src/main/java/com/yeshi/buwan/service/imp/DetailSystemConfigService.java index e62bbf0..8065df3 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/ConfigService.java +++ b/src/main/java/com/yeshi/buwan/service/imp/DetailSystemConfigService.java @@ -1,8 +1,8 @@ package com.yeshi.buwan.service.imp; -import com.yeshi.buwan.dao.ConfigDao; -import com.yeshi.buwan.domain.Config; -import com.yeshi.buwan.domain.DetailSystem; +import com.yeshi.buwan.dao.system.DetailSystemConfigDao; +import com.yeshi.buwan.domain.system.DetailSystemConfig; +import com.yeshi.buwan.domain.system.DetailSystem; import org.hibernate.HibernateException; import org.hibernate.Session; import org.springframework.cache.annotation.Cacheable; @@ -15,31 +15,31 @@ import java.util.Map; @Service -public class ConfigService { +public class DetailSystemConfigService { @Resource - private ConfigDao configDao; + private DetailSystemConfigDao configDao; // 鑾峰彇閰嶇疆鏂囦欢 - public List<Config> getConfig(Long systemId, int version) { + public List<DetailSystemConfig> getConfig(Long systemId, int version) { return configDao.listBySystemIdAndMaxVersion(systemId, version); } @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>(); - List<Config> list = getConfig(Long.parseLong(system.getId()), version); - for (Config cg : list) { + List<DetailSystemConfig> list = getConfig(Long.parseLong(system.getId()), version); + for (DetailSystemConfig cg : list) { map.put(cg.getKey(), cg.getValue()); } return map; } - public Config getConfigByKey(String key, DetailSystem system, int version) { + public DetailSystemConfig getConfigByKey(String key, DetailSystem system, int version) { return configDao.selectByKey(key, Long.parseLong(system.getId()), version); } // 鏇存柊鏌愪釜閰嶇疆鏂囦欢 - public void updateConfig(final Config cg) { + public void updateConfig(final DetailSystemConfig cg) { configDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { @@ -56,12 +56,12 @@ }); } - public boolean updateConfigList(final List<Config> cgs) { + public boolean updateConfigList(final List<DetailSystemConfig> cgs) { return (Boolean) configDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { session.getTransaction().begin(); - for (Config cg : cgs) { + for (DetailSystemConfig cg : cgs) { session.update(cg); } session.flush(); -- Gitblit v1.8.0