|
@@ -97,21 +97,21 @@ public class WebSiteTourismTravelNotesPublishController {
|
|
|
List<TourismTravelNotesContentWriteDto> coverImageList1 = travelNotesContent.stream().filter(item -> item.getType().equals("image")).collect(Collectors.toList());
|
|
|
if(CollectionUtils.isEmpty(coverImageList)){
|
|
|
if(CollectionUtils.isNotEmpty(coverImageList1)){
|
|
|
- tourismProjectTravelNotesWrite.setTourismUrl(coverImageList1.get(0).getContent());
|
|
|
+ tourismProjectTravelNotesWriteSave.setTourismUrl(coverImageList1.get(0).getContent());
|
|
|
}
|
|
|
}else{
|
|
|
- tourismProjectTravelNotesWrite.setTourismUrl(coverImageList.get(0).getContent());
|
|
|
+ tourismProjectTravelNotesWriteSave.setTourismUrl(coverImageList.get(0).getContent());
|
|
|
}
|
|
|
|
|
|
//判断是新增还是更新
|
|
|
if(tourismProjectTravelNotesWrite == null){
|
|
|
//草稿为下架状态
|
|
|
tourismProjectTravelNotesWriteSave.setUnmountState(UnmountState.DELIST);
|
|
|
- tourismProjectTravelNotesWrite = tourismProjectTravelNotesWriteService.saveNew(tourismProjectTravelNotesWriteSave);
|
|
|
+ tourismProjectTravelNotesWriteService.saveNew(tourismProjectTravelNotesWriteSave);
|
|
|
}else {
|
|
|
//草稿为下架状态
|
|
|
- tourismProjectTravelNotesWrite.setUnmountState(UnmountState.DELIST);
|
|
|
- tourismProjectTravelNotesWriteService.updateById(tourismProjectTravelNotesWrite);
|
|
|
+ tourismProjectTravelNotesWriteSave.setUnmountState(UnmountState.DELIST);
|
|
|
+ tourismProjectTravelNotesWriteService.updateById(tourismProjectTravelNotesWriteSave);
|
|
|
}
|
|
|
|
|
|
//判断内容是否为空
|
|
@@ -119,10 +119,10 @@ public class WebSiteTourismTravelNotesPublishController {
|
|
|
List<TourismTravelNotesContentWriteDto> travelNotesContentWriteList = tourismProjectTravelNotesWriteDto.getTravelNotesContent();
|
|
|
List<TourismTravelNotesContentWrite> tourismTravelNotesContentWriteList = MyModelUtil.copyCollectionTo(travelNotesContentWriteList, TourismTravelNotesContentWrite.class);
|
|
|
for (TourismTravelNotesContentWrite item : tourismTravelNotesContentWriteList) {
|
|
|
- item.setAssociationId(tourismProjectTravelNotesWrite.getId());
|
|
|
+ item.setAssociationId(tourismProjectTravelNotesWriteSave.getId());
|
|
|
item.setId(null);
|
|
|
}
|
|
|
- tourismTravelNotesContentWriteService.removeByAssociationId(tourismProjectTravelNotesWrite.getId());
|
|
|
+ tourismTravelNotesContentWriteService.removeByAssociationId(tourismProjectTravelNotesWriteSave.getId());
|
|
|
//查询关联数据的id,根据id进行更新数据表的数据
|
|
|
tourismTravelNotesContentWriteService.saveNewBatch(tourismTravelNotesContentWriteList);
|
|
|
}
|