From 4cb15e222cd7d099d533ccbeb7f9a8cd99bf180c Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 十二月 2018 16:35:18 +0800 Subject: [PATCH] 替换原来老的资金详情 --- fanli/src/main/java/com/yeshi/fanli/service/impl/config/SystemClientParamsServiceImpl.java | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 111 insertions(+), 1 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 c848ce7..dd9366d 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,6 +7,7 @@ import javax.annotation.Resource; +import org.apache.commons.beanutils.PropertyUtils; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; @@ -25,7 +26,9 @@ import com.yeshi.fanli.entity.system.System; import com.yeshi.fanli.entity.system.SystemClientParams; 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; @Service public class SystemClientParamsServiceImpl implements SystemClientParamsService { @@ -38,6 +41,9 @@ @Resource private SystemHelpListDao systemHelpListDao; + + @Resource + private SystemService systemService; @Resource private SystemSecondProblemDao systemSecondProblemDao; @@ -74,6 +80,7 @@ list = systemClientParamsDao.list(hqlb.toString()); } } + SystemClientParamsAdmin scpa = null; for (SystemClientParams scp : list) { scpa = new SystemClientParamsAdmin(scp); @@ -287,6 +294,109 @@ return systemClientParamsMapper.contactCustomerService(title); } + + @Override + public List<SystemClientParams> listQuery(int start, int count, String key, Long systemId) { + + List<SystemClientParams> list = null; + + if (systemId == null) { + + if (StringUtil.isNullOrEmpty(key)) { + list = systemClientParamsDao.list("from SystemClientParams scp", start, count, null); + } else { + list = systemClientParamsDao.list("from SystemClientParams scp where (scp.name like ? or scp.key like ?) ", + start, count, new Serializable[] { "%" + key + "%" ,"%" + key + "%"}); + } + + } else { + + if (StringUtil.isNullOrEmpty(key)) { + list = systemClientParamsDao.list("from SystemClientParams scp where scp.system.id = ? ", + start, count, new Serializable[] {systemId}); + + } else { + list = systemClientParamsDao.list( + "from SystemClientParams scp where scp.system.id = ? and (scp.name like ? or scp.key like ?)", + start, count, new Serializable[] {systemId, "%" + key + "%" ,"%" + key + "%"}); + } + } + + return list; + } - + + @Override + public long countQuery(String key, Long systemId) { + + if (systemId == null) { + + if (StringUtil.isNullOrEmpty(key)) { + return systemClientParamsDao.getCount(" select count(id) from SystemClientParams scp"); + } else { + 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(" select count(id) from SystemClientParams scp where scp.system.id = ? ", + new Serializable[] {systemId}); + + } else { + return systemClientParamsDao.getCount( + " select count(id) from SystemClientParams scp where scp.system.id = ? and (scp.name like ? or scp.key like ?)", + new Serializable[] {systemId, "%" + key + "%" ,"%" + key + "%"}); + } + } + + } + + + @Transactional + @Override + public void saveAdd(SystemClientParams scp, List<Long> listId) throws Exception { + + if (listId == null || listId.size() == 0) { + return; + } + + SystemClientParams nscp = null; + for (Long systemId : listId) { + System system = new System(systemId); + nscp = new SystemClientParams(); + nscp.setKey(scp.getKey()); + nscp.setName(scp.getName()); + nscp.setValue(scp.getValue()); + nscp.setSystem(system); + nscp.setUpdatetime(java.lang.System.currentTimeMillis()); + systemClientParamsDao.create(nscp); + } + } + + @Override + public void update(SystemClientParams systemClientParams) { + systemClientParamsDao.update(systemClientParams); + } + + @Override + public List<SystemClientParams> getById(long id) { + return systemClientParamsDao.list("from SystemClientParams scp where scp.id=?", + new Serializable[] { id }); + } + + @Transactional + @Override + public void deleteBatchByPrimaryKey(List<Long> ids) { + for (Long id: ids) { + systemClientParamsDao.excute(new HibernateCallback() { + public Object doInHibernate(Session session) throws HibernateException { + Query query = session.createQuery("delete from SystemClientParams scp where scp.id= ?"); + query.setParameter(0, id); + return query.executeUpdate(); + } + }); + } + } } -- Gitblit v1.8.0