背景:获取今日所有打卡人员记录,取最新一条打卡时间
思路:根据时间倒叙排序,在根据id分组 建立map映射
LambdaQueryWrapper<LinkPunchRecord> wrapper = new LambdaQueryWrapper<>();
wrapper.orderByDesc(LinkPunchRecord::getCreated);
List<LinkPunchRecord> list = this.list(wrapper);
Map<String, LinkPunchRecordDto> map = collect.stream().collect(Collectors.toMap(LinkPunchRecordDto::getSecurityOfficerId, o -> o, (k1, k2) -> k1));
list集合分组后按
时间
排序
取
最近
的
一条
记录
集合按照id进行分组后,按照
时间
顺序
取
最近
一条
记录
List<Documnet> list = new ArrayList();
Map<String, Document> map = list.parallel
Stream
().collect(Collectors.groupingBy(data -> data.getString("id"),
Collectors.colle
1. list字符串
去重
List<String> unique = list.
stream
().distinct().collect(Collectors.toList());
2.集合对象
去重
// Person 对象
public class Person {
private String id;
private String name;
private String sex;
<!--省略
mysql使用临时密码登录不进去mysql: [Warning] Using a password on the command line interface can be insecure
共享恐惧:
sql删除重复数据只保留一条的操作方法
蘑菇仙人:
Stream流实现Tree树状结构无限递归
mitsuii:
关于 数据类型byte的取值范围 浅析
Linux完全卸载mysql的方式
痴人说梦家: