From f67743e47f57dafc7031af44e2037c03e680a60c Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期一, 25 三月 2019 11:30:43 +0800
Subject: [PATCH] 清理无效引用

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/config/SystemClientParamsServiceImpl.java |   43 +++++++++++++++++++++++++------------------
 1 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/config/SystemClientParamsServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/config/SystemClientParamsServiceImpl.java
index ddf7664..29ab3ea 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/config/SystemClientParamsServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/config/SystemClientParamsServiceImpl.java
@@ -7,7 +7,6 @@
 
 import javax.annotation.Resource;
 
-import org.apache.commons.beanutils.PropertyUtils;
 import org.hibernate.HibernateException;
 import org.hibernate.Query;
 import org.hibernate.Session;
@@ -21,12 +20,12 @@
 import com.yeshi.fanli.dao.config.SystemSecondProblemDao;
 import com.yeshi.fanli.dao.mybatis.SystemClientParamsMapper;
 import com.yeshi.fanli.entity.admin.SystemClientParamsAdmin;
+import com.yeshi.fanli.entity.system.BusinessSystem;
 import com.yeshi.fanli.entity.system.CustomerContent;
 import com.yeshi.fanli.entity.system.CustomerName;
-import com.yeshi.fanli.entity.system.System;
 import com.yeshi.fanli.entity.system.SystemClientParams;
+import com.yeshi.fanli.service.inter.config.BusinessSystemService;
 import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
-import com.yeshi.fanli.service.inter.config.SystemService;
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.StringUtil;
 
@@ -43,7 +42,7 @@
 	private SystemHelpListDao systemHelpListDao;
 	
 	@Resource
-	private SystemService systemService;
+	private BusinessSystemService businessSystemService;
 	
 	@Resource
 	private SystemSecondProblemDao systemSecondProblemDao;
@@ -53,8 +52,15 @@
 		return systemClientParamsDao.list("from SystemClientParams scp where scp.system.id=?",
 				new Serializable[] { id });
 	}
+	
+	@Cacheable(value = "clientParamCache", key = "#id+'-'+#version")
+	public List<SystemClientParams> getSystemClientParamsBySystemId(long id,int version) {
 
-	public List<SystemClientParamsAdmin> getAdminList(System system, String key) {
+		return systemClientParamsDao.list("from SystemClientParams scp where scp.system.id=?",
+				new Serializable[] { id });
+	}
+
+	public List<SystemClientParamsAdmin> getAdminList(BusinessSystem system, String key) {
 		List<SystemClientParams> list;
 		List<SystemClientParamsAdmin> adminList = new ArrayList<SystemClientParamsAdmin>();
 		if (system == null) {
@@ -98,9 +104,9 @@
 	}
 
 	@Transactional
-	public void addSystemClientParamsList(SystemClientParams scp, List<System> list) throws Exception {
+	public void addSystemClientParamsList(SystemClientParams scp, List<BusinessSystem> list) throws Exception {
 		SystemClientParams nscp = null;
-		for (System system : list) {
+		for (BusinessSystem system : list) {
 			nscp = new SystemClientParams();
 			nscp.setKey(scp.getKey());
 			nscp.setName(scp.getName());
@@ -112,7 +118,7 @@
 	}
 
 	@Transactional
-	public void deleteSystemClientParams(final SystemClientParams scp, final System system) {
+	public void deleteSystemClientParams(final SystemClientParams scp, final BusinessSystem system) {
 		systemClientParamsDao.excute(new HibernateCallback() {
 			public Object doInHibernate(Session session) throws HibernateException {
 				Query query = session.createQuery(
@@ -126,7 +132,7 @@
 		});
 	}
 
-	public void addSystemClientParams(SystemClientParams scp, System system) {
+	public void addSystemClientParams(SystemClientParams scp, BusinessSystem system) {
 		scp.setSystem(system);
 		systemClientParamsDao.create(scp);
 	}
@@ -156,7 +162,7 @@
 				List<SystemClientParams> list = query.list();
 				SystemClientParamsAdmin scpa = new SystemClientParamsAdmin(scp);
 				for (SystemClientParams fscp : list) {
-					System system = fscp.getSystem();
+					BusinessSystem system = fscp.getSystem();
 					if (scpa.getSystemList().contains(system)) {
 						continue;
 					}
@@ -186,7 +192,7 @@
 	}
 
 	@Override
-	public SystemClientParams getSystemClientParamsBySystemAndKey(System system, String key) {
+	public SystemClientParams getSystemClientParamsBySystemAndKey(BusinessSystem system, String key) {
 		List<SystemClientParams> list = systemClientParamsDao.list(
 				"from SystemClientParams scp where scp.system.id=? and scp.key=?",
 				new Serializable[] { system.getId(), key });
@@ -313,12 +319,12 @@
 			
 			if (StringUtil.isNullOrEmpty(key)) {
 				list = systemClientParamsDao.list("from SystemClientParams scp where scp.system.id = ? ",
-						 new Serializable[] {systemId});
+						start, count, new Serializable[] {systemId});
 				
 			} else {
 				list = systemClientParamsDao.list(
 						"from SystemClientParams scp where scp.system.id = ? and (scp.name like ? or scp.key like ?)",
-						new Serializable[] {systemId, "%" + key + "%" ,"%" + key + "%"});
+						start, count, new Serializable[] {systemId, "%" + key + "%" ,"%" + key + "%"});
 			}
 		}
 		
@@ -332,21 +338,21 @@
 		if (systemId == null) {
 			
 			if (StringUtil.isNullOrEmpty(key)) {
-				return systemClientParamsDao.getCount("from SystemClientParams scp");
+				return systemClientParamsDao.getCount(" select count(id) from SystemClientParams scp");
 			} else {
-				return systemClientParamsDao.getCount("from SystemClientParams scp where (scp.name like ? or scp.key like ?) ",
+				return systemClientParamsDao.getCount(" select count(id) from SystemClientParams scp where (scp.name like ? or scp.key like ?) ",
 						new Serializable[] { "%" + key + "%" ,"%" + key + "%"});
 			}
 			
 		} else {
 			
 			if (StringUtil.isNullOrEmpty(key)) {
-				return systemClientParamsDao.getCount("from SystemClientParams scp where scp.system.id = ? ",
+				return systemClientParamsDao.getCount(" select count(id) from SystemClientParams scp where scp.system.id = ? ",
 						 new Serializable[] {systemId});
 				
 			} else {
 				return systemClientParamsDao.getCount(
-						"from SystemClientParams scp where scp.system.id = ? and (scp.name like ? or scp.key like ?)",
+						" select count(id) from SystemClientParams scp where scp.system.id = ? and (scp.name like ? or scp.key like ?)",
 						new Serializable[] {systemId, "%" + key + "%" ,"%" + key + "%"});
 			}
 		}
@@ -355,6 +361,7 @@
 	
 	
 	@Transactional
+	@Override
 	public void saveAdd(SystemClientParams scp, List<Long> listId) throws Exception {
 		
 		if (listId == null || listId.size() == 0) {
@@ -363,7 +370,7 @@
 		
 		SystemClientParams nscp = null;
 		for (Long systemId : listId) {
-			System system  = new System(systemId);
+			BusinessSystem system  = new BusinessSystem(systemId);
 			nscp = new SystemClientParams();
 			nscp.setKey(scp.getKey());
 			nscp.setName(scp.getName());

--
Gitblit v1.8.0