From d73687bc6115007145b4aab050e4e29ff87fd8ae Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 01 三月 2021 18:44:36 +0800 Subject: [PATCH] 布丸代码优化 --- src/main/java/com/yeshi/buwan/service/imp/SystemService.java | 94 ++++++++--------------------------------------- 1 files changed, 16 insertions(+), 78 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/service/imp/SystemService.java b/src/main/java/com/yeshi/buwan/service/imp/SystemService.java index 51cebf9..a3b4f09 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/SystemService.java +++ b/src/main/java/com/yeshi/buwan/service/imp/SystemService.java @@ -1,9 +1,11 @@ package com.yeshi.buwan.service.imp; -import java.util.List; - -import javax.annotation.Resource; - +import com.yeshi.buwan.dao.DetailSystemDao; +import com.yeshi.buwan.dao.SystemInfoDao; +import com.yeshi.buwan.domain.*; +import com.yeshi.buwan.domain.special.Special; +import com.yeshi.buwan.domain.special.SuperSpecial; +import com.yeshi.buwan.util.Constant; import org.apache.log4j.Logger; import org.hibernate.HibernateException; import org.hibernate.Session; @@ -11,32 +13,8 @@ import org.springframework.orm.hibernate4.HibernateCallback; import org.springframework.stereotype.Service; -import com.yeshi.buwan.dao.DetailSystemDao; -import com.yeshi.buwan.dao.SystemInfoDao; -import com.yeshi.buwan.domain.DetailSystem; -import com.yeshi.buwan.domain.HomeAd; -import com.yeshi.buwan.domain.HomeType; -import com.yeshi.buwan.domain.HotSearch; -import com.yeshi.buwan.domain.HotStar; -import com.yeshi.buwan.domain.HotVideoType; -import com.yeshi.buwan.domain.ShareContent; -import com.yeshi.buwan.domain.SuperHomeAd; -import com.yeshi.buwan.domain.SuperHomeNotice; -import com.yeshi.buwan.domain.SuperHomeType; -import com.yeshi.buwan.domain.SuperHotSearch; -import com.yeshi.buwan.domain.SuperHotStar; -import com.yeshi.buwan.domain.SuperHotType; -import com.yeshi.buwan.domain.SuperRecommendAd; -import com.yeshi.buwan.domain.SuperUserBanner; -import com.yeshi.buwan.domain.SuperVideoType; -import com.yeshi.buwan.domain.SystemInfo; -import com.yeshi.buwan.domain.UserBanner; -import com.yeshi.buwan.domain.VideoBanQuan; -import com.yeshi.buwan.domain.VideoBanQuanVideo; -import com.yeshi.buwan.domain.VideoType; -import com.yeshi.buwan.domain.special.Special; -import com.yeshi.buwan.domain.special.SuperSpecial; -import com.yeshi.buwan.util.Constant; +import javax.annotation.Resource; +import java.util.List; /** * 绯荤粺鍒嗙被鏈嶅姟 @@ -58,61 +36,21 @@ @Resource private SpecialService specialService; - public ClassService getClassService() { - return classService; - } - - public void setClassService(ClassService classService) { - this.classService = classService; - } - - public StarService getStarService() { - return starService; - } - - public void setStarService(StarService starService) { - this.starService = starService; - } - - public SpecialService getSpecialService() { - return specialService; - } - - public void setSpecialService(SpecialService specialService) { - this.specialService = specialService; - } - - public SystemInfoDao getSystemInfoDao() { - return systemInfoDao; - } - - public void setSystemInfoDao(SystemInfoDao systemInfoDao) { - this.systemInfoDao = systemInfoDao; - } - - public DetailSystemDao getDetailSystemDao() { - return detailSystemDao; - } - - public void setDetailSystemDao(DetailSystemDao detailSystemDao) { - this.detailSystemDao = detailSystemDao; - } - - public List<DetailSystem> getDetailSystemList() { - List<DetailSystem> list = detailSystemDao.list("from DetailSystem"); + public List<DetailSystem> getDetailSystemList(String systemId) { + List<DetailSystem> list = detailSystemDao.list("from DetailSystem ds where ds.system.id=?", systemId); return list; } - public List<DetailSystem> getDetailSystemList(String key, int pageIndex) { + public List<DetailSystem> getDetailSystemList(String key, String systemId, int pageIndex) { List<DetailSystem> list = detailSystemDao.list( - "from DetailSystem ds where ds.appName like ? order by ds.createtime desc", - (pageIndex - 1) * Constant.pageCount, Constant.pageCount, new String[]{"%" + key + "%"}); + "from DetailSystem ds where ds.appName like ? and ds.system.id=? order by ds.createtime desc", + (pageIndex - 1) * Constant.pageCount, Constant.pageCount, new String[]{"%" + key + "%", systemId}); return list; } - public long getDetailSystemListCount(String key) { - return detailSystemDao.getCount("select count(*) from DetailSystem d where d.appName like ?", - new String[]{"%" + key + "%"}); + public long getDetailSystemListCount(String key, String systemId) { + return detailSystemDao.getCount("select count(*) from DetailSystem d where d.appName like ? and d.system.id=?", + new String[]{"%" + key + "%", systemId}); } @Cacheable(value = "homeCache", key = "'getDetailSystemByPackage'+'-'+#packageName") -- Gitblit v1.8.0