//按自定义格式对数据集合List进行分组
//List.stream().collect(Collectors.groupingBy(对象Vo -> {分组自定义标志字段}))
List<TestRecord> TestRecordsByMonthList = mapper.selectTestRecordByCondition(plantId, startDate, endDate);
Map<String, List<TestRecord>> mapGroupByMonth = TestRecordsByMonthList .stream().collect(Collectors.groupingBy(testRecord -> {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
return sdf.format(testRecord.getPlanSamplingTime());
}));
//常规方式,按数据集合List内元素特定字段进行分组
//List.stream().collect(Collectors.groupingBy(对象Vo::分组标志字段))
List<Equipment> equipmentList = operateCenterMapper.selectEquipmentFailureGroupByOrgId(plantId,startDate,endDate);
Map<String, List<Equipment>> mapGroupByOrg = equipmentList.stream().collect(Collectors.groupingBy(Equipment::getOrgId));