| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @PostMapping("/list") |
| | | public R<PageInfo<TConsultationMessage>> list(@RequestBody MessageQuery messageQuery){ |
| | | PageInfo<TConsultationMessage> tConsultationMessagePageInfo = consultationMessageService.pageQuery(messageQuery); |
| | | for (TConsultationMessage record : tConsultationMessagePageInfo.getRecords()) { |
| | | TConsultation byId = consultationService.getById(record.getConsultationId()); |
| | | record.setTitle(byId.getClassificationName()); |
| | | |
| | | List<TConsultationMessage> records = tConsultationMessagePageInfo.getRecords(); |
| | | |
| | | TTechnicalTitle byId1 = tTechnicalTitleService.getById(byId.getTitleId() ); |
| | | TTitleMajor byId2 = majorService.getById(byId.getMajorId()); |
| | | TLevel byId3 = levelService.getById(byId.getLevel()); |
| | | record.setClassName(byId1.getTitileName()+"-"+byId2.getMajorName()+"-"+byId3.getName()); |
| | | List<Long> consultationId = records.stream().map(TConsultationMessage::getConsultationId).collect(Collectors.toList()); |
| | | List<TConsultation> consultations = consultationService.lambdaQuery().in(TConsultation::getId,consultationId).list(); |
| | | |
| | | List<Long> titleId = consultations.stream().map(TConsultation::getTitleId).collect(Collectors.toList()); |
| | | List<TTechnicalTitle> tTechnicalTitles = tTechnicalTitleService.lambdaQuery().in(TTechnicalTitle::getId,titleId).list(); |
| | | |
| | | List<Long> majorId = consultations.stream().map(TConsultation::getMajorId).collect(Collectors.toList()); |
| | | List<TTitleMajor> tTitleMajors = majorService.lambdaQuery().in(TTitleMajor::getId,majorId).list(); |
| | | |
| | | List<Integer> level = consultations.stream().map(TConsultation::getLevel).collect(Collectors.toList()); |
| | | List<TLevel> levels = levelService.lambdaQuery().in(TLevel::getId,level).list(); |
| | | for (TConsultationMessage record : records) { |
| | | TConsultation consultation = consultations.stream().filter(e -> e.getId().equals(record.getConsultationId())).findFirst().orElse(null); |
| | | record.setTitle(consultation.getClassificationName()); |
| | | TTechnicalTitle tTechnicalTitle = tTechnicalTitles.stream().filter(e -> e.getId().equals(consultation.getTitleId())).findFirst().orElse(null); |
| | | TTitleMajor tTitleMajor = tTitleMajors.stream().filter(e -> e.getId().equals(consultation.getMajorId())).findFirst().orElse(null); |
| | | TLevel tLevel = levels.stream().filter(e -> e.getId().equals(consultation.getLevel())).findFirst().orElse(null); |
| | | record.setClassName(tTechnicalTitle.getTitileName()+"-"+tTitleMajor.getMajorName()+"-"+tLevel.getName()); |
| | | } |
| | | return R.ok(tConsultationMessagePageInfo); |
| | | } |