1、stream summingInt
List<Update> allItem = service.listById(a, b).stream()
.filter(t -> t.getId() != null && t.getId() > 0)
.collect(groupingBy(DO::getGId,
summingInt(DO::getNumber)))
.entrySet().stream().map(Detail -> {
Update DTO = new DTO();
DTO.setCode("A");
DTO.setNum(Detail.getValue());
DTO.setGId(Long.valueOf(Detail.getKey()));
DTO.setSId(Joiner.on("_").join(Id, Detail.getKey()));
return DTO;
}).collect(Collectors.toList());
网友评论