소스 검색

病种报表的三个分页接口添加检索字段

JammeyJiang 3 주 전
부모
커밋
eb0e12e76f

+ 33 - 0
src/main/java/com/kcim/common/util/PageUtils.java

@@ -205,5 +205,38 @@ public class PageUtils implements Serializable {
 		return list.subList(fromIndex,toIndex);
 	}
 
+	public static <T> List<T> getPageList(List<T> list,int current,int pageSize){
+		if(list ==null){
+			return new ArrayList<>();
+		}
+		if(list.size() == 0){
+			return  list;
+		}
+		if(current ==0){
+			current = 1;
+		}
+		//记录总数
+		int count = list.size();
+		//页数
+		int pageCount = 0;
+		if(count % pageSize==0){
+			pageCount = count / pageSize;
+		}else {
+			pageCount = count / pageSize + 1;
+		}
+		int fromIndex = 0;
+		int toIndex = 0;
+		if(current>pageCount){
+			return new ArrayList<>();
+		}
+		if(current != pageCount){
+			fromIndex = (current - 1)*pageSize;
+			toIndex = fromIndex + pageSize;
+		}else {
+			fromIndex = (current - 1)*pageSize;
+			toIndex = count;
+		}
+		return list.subList(fromIndex,toIndex);
+	}
 
 }

+ 5 - 2
src/main/java/com/kcim/service/impl/StandardReportServiceImpl.java

@@ -2467,8 +2467,11 @@ public class StandardReportServiceImpl implements StandardReportService {
         StandardDeptCostCollectResponse pageData = new StandardDeptCostCollectResponse();
         pageData.setTitle(fullData.getTitle());
         pageData.setData(pageList);
-        
-        return new PageUtils(pageList, total, pageSize, current);
+        pageData.setCurrent(current);
+        pageData.setPageSize(pageSize);
+        pageData.setTotalCount( total);
+        pageData.setTotalPage((int)Math.ceil((double)total/pageSize));
+        return pageData;
     }
 
 

+ 8 - 0
src/main/java/com/kcim/web/reponse/StandardDeptCostCollectResponse.java

@@ -18,4 +18,12 @@ public class StandardDeptCostCollectResponse {
     private List<CommonResponsibilityReportVo> title;
 
     private List<StandardReportFormCustomVo> data;
+
+    private int totalCount;
+
+    private int current;
+
+    private int pageSize;
+
+    private int totalPage;
 }