From feee59af9b9d8173e28d7cde588b1ef9fcdb7efd Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 30 四月 2020 19:06:52 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div

---
 fanli/src/main/java/com/yeshi/fanli/controller/admin/PushRecordAdminController.java |   25 ++++++++-----------------
 1 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/PushRecordAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/PushRecordAdminController.java
index 3b13910..d40dce9 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/PushRecordAdminController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/PushRecordAdminController.java
@@ -7,14 +7,12 @@
 
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
+import org.yeshi.utils.JsonUtil;
 
 import com.yeshi.fanli.entity.xinge.PushRecord;
 import com.yeshi.fanli.service.inter.push.PushRecordService;
 import com.yeshi.fanli.tag.PageEntity;
 import com.yeshi.fanli.util.Constant;
-
-import org.yeshi.utils.JsonUtil;
 
 import net.sf.json.JSONObject;
 
@@ -25,17 +23,6 @@
 	
 	@Resource
 	private PushRecordService pushRecordService;
-	
-	@RequestMapping(value = "getPushRecordList", method = RequestMethod.POST)
-	public void getAll(String title,int type,int page,PrintWriter out){
-		List<PushRecord> list = pushRecordService.getPushRecordList(title,type,page);
-		int count = pushRecordService.getCount(title,type,page);
-		PageEntity pe = new PageEntity(page, Constant.PAGE_SIZE, count);
-		JSONObject data = new JSONObject();
-		data.put("pe", pe);
-		data.put("list", list);
-		out.print(JsonUtil.loadTrueResult(data));
-	}
 	
 	
 	/**
@@ -58,15 +45,19 @@
 				type = 0;
 			}
 			
-			List<PushRecord> list = pushRecordService.getPushRecordList(key, type, pageIndex);
+			int pageSize = Constant.PAGE_SIZE;
+			
+			List<PushRecord> list = pushRecordService.getPushRecordList((pageIndex-1) * pageSize, pageSize, key, type);
 			if (list == null || list.size() == 0) {
 				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鏇村鏁版嵁"));
 				return;
 			}
 			
-			int count = pushRecordService.getCount(key, type, pageIndex);
-			PageEntity pe = new PageEntity(pageIndex, Constant.PAGE_SIZE, count);
+			long count = pushRecordService.getCount(key, type);
 			
+			int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
+			PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
+
 			JSONObject data = new JSONObject();
 			data.put("pe", pe);
 			data.put("result_list", list);

--
Gitblit v1.8.0