소스 검색

[fix]
1、完善后台管理系统的保存游记功能

chenchen 4 달 전
부모
커밋
4ce01da400

+ 1 - 1
application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/CleanDataController.java

@@ -101,7 +101,7 @@ public class CleanDataController {
         List<TourismTravelNotesContentWrite> contentList = new ArrayList<>();
         originNoteList.forEach(e->{
             TourismProjectTravelNotesWrite write = new TourismProjectTravelNotesWrite();
-            write.setId(e.getId());
+            write.setId(Long.valueOf(e.getId()));
             write.setProjectTitle(e.getProjectTitle());
             write.setRemarks(e.getRemarks());
             //热点

+ 3 - 3
application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/WebSiteTourismTravelNotesPublishController.java

@@ -98,10 +98,10 @@ public class WebSiteTourismTravelNotesPublishController {
             List<TourismTravelNotesContentWriteDto> travelNotesContentWriteList = tourismProjectTravelNotesWriteDto.getTravelNotesContent();
             List<TourismTravelNotesContentWrite> tourismTravelNotesContentWriteList = MyModelUtil.copyCollectionTo(travelNotesContentWriteList, TourismTravelNotesContentWrite.class);
             for (TourismTravelNotesContentWrite item : tourismTravelNotesContentWriteList) {
-                item.setAssociationId(Long.parseLong(tourismProjectTravelNotesWrite.getId()));
+                item.setAssociationId(tourismProjectTravelNotesWrite.getId());
                 item.setId(null);
             }
-            tourismTravelNotesContentWriteService.removeByAssociationId(Long.parseLong(tourismProjectTravelNotesWrite.getId()));
+            tourismTravelNotesContentWriteService.removeByAssociationId(tourismProjectTravelNotesWrite.getId());
             //查询关联数据的id,根据id进行更新数据表的数据
             tourismTravelNotesContentWriteService.saveNewBatch(tourismTravelNotesContentWriteList);
         }
@@ -238,7 +238,7 @@ public class WebSiteTourismTravelNotesPublishController {
         List<TourismTravelNotesContentWrite> tourismTravelNotesContentWriteList =
                 MyModelUtil.copyCollectionTo(tourismProjectTravelNotesWriteDto.getTravelNotesContent(), TourismTravelNotesContentWrite.class);
         for (TourismTravelNotesContentWrite item : tourismTravelNotesContentWriteList) {
-            item.setAssociationId(Long.parseLong(tourismProjectTravelNotesWrite.getId()));
+            item.setAssociationId(tourismProjectTravelNotesWrite.getId());
             item.setId(null);
         }
         tourismTravelNotesContentWriteService.saveNewBatch(tourismTravelNotesContentWriteList);

+ 1 - 1
application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/WebsiteTourismProjectTravelNotesController.java

@@ -134,7 +134,7 @@ public class WebsiteTourismProjectTravelNotesController {
     @PostMapping("/userLikeTravelNotesUpdate")
     public ResponseResult<Void> userLikeTravelNotesUpdate(@RequestBody TourismTravelNotesWriteDto dto) {
         TourismProjectTravelNotesWrite tourismProjectTravelNotesWrite = new TourismProjectTravelNotesWrite();
-        tourismProjectTravelNotesWrite.setId(dto.getTravelNotesId());
+        tourismProjectTravelNotesWrite.setId(Long.valueOf(dto.getTravelNotesId()));
         TourismProjectTravelNotesWrite tourismProjectTravelNotesWrite1 = tourismProjectTravelNotesWriteService.getOne(tourismProjectTravelNotesWrite);
 
         tourismProjectTravelNotesWrite1.setLikeCount(tourismProjectTravelNotesWrite1.getLikeCount() + 1);

+ 1 - 1
application-webadmin/src/main/java/com/tourism/webadmin/back/controller/TourismProjectTravelNotesWriteController.java

@@ -75,7 +75,7 @@ public class TourismProjectTravelNotesWriteController {
         }
         TourismProjectTravelNotesWrite tourismProjectTravelNotesWrite = MyModelUtil.copyTo(tourismProjectTravelNotesWriteDto, TourismProjectTravelNotesWrite.class);
         tourismProjectTravelNotesWrite = tourismProjectTravelNotesWriteService.saveNew(tourismProjectTravelNotesWrite);
-        return ResponseResult.success(Long.parseLong(tourismProjectTravelNotesWrite.getId()));
+        return ResponseResult.success(tourismProjectTravelNotesWrite.getId());
     }
 
     /**

+ 1 - 1
application-webadmin/src/main/java/com/tourism/webadmin/back/dto/TourismProjectTravelNotesWriteDto.java

@@ -205,6 +205,6 @@ public class TourismProjectTravelNotesWriteDto {
      * 游记内容。
      */
     @Schema(description = "游记内容。")
-    @NotNull(message = "游记内容不能为空!", groups = {UpdateGroup.class})
+//    @NotNull(message = "游记内容不能为空!", groups = {UpdateGroup.class})
     private List<TourismTravelNotesContentWriteDto> travelNotesContent;
 }

+ 1 - 1
application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourismProjectTravelNotesWrite.java

@@ -30,7 +30,7 @@ public class TourismProjectTravelNotesWrite extends BaseModel {
      * 主键id。
      */
     @TableId(value = "id")
-    private String id;
+    private Long id;
 
     /**
      * 项目标题。

+ 3 - 3
application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/TourismProjectTravelNotesWriteServiceImpl.java

@@ -81,7 +81,7 @@ public class TourismProjectTravelNotesWriteServiceImpl extends BaseService<Touri
     public boolean update(TourismProjectTravelNotesWrite tourismProjectTravelNotesWrite, TourismProjectTravelNotesWrite originalTourismProjectTravelNotesWrite) {
         MyModelUtil.fillCommonsForUpdate(tourismProjectTravelNotesWrite, originalTourismProjectTravelNotesWrite);
         // 这里重点提示,在执行主表数据更新之前,如果有哪些字段不支持修改操作,请用原有数据对象字段替换当前数据字段。
-        UpdateWrapper<TourismProjectTravelNotesWrite> uw = this.createUpdateQueryForNullValue(tourismProjectTravelNotesWrite, Long.parseLong(tourismProjectTravelNotesWrite.getId()));
+        UpdateWrapper<TourismProjectTravelNotesWrite> uw = this.createUpdateQueryForNullValue(tourismProjectTravelNotesWrite, tourismProjectTravelNotesWrite.getId());
         return tourismProjectTravelNotesWriteMapper.update(tourismProjectTravelNotesWrite, uw) == 1;
     }
 
@@ -101,7 +101,7 @@ public class TourismProjectTravelNotesWriteServiceImpl extends BaseService<Touri
         // 对于一对一新增或更新,如果主键值为空就新增,否则就更新,同时更新updateTime和updateUserId。
         TourismTravelNotesContentWrite tourismTravelNotesContentWrite = relationData.getObject("tourismTravelNotesContentWrite", TourismTravelNotesContentWrite.class);
         if (tourismTravelNotesContentWrite != null) {
-            tourismTravelNotesContentWrite.setAssociationId(Long.parseLong(tourismProjectTravelNotesWrite.getId()));
+            tourismTravelNotesContentWrite.setAssociationId(tourismProjectTravelNotesWrite.getId());
             tourismTravelNotesContentWriteService.saveNewOrUpdate(tourismTravelNotesContentWrite,
                     tourismTravelNotesContentWriteService::saveNew, tourismTravelNotesContentWriteService::update);
         }
@@ -197,7 +197,7 @@ public class TourismProjectTravelNotesWriteServiceImpl extends BaseService<Touri
 
     private TourismProjectTravelNotesWrite buildDefaultValue(TourismProjectTravelNotesWrite tourismProjectTravelNotesWrite) {
         if (tourismProjectTravelNotesWrite.getId() == null) {
-            tourismProjectTravelNotesWrite.setId(String.valueOf(idGenerator.nextLongId()));
+            tourismProjectTravelNotesWrite.setId(idGenerator.nextLongId());
         }
         MyModelUtil.fillCommonsForInsert(tourismProjectTravelNotesWrite);
         tourismProjectTravelNotesWrite.setDataState(GlobalDeletedFlag.NORMAL);