🎨 全面拥抱 java8

This commit is contained in:
ronger 2021-01-05 08:33:39 +08:00
parent 39ba372cac
commit a47b062045

View File

@ -18,6 +18,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static java.util.Comparator.comparing;
/** /**
* @author ronger * @author ronger
* */ * */
@ -40,6 +42,8 @@ public class AdminController {
public GlobalResult<Map<String, Object>> users(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows){ public GlobalResult<Map<String, Object>> users(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows){
PageHelper.startPage(page, rows); PageHelper.startPage(page, rows);
List<User> list = userService.findAll(); List<User> list = userService.findAll();
// 按最后登录时间进行倒序排序
list.sort(comparing(User::getLastLoginTime).reversed());
PageInfo<User> pageInfo = new PageInfo<>(list); PageInfo<User> pageInfo = new PageInfo<>(list);
Map<String, Object> map = new HashMap<String, Object>(2); Map<String, Object> map = new HashMap<String, Object>(2);
map.put("users", pageInfo.getList()); map.put("users", pageInfo.getList());