From a47b0620456e7db58da65402c41be340df2a01b9 Mon Sep 17 00:00:00 2001 From: ronger Date: Tue, 5 Jan 2021 08:33:39 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E5=85=A8=E9=9D=A2=E6=8B=A5=E6=8A=B1=20?= =?UTF-8?q?java8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/rymcu/forest/web/api/admin/AdminController.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/rymcu/forest/web/api/admin/AdminController.java b/src/main/java/com/rymcu/forest/web/api/admin/AdminController.java index 6dee51a..69cc224 100644 --- a/src/main/java/com/rymcu/forest/web/api/admin/AdminController.java +++ b/src/main/java/com/rymcu/forest/web/api/admin/AdminController.java @@ -18,6 +18,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static java.util.Comparator.comparing; + /** * @author ronger * */ @@ -40,6 +42,8 @@ public class AdminController { public GlobalResult> users(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows){ PageHelper.startPage(page, rows); List list = userService.findAll(); + // 按最后登录时间进行倒序排序 + list.sort(comparing(User::getLastLoginTime).reversed()); PageInfo pageInfo = new PageInfo<>(list); Map map = new HashMap(2); map.put("users", pageInfo.getList());