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());