|
|
@@ -21,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -157,6 +158,18 @@ public class SopServiceImpl extends ServiceImpl<SopMapper, SopEntity> implements
|
|
|
}).collect(Collectors.toList());
|
|
|
responsePage.setRecords(records);
|
|
|
|
|
|
+ List<Long> sopIds = records.stream().map(SopResponseDTO::getId).collect(Collectors.toList());
|
|
|
+ List<SopDetailEntity> details = sopDetailService.list(new LambdaQueryWrapper<SopDetailEntity>()
|
|
|
+ .in(SopDetailEntity::getSopId, sopIds)
|
|
|
+ .eq(SopDetailEntity::getIsDelete, 0));
|
|
|
+ List<SopDetailResponseDTO> detailResponses = details.stream().map(detail -> {
|
|
|
+ SopDetailResponseDTO detailDto = new SopDetailResponseDTO();
|
|
|
+ BeanUtils.copyProperties(detail, detailDto);
|
|
|
+ return detailDto;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ Map<Long, List<SopDetailResponseDTO>> detailMap = detailResponses.stream().collect(Collectors.groupingBy(SopDetailResponseDTO::getSopId));
|
|
|
+ records.forEach(sopDetailDto -> sopDetailDto.setDetails(detailMap.get(sopDetailDto.getId())));
|
|
|
+
|
|
|
return responsePage;
|
|
|
}
|
|
|
}
|