|
@@ -1,5 +1,6 @@
|
|
|
package com.ym.mec.cms.service.impl;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -7,6 +8,7 @@ import java.util.Map;
|
|
|
import com.ym.mec.cms.controller.queryinfo.NewsInformationQueryInfo;
|
|
|
import com.ym.mec.cms.dal.entity.NewsStatusEnum;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
+import com.ym.mec.common.page.QueryInfo;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -52,28 +54,47 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
|
|
|
MapUtil.populateMap(params, queryInfo);
|
|
|
|
|
|
queryInfo.setType(3);
|
|
|
- int count = sysNewsInformationDao.queryCount(params);
|
|
|
+ int count = sysNewsInformationDao.queryHomeCount(params);
|
|
|
if(count == 0){
|
|
|
queryInfo.setMemo(null);
|
|
|
}
|
|
|
- homeList.put("banner",queryPage(queryInfo));
|
|
|
+ homeList.put("banner",queryHomePage(queryInfo));
|
|
|
|
|
|
queryInfo.setMemo(memo);
|
|
|
queryInfo.setType(6);
|
|
|
- count = sysNewsInformationDao.queryCount(params);
|
|
|
+ count = sysNewsInformationDao.queryHomeCount(params);
|
|
|
if(count == 0){
|
|
|
queryInfo.setMemo(null);
|
|
|
}
|
|
|
- homeList.put("app",queryPage(queryInfo));
|
|
|
+ homeList.put("app",queryHomePage(queryInfo));
|
|
|
|
|
|
queryInfo.setMemo(null);
|
|
|
queryInfo.setType(1);
|
|
|
- homeList.put("active",queryPage(queryInfo));
|
|
|
+ homeList.put("active",queryHomePage(queryInfo));
|
|
|
queryInfo.setType(2);
|
|
|
- homeList.put("hot",queryPage(queryInfo));
|
|
|
+ homeList.put("hot",queryHomePage(queryInfo));
|
|
|
queryInfo.setType(5);
|
|
|
- homeList.put("flash",queryPage(queryInfo));
|
|
|
+ homeList.put("flash",queryHomePage(queryInfo));
|
|
|
return homeList;
|
|
|
}
|
|
|
+
|
|
|
+ private PageInfo<SysNewsInformation> queryHomePage(QueryInfo queryInfo) {
|
|
|
+ PageInfo<SysNewsInformation> pageInfo = new PageInfo<SysNewsInformation>(queryInfo.getPage(), queryInfo.getRows());
|
|
|
+ Map<String, Object> params = new HashMap<String, Object>();
|
|
|
+ MapUtil.populateMap(params, queryInfo);
|
|
|
+
|
|
|
+ List<SysNewsInformation> dataList = null;
|
|
|
+ int count = sysNewsInformationDao.queryHomeCount(params);
|
|
|
+ if (count > 0) {
|
|
|
+ pageInfo.setTotal(count);
|
|
|
+ params.put("offset", pageInfo.getOffset());
|
|
|
+ dataList = sysNewsInformationDao.queryHomePage(params);
|
|
|
+ }
|
|
|
+ if (count == 0) {
|
|
|
+ dataList = new ArrayList<SysNewsInformation>();
|
|
|
+ }
|
|
|
+ pageInfo.setRows(dataList);
|
|
|
+ return pageInfo;
|
|
|
+ }
|
|
|
|
|
|
}
|