From bda6596caa5c883da985e3aa2ca52dd407ec7a23 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 15 Aug 2022 15:47:06 +0800 Subject: [PATCH] .... --- .../service/impl/ResourceServiceImpl.java | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 0cd2b7d7..eeb00168 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -470,7 +470,30 @@ public class ResourceServiceImpl extends CrudServiceImpl { - List temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> { + List temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast) + .sorted(Comparator.comparing(x -> { + Map index = (Map) x; + int pingTOp = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString()); + return pingTOp; + }, Comparator.reverseOrder()) + .thenComparing(x -> { + Map index = (Map) x; + long pingTOp = (index.get("pin_top_time") == null) ? 0 : Long.parseLong(index.get("pin_top_time").toString()); + return pingTOp; + }, Comparator.reverseOrder()) + .thenComparing(x -> { + Map index = (Map) x; + String string = (index.get("total") == null) ? "0" : index.get("total").toString(); + return Long.valueOf(string); + }, Comparator.reverseOrder()) + ).skip((long) (pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList()); + return temp; + }).get(); + break; + case "ASC": // total 升序 + ids = customThreadPool.submit(() -> { + List temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast) + .sorted(Comparator.comparing(x -> { Map index = (Map) x; int pingTOp = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString()); return pingTOp; @@ -479,30 +502,12 @@ public class ResourceServiceImpl extends CrudServiceImpl { + }, Comparator.reverseOrder()) + .thenComparing(x -> { Map index = (Map) x; String string = (index.get("total") == null) ? "0" : index.get("total").toString(); return Long.valueOf(string); - }, Comparator.reverseOrder()) - ).skip((long) (pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList()); - return temp; - }).get(); - break; - case "ASC": // total 升序 - ids = customThreadPool.submit(() -> { - List temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> { - Map index = (Map) x; - int pingTOp = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString()); - return pingTOp; - }, Comparator.reverseOrder()).thenComparing(x -> { - Map index = (Map) x; - long pingTOp = (index.get("pin_top_time") == null) ? 0 : Long.parseLong(index.get("pin_top_time").toString()); - return pingTOp; - }, Comparator.reverseOrder()).thenComparing(x -> { - Map index = (Map) x; - String string = (index.get("total") == null) ? "0" : index.get("total").toString(); - return Long.valueOf(string); - })).skip((pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList()); + })).skip((pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList()); return temp; }).get(); break;