List<StandardProductionWorkRequest> distinctList = list.stream()
.collect(Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(StandardProductionWorkRequest::getId))),
ArrayList::new
));
以上代码使用了Collectors.toCollection()方法将去重后的元素收集到一个新的TreeSet集合中,并最终将TreeSet转换为ArrayList返回。在构造TreeSet时,使用了Comparator.comparing()方法指定根据id字段进行比较和去重。