Explorar o código

[fix]
增加发布游记的时候时的提及用户和话题的非空判断

chenchen hai 1 mes
pai
achega
130c63db00
Modificáronse 16 ficheiros con 812 adicións e 29 borrados
  1. 62 0
      application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/TourWebTravelNotesTopicController.java
  2. 33 26
      application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/WebSiteTourismTravelNotesPublishController.java
  3. 1 1
      application-webadmin/src/main/java/com/tourism/webadmin/app/website/dto/TourTakePartImGroupDto.java
  4. 1 1
      application-webadmin/src/main/java/com/tourism/webadmin/app/website/dto/TourTravelNotesTopicByNameDto.java
  5. 39 0
      application-webadmin/src/main/java/com/tourism/webadmin/app/website/dto/TourTravelNotesTopicListByNameDto.java
  6. 59 0
      application-webadmin/src/main/java/com/tourism/webadmin/app/website/vo/TourTravelNotesTopicNotesSearchVo.java
  7. 55 0
      application-webadmin/src/main/java/com/tourism/webadmin/app/website/vo/TourTravelNotesTopicSearchVo.java
  8. 179 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/controller/TourUserLikeTopicController.java
  9. 33 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/dao/TourUserLikeTopicMapper.java
  10. 56 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/dao/mapper/TourUserLikeTopicMapper.xml
  11. 47 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/dto/TourUserLikeTopicDto.java
  12. 39 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourUserLikeTopic.java
  13. 68 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/service/TourUserLikeTopicService.java
  14. 100 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/TourUserLikeTopicServiceImpl.java
  15. 1 1
      application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourTravelNotesTopicVo.java
  16. 39 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourUserLikeTopicVo.java

+ 62 - 0
application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/TourWebTravelNotesTopicController.java

@@ -0,0 +1,62 @@
+//package com.tourism.webadmin.app.website.controller;
+//
+//import cn.dev33.satoken.annotation.SaIgnore;
+//import com.tourism.common.core.annotation.DisableDataFilter;
+//import com.tourism.common.core.object.ResponseResult;
+//import com.tourism.common.core.object.TokenData;
+//import com.tourism.webadmin.app.website.dto.TourTravelNotesTopicByNameDto;
+//import com.tourism.webadmin.app.website.dto.TourTravelNotesTopicListByNameDto;
+//import com.tourism.webadmin.app.website.dto.TourVisaSearchDto;
+//import com.tourism.webadmin.app.website.vo.TourTravelNotesTopicSearchVo;
+//import com.tourism.webadmin.back.model.TourUserLikeTopic;
+//import com.tourism.webadmin.back.service.TourUserLikeTopicService;
+//import io.swagger.v3.oas.annotations.tags.Tag;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.validation.annotation.Validated;
+//import org.springframework.web.bind.annotation.GetMapping;
+//import org.springframework.web.bind.annotation.RequestMapping;
+//import org.springframework.web.bind.annotation.RestController;
+//
+///**
+// * @author 陈
+// * @date 2024年1月24日 9:00:00
+// */
+//@Tag(name = "游记话题")
+//@Slf4j
+//@RestController
+//@RequestMapping("/website/tourism/travelNotesTopic")
+//@DisableDataFilter
+//public class TourWebTravelNotesTopicController {
+//
+//
+//    @Autowired
+//    private TourUserLikeTopicService tourUserLikeTopicService;
+//
+//
+//    /**
+//     * 分页条件查询游记话题,默认根据最热进行排序
+//     * @param tourTravelNotesTopicListByNameDto
+//     * @return
+//     */
+//    @GetMapping("/list")
+//    public ResponseResult<TourTravelNotesTopicSearchVo> listPage(@Validated TourTravelNotesTopicListByNameDto tourTravelNotesTopicListByNameDto) {
+//
+//        TourTravelNotesTopicSearchVo tourTravelNotesTopicSearchVo = new TourTravelNotesTopicSearchVo();
+//
+//        //根据话题名称查询本人是否收藏
+//        TourUserLikeTopic tourUserLikeTopic = new TourUserLikeTopic();
+//        tourUserLikeTopic.setTourTravelNotesTopicName(tourTravelNotesTopicListByNameDto.getName());
+//        tourUserLikeTopic.setTourUserId(TokenData.takeFromRequest().getUserId());
+//        if(tourUserLikeTopicService.existByFilter(tourUserLikeTopic)){
+//            tourTravelNotesTopicSearchVo.setIsCollect(1);
+//        }else {
+//            tourTravelNotesTopicSearchVo.setIsCollect(0);
+//        }
+//        //根据话题名称查询浏览量
+//
+//        //根据话题名称查询讨论量
+//        //根据话题名称查询帖子数量
+//        //根据话题名称查询游记列表
+//    }
+//}

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

@@ -27,6 +27,7 @@ import com.tourism.webadmin.back.model.constant.AuditState;
 import com.tourism.webadmin.back.model.constant.UnmountState;
 import com.tourism.webadmin.back.service.*;
 import com.tourism.webadmin.back.vo.TourTravelNotesMentionUserVo;
+import com.tourism.webadmin.back.vo.TourTravelNotesTopicVo;
 import com.tourism.webadmin.back.vo.TourismProjectTravelNotesWriteVo;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
@@ -96,21 +97,25 @@ public class WebSiteTourismTravelNotesPublishController {
     @PostMapping("/saveDraft")
     public ResponseResult<Void> saveDraft(@RequestBody TourismProjectTravelNotesWriteToWebDto tourismProjectTravelNotesWriteDto) {
 
-        //先校验提及的用户id是否符合互关的状态
-        List<TourTravelNotesMentionUserDto> mentions = tourismProjectTravelNotesWriteDto.getMentions();
-        List<TourTravelNotesMentionUserDto> mentionsUserIdList = mentions.stream().filter(item -> item.getUserId() != null).collect(Collectors.toList());
         Long userId = TokenData.takeFromRequest().getUserId();
-        List<TourShortUser> fouceEachFriendsByName = tourFansService.getFouceEachFriendsByName(userId, "");
-        List<TourShortUser> fouceEachFriedsUserIdList = fouceEachFriendsByName.stream().filter(i -> i.getUserId() != null).collect(Collectors.toList());
-        if(!(fouceEachFriedsUserIdList).containsAll(mentionsUserIdList)){
-            return ResponseResult.error(ErrorCodeEnum.MENTION_USER_ERROR,"提及的用户与本人不符合互关的状态");
+        //先校验提及的用户id是否符合互关的状态
+        if(CollectionUtils.isNotEmpty(tourismProjectTravelNotesWriteDto.getMentions())) {
+            List<TourTravelNotesMentionUserDto> mentions = tourismProjectTravelNotesWriteDto.getMentions();
+            List<TourTravelNotesMentionUserDto> mentionsUserIdList = mentions.stream().filter(item -> item.getUserId() != null).collect(Collectors.toList());
+            List<TourShortUser> fouceEachFriendsByName = tourFansService.getFouceEachFriendsByName(userId, "");
+            List<TourShortUser> fouceEachFriedsUserIdList = fouceEachFriendsByName.stream().filter(i -> i.getUserId() != null).collect(Collectors.toList());
+            if (!(fouceEachFriedsUserIdList).containsAll(mentionsUserIdList)) {
+                return ResponseResult.error(ErrorCodeEnum.MENTION_USER_ERROR, "提及的用户与本人不符合互关的状态");
+            }
         }
 
         //校验dto中的群聊是否为本人参与的群聊
-        List<TourShortImGroup> takePartImGroupListByName = tourImGroupService.getTakePartImGroupListByName(userId, "");
-        List<Long> takePartImGroupIdList = takePartImGroupListByName.stream().mapToLong(TourShortImGroup::getId).boxed().collect(Collectors.toList());
-        if(!takePartImGroupIdList.contains(tourismProjectTravelNotesWriteDto.getTourImGroupId())){
-            return ResponseResult.error(ErrorCodeEnum.MENTION_GROUP_ERROR,"本人未参与到关联的群聊中");
+        if(tourismProjectTravelNotesWriteDto.getTourImGroupId() != null) {
+            List<TourShortImGroup> takePartImGroupListByName = tourImGroupService.getTakePartImGroupListByName(userId, "");
+            List<Long> takePartImGroupIdList = takePartImGroupListByName.stream().mapToLong(TourShortImGroup::getId).boxed().collect(Collectors.toList());
+            if (!takePartImGroupIdList.contains(tourismProjectTravelNotesWriteDto.getTourImGroupId())) {
+                return ResponseResult.error(ErrorCodeEnum.MENTION_GROUP_ERROR, "本人未参与到关联的群聊中");
+            }
         }
 
         //循环遍历查询内容是否超过5000长度
@@ -227,23 +232,25 @@ public class WebSiteTourismTravelNotesPublishController {
     @Transactional
     public ResponseResult<Void> publishDraft(@RequestBody TourismProjectTravelNotesWriteToWebDto tourismProjectTravelNotesWriteDto) {
 
-        //先校验提及的用户id是否符合互关的状态
-        List<TourTravelNotesMentionUserDto> mentions = tourismProjectTravelNotesWriteDto.getMentions();
-        List<TourTravelNotesMentionUserDto> mentionsUserIdList = mentions.stream().filter(item -> item.getUserId() != null).collect(Collectors.toList());
         Long userId = TokenData.takeFromRequest().getUserId();
-        List<TourShortUser> fouceEachFriendsByName = tourFansService.getFouceEachFriendsByName(userId, "");
-        List<TourShortUser> fouceEachFriedsUserIdList = fouceEachFriendsByName.stream().filter(i -> i.getUserId() != null).collect(Collectors.toList());
-        if(!(fouceEachFriedsUserIdList).containsAll(mentionsUserIdList)){
-            return ResponseResult.error(ErrorCodeEnum.MENTION_USER_ERROR,"提及的用户与本人不符合互关的状态");
+        //先校验提及的用户id是否符合互关的状态
+        if(CollectionUtils.isNotEmpty(tourismProjectTravelNotesWriteDto.getMentions())) {
+            List<TourTravelNotesMentionUserDto> mentions = tourismProjectTravelNotesWriteDto.getMentions();
+            List<TourTravelNotesMentionUserDto> mentionsUserIdList = mentions.stream().filter(item -> item.getUserId() != null).collect(Collectors.toList());
+            List<TourShortUser> fouceEachFriendsByName = tourFansService.getFouceEachFriendsByName(userId, "");
+            List<TourShortUser> fouceEachFriedsUserIdList = fouceEachFriendsByName.stream().filter(i -> i.getUserId() != null).collect(Collectors.toList());
+            if (!(fouceEachFriedsUserIdList).containsAll(mentionsUserIdList)) {
+                return ResponseResult.error(ErrorCodeEnum.MENTION_USER_ERROR, "提及的用户与本人不符合互关的状态");
+            }
         }
-
         //校验dto中的群聊是否为本人参与的群聊
-        List<TourShortImGroup> takePartImGroupListByName = tourImGroupService.getTakePartImGroupListByName(userId, "");
-        List<Long> takePartImGroupIdList = takePartImGroupListByName.stream().mapToLong(TourShortImGroup::getId).boxed().collect(Collectors.toList());
-        if(!takePartImGroupIdList.contains(tourismProjectTravelNotesWriteDto.getTourImGroupId())){
-            return ResponseResult.error(ErrorCodeEnum.MENTION_GROUP_ERROR,"本人未参与到关联的群聊中");
+        if(tourismProjectTravelNotesWriteDto.getTourImGroupId() != null) {
+            List<TourShortImGroup> takePartImGroupListByName = tourImGroupService.getTakePartImGroupListByName(userId, "");
+            List<Long> takePartImGroupIdList = takePartImGroupListByName.stream().mapToLong(TourShortImGroup::getId).boxed().collect(Collectors.toList());
+            if (!takePartImGroupIdList.contains(tourismProjectTravelNotesWriteDto.getTourImGroupId())) {
+                return ResponseResult.error(ErrorCodeEnum.MENTION_GROUP_ERROR, "本人未参与到关联的群聊中");
+            }
         }
-
         tourTravelNotesPublishService.publishDraft(tourismProjectTravelNotesWriteDto);
         return ResponseResult.success();
     }
@@ -435,7 +442,7 @@ public class WebSiteTourismTravelNotesPublishController {
      */
     @OperationLog(type = SysOperationLogType.LIST)
     @GetMapping("/getTopicListByName")
-    public ResponseResult<List<TourTravelNotesTopic>> getTopicListByName(@Validated TourTravelNotesTopicByNameDto tourTravelNotesTopicByNameDto) {
+    public ResponseResult<List<TourTravelNotesTopicVo>> getTopicListByName(@Validated TourTravelNotesTopicByNameDto tourTravelNotesTopicByNameDto) {
         //limit20
         PageMethod.startPage(tourTravelNotesTopicByNameDto.getPageNum(), tourTravelNotesTopicByNameDto.getPageSize(), true);
         TourTravelNotesTopic tourTravelNotesTopic = new TourTravelNotesTopic();
@@ -444,7 +451,7 @@ public class WebSiteTourismTravelNotesPublishController {
         String orderBy = MyOrderParam.buildOrderBy(myOrderParam, TourTravelNotesTopic.class);
         myOrderParam.add(new MyOrderParam.OrderInfo("hotValue", false, null));
         List<TourTravelNotesTopic> tourTravelNotesTopicList = tourTravelNotesTopicService.getTourTravelNotesTopicList(tourTravelNotesTopic,orderBy);
-        List<TourTravelNotesTopic> tourTravelNotesTopicVoList = MyModelUtil.copyCollectionTo(tourTravelNotesTopicList, TourTravelNotesTopic.class);
+        List<TourTravelNotesTopicVo> tourTravelNotesTopicVoList = MyModelUtil.copyCollectionTo(tourTravelNotesTopicList, TourTravelNotesTopicVo.class);
         return ResponseResult.success(tourTravelNotesTopicVoList);
     }
 

+ 1 - 1
application-webadmin/src/main/java/com/tourism/webadmin/app/website/dto/TourTakePartImGroupDto.java

@@ -4,7 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
 import jakarta.validation.constraints.NotNull;
 import lombok.Data;
 
-@Schema(description = "获取互关好友Dto")
+@Schema(description = "获取参与的群聊Dto")
 @Data
 public class TourTakePartImGroupDto {
 

+ 1 - 1
application-webadmin/src/main/java/com/tourism/webadmin/app/website/dto/TourTravelNotesTopicByNameDto.java

@@ -4,7 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
 import jakarta.validation.constraints.NotNull;
 import lombok.Data;
 
-@Schema(description = "获取互关好友Dto")
+@Schema(description = "获取话题Dto")
 @Data
 public class TourTravelNotesTopicByNameDto {
 

+ 39 - 0
application-webadmin/src/main/java/com/tourism/webadmin/app/website/dto/TourTravelNotesTopicListByNameDto.java

@@ -0,0 +1,39 @@
+package com.tourism.webadmin.app.website.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+@Schema(description = "根据话题获取游记列表Dto")
+@Data
+public class TourTravelNotesTopicListByNameDto {
+
+    /**
+     * 分页号码,从1开始计数。
+     */
+    @Schema(description = "分页号码。")
+    @NotNull(message = "分页号码不能为空,请提供有效的 pageSize 参数")
+    private Integer pageNum;
+
+    /**
+     * 每页大小。
+     */
+    @Schema(description = "每页大小。")
+    @NotNull(message = "每页大小不能为空,请提供有效的 pageSize 参数")
+    private Integer pageSize;
+
+    /**
+     * 名称。
+     */
+    @Schema(description = "名称。")
+    @NotNull(message = "话题名称不能为空,请提供有效的 name 参数")
+    private String name;
+
+    /**
+     * 排序。不传值或者传0的话,按最热排序;传1的话,则按照最新排序
+     */
+    @Schema(description = "排序。")
+    private String orderBy;
+
+
+}

+ 59 - 0
application-webadmin/src/main/java/com/tourism/webadmin/app/website/vo/TourTravelNotesTopicNotesSearchVo.java

@@ -0,0 +1,59 @@
+package com.tourism.webadmin.app.website.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * TourTravelNotesTopicNotesSearchVo视图对象。
+ *
+ * @author 陈
+ * @date 2024/01/24
+ */
+@Schema(description = "TourTravelNotesTopicNotesSearchVo视图对象")
+@Data
+public class TourTravelNotesTopicNotesSearchVo {
+
+    /**
+     * 游记id。
+     */
+    @Schema(description = "游记id")
+    private String isCollect;
+
+    /**
+     * 是否原创。
+     */
+    @Schema(description = "是否原创")
+    private Integer isOriginal;
+
+    /**
+     * 游记标题。
+     */
+    @Schema(description = "游记标题")
+    private String projectTitle;
+
+    /**
+     * 游记点赞量。
+     */
+    @Schema(description = "游记点赞量")
+    private Integer likeCount;
+
+    /**
+     * 创作者id。
+     */
+    @Schema(description = "创作者id")
+    private String createdId;
+
+    /**
+     * 创作者昵称。
+     */
+    @Schema(description = "创作者昵称")
+    private String createdShowName;
+
+    /**
+     * 创作者头像
+     */
+    @Schema(description = "创作者头像")
+    private String createdHeadImageUrl;
+
+
+}

+ 55 - 0
application-webadmin/src/main/java/com/tourism/webadmin/app/website/vo/TourTravelNotesTopicSearchVo.java

@@ -0,0 +1,55 @@
+package com.tourism.webadmin.app.website.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * TourTravelNotesTopicSearchVo视图对象。
+ *
+ * @author 陈
+ * @date 2024/01/24
+ */
+@Schema(description = "TourTravelNotesTopicSearchVo视图对象")
+@Data
+public class TourTravelNotesTopicSearchVo {
+
+    /**
+     * 是否收藏。
+     */
+    @Schema(description = "是否收藏(0.未收藏;1.已收藏")
+    private Integer isCollect;
+
+    /**
+     * 话题名称。
+     */
+    @Schema(description = "话题名称")
+    private String name;
+
+    /**
+     * 话题浏览量。
+     */
+    @Schema(description = "话题浏览量")
+    private String viewCount;
+
+    /**
+     * 话题讨论量。
+     */
+    @Schema(description = "话题讨论量")
+    private String commentCount;
+
+    /**
+     * 话题帖子数量。
+     */
+    @Schema(description = "话题帖子数量")
+    private String travelNotesCount;
+
+    /**
+     * 游记列表
+     */
+    @Schema(description = "游记列表")
+    private List<TourTravelNotesTopicNotesSearchVo> tourTravelNotesTopicNotesSearchVoList;
+
+
+}

+ 179 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/controller/TourUserLikeTopicController.java

@@ -0,0 +1,179 @@
+package com.tourism.webadmin.back.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import com.tourism.common.log.annotation.OperationLog;
+import com.tourism.common.log.model.constant.SysOperationLogType;
+import com.github.pagehelper.page.PageMethod;
+import com.tourism.webadmin.back.vo.*;
+import com.tourism.webadmin.back.dto.*;
+import com.tourism.webadmin.back.model.*;
+import com.tourism.webadmin.back.service.*;
+import com.tourism.common.core.object.*;
+import com.tourism.common.core.util.*;
+import com.tourism.common.core.constant.*;
+import com.tourism.common.core.annotation.MyRequestBody;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
+
+/**
+ * 用户与话题的关联表操作控制器类。
+ *
+ * @author 吃饭睡觉
+ * @date 2024-09-06
+ */
+@Tag(name = "用户与话题的关联表管理接口")
+@Slf4j
+@RestController
+@RequestMapping("/admin/app/tourUserLikeTopic")
+public class TourUserLikeTopicController {
+
+    @Autowired
+    private TourUserLikeTopicService tourUserLikeTopicService;
+
+    /**
+     * 新增用户与话题的关联表数据。
+     *
+     * @param tourUserLikeTopicDto 新增对象。
+     * @return 应答结果对象,包含新增对象主键Id。
+     */
+    @ApiOperationSupport(ignoreParameters = {"tourUserLikeTopicDto.id"})
+    @SaCheckPermission("tourUserLikeTopic.add")
+    @OperationLog(type = SysOperationLogType.ADD)
+    @PostMapping("/add")
+    public ResponseResult<Long> add(@MyRequestBody TourUserLikeTopicDto tourUserLikeTopicDto) {
+        String errorMessage = MyCommonUtil.getModelValidationError(tourUserLikeTopicDto, false);
+        if (errorMessage != null) {
+            return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
+        }
+        TourUserLikeTopic tourUserLikeTopic = MyModelUtil.copyTo(tourUserLikeTopicDto, TourUserLikeTopic.class);
+        tourUserLikeTopic = tourUserLikeTopicService.saveNew(tourUserLikeTopic);
+        return ResponseResult.success(tourUserLikeTopic.getId());
+    }
+
+    /**
+     * 更新用户与话题的关联表数据。
+     *
+     * @param tourUserLikeTopicDto 更新对象。
+     * @return 应答结果对象。
+     */
+    @SaCheckPermission("tourUserLikeTopic.update")
+    @OperationLog(type = SysOperationLogType.UPDATE)
+    @PostMapping("/update")
+    public ResponseResult<Void> update(@MyRequestBody TourUserLikeTopicDto tourUserLikeTopicDto) {
+        String errorMessage = MyCommonUtil.getModelValidationError(tourUserLikeTopicDto, true);
+        if (errorMessage != null) {
+            return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
+        }
+        TourUserLikeTopic tourUserLikeTopic = MyModelUtil.copyTo(tourUserLikeTopicDto, TourUserLikeTopic.class);
+        TourUserLikeTopic originalTourUserLikeTopic = tourUserLikeTopicService.getById(tourUserLikeTopic.getId());
+        if (originalTourUserLikeTopic == null) {
+            // NOTE: 修改下面方括号中的话述
+            errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
+            return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
+        }
+        if (!tourUserLikeTopicService.update(tourUserLikeTopic, originalTourUserLikeTopic)) {
+            return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
+        }
+        return ResponseResult.success();
+    }
+
+    /**
+     * 删除用户与话题的关联表数据。
+     *
+     * @param id 删除对象主键Id。
+     * @return 应答结果对象。
+     */
+    @SaCheckPermission("tourUserLikeTopic.delete")
+    @OperationLog(type = SysOperationLogType.DELETE)
+    @PostMapping("/delete")
+    public ResponseResult<Void> delete(@MyRequestBody Long id) {
+        if (MyCommonUtil.existBlankArgument(id)) {
+            return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
+        }
+        return this.doDelete(id);
+    }
+
+    /**
+     * 批量删除用户与话题的关联表数据。
+     *
+     * @param idList 待删除对象的主键Id列表。
+     * @return 应答结果对象。
+     */
+    @SaCheckPermission("tourUserLikeTopic.delete")
+    @OperationLog(type = SysOperationLogType.DELETE_BATCH)
+    @PostMapping("/deleteBatch")
+    public ResponseResult<Void> deleteBatch(@MyRequestBody List<Long> idList) {
+        if (MyCommonUtil.existBlankArgument(idList)) {
+            return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
+        }
+        for (Long id : idList) {
+            ResponseResult<Void> responseResult = this.doDelete(id);
+            if (!responseResult.isSuccess()) {
+                return responseResult;
+            }
+        }
+        return ResponseResult.success();
+    }
+
+    /**
+     * 列出符合过滤条件的用户与话题的关联表列表。
+     *
+     * @param tourUserLikeTopicDtoFilter 过滤对象。
+     * @param orderParam 排序参数。
+     * @param pageParam 分页参数。
+     * @return 应答结果对象,包含查询结果集。
+     */
+    @SaCheckPermission("tourUserLikeTopic.view")
+    @PostMapping("/list")
+    public ResponseResult<MyPageData<TourUserLikeTopicVo>> list(
+            @MyRequestBody TourUserLikeTopicDto tourUserLikeTopicDtoFilter,
+            @MyRequestBody MyOrderParam orderParam,
+            @MyRequestBody MyPageParam pageParam) {
+        if (pageParam != null) {
+            PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize(), pageParam.getCount());
+        }
+        TourUserLikeTopic tourUserLikeTopicFilter = MyModelUtil.copyTo(tourUserLikeTopicDtoFilter, TourUserLikeTopic.class);
+        String orderBy = MyOrderParam.buildOrderBy(orderParam, TourUserLikeTopic.class);
+        List<TourUserLikeTopic> tourUserLikeTopicList =
+                tourUserLikeTopicService.getTourUserLikeTopicListWithRelation(tourUserLikeTopicFilter, orderBy);
+        return ResponseResult.success(MyPageUtil.makeResponseData(tourUserLikeTopicList, TourUserLikeTopicVo.class));
+    }
+
+    /**
+     * 查看指定用户与话题的关联表对象详情。
+     *
+     * @param id 指定对象主键Id。
+     * @return 应答结果对象,包含对象详情。
+     */
+    @SaCheckPermission("tourUserLikeTopic.view")
+    @GetMapping("/view")
+    public ResponseResult<TourUserLikeTopicVo> view(@RequestParam Long id) {
+        TourUserLikeTopic tourUserLikeTopic = tourUserLikeTopicService.getByIdWithRelation(id, MyRelationParam.full());
+        if (tourUserLikeTopic == null) {
+            return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
+        }
+        TourUserLikeTopicVo tourUserLikeTopicVo = MyModelUtil.copyTo(tourUserLikeTopic, TourUserLikeTopicVo.class);
+        return ResponseResult.success(tourUserLikeTopicVo);
+    }
+
+    private ResponseResult<Void> doDelete(Long id) {
+        String errorMessage;
+        // 验证关联Id的数据合法性
+        TourUserLikeTopic originalTourUserLikeTopic = tourUserLikeTopicService.getById(id);
+        if (originalTourUserLikeTopic == null) {
+            // NOTE: 修改下面方括号中的话述
+            errorMessage = "数据验证失败,当前 [对象] 并不存在,请刷新后重试!";
+            return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
+        }
+        if (!tourUserLikeTopicService.remove(id)) {
+            errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
+            return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
+        }
+        return ResponseResult.success();
+    }
+}

+ 33 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/dao/TourUserLikeTopicMapper.java

@@ -0,0 +1,33 @@
+package com.tourism.webadmin.back.dao;
+
+import com.tourism.common.core.base.dao.BaseDaoMapper;
+import com.tourism.webadmin.back.model.TourUserLikeTopic;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.*;
+
+/**
+ * 用户与话题的关联表数据操作访问接口。
+ *
+ * @author 吃饭睡觉
+ * @date 2024-09-06
+ */
+public interface TourUserLikeTopicMapper extends BaseDaoMapper<TourUserLikeTopic> {
+
+    /**
+     * 批量插入对象列表。
+     *
+     * @param tourUserLikeTopicList 新增对象列表。
+     */
+    void insertList(List<TourUserLikeTopic> tourUserLikeTopicList);
+
+    /**
+     * 获取过滤后的对象列表。
+     *
+     * @param tourUserLikeTopicFilter 主表过滤对象。
+     * @param orderBy 排序字符串,order by从句的参数。
+     * @return 对象列表。
+     */
+    List<TourUserLikeTopic> getTourUserLikeTopicList(
+            @Param("tourUserLikeTopicFilter") TourUserLikeTopic tourUserLikeTopicFilter, @Param("orderBy") String orderBy);
+}

+ 56 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/dao/mapper/TourUserLikeTopicMapper.xml

@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.tourism.webadmin.back.dao.TourUserLikeTopicMapper">
+    <resultMap id="BaseResultMap" type="com.tourism.webadmin.back.model.TourUserLikeTopic">
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="tour_user_id" jdbcType="BIGINT" property="tourUserId"/>
+        <result column="tour_travel_notes_topic_id" jdbcType="BIGINT" property="tourTravelNotesTopicId"/>
+        <result column="tour_travel_notes_topic_name" jdbcType="VARCHAR" property="tourTravelNotesTopicName"/>
+    </resultMap>
+
+    <insert id="insertList">
+        INSERT INTO tour_user_like_topic
+            (id,
+            tour_user_id,
+            tour_travel_notes_topic_id,
+            tour_travel_notes_topic_name)
+        VALUES
+        <foreach collection="list" index="index" item="item" separator="," >
+            (#{item.id},
+            #{item.tourUserId},
+            #{item.tourTravelNotesTopicId},
+            #{item.tourTravelNotesTopicName})
+        </foreach>
+    </insert>
+
+    <!-- 如果有逻辑删除字段过滤,请写到这里 -->
+    <sql id="filterRef">
+        <!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
+        <include refid="com.tourism.webadmin.back.dao.TourUserLikeTopicMapper.inputFilterRef"/>
+    </sql>
+
+    <!-- 这里仅包含调用接口输入的主表过滤条件 -->
+    <sql id="inputFilterRef">
+        <if test="tourUserLikeTopicFilter != null">
+            <if test="tourUserLikeTopicFilter.tourUserId != null">
+                AND tour_user_like_topic.tour_user_id = #{tourUserLikeTopicFilter.tourUserId}
+            </if>
+            <if test="tourUserLikeTopicFilter.tourTravelNotesTopicId != null">
+                AND tour_user_like_topic.tour_travel_notes_topic_id = #{tourUserLikeTopicFilter.tourTravelNotesTopicId}
+            </if>
+            <if test="tourUserLikeTopicFilter.tourTravelNotesTopicName != null and tourUserLikeTopicFilter.tourTravelNotesTopicName != ''">
+                AND tour_user_like_topic.tour_travel_notes_topic_name = #{tourUserLikeTopicFilter.tourTravelNotesTopicName}
+            </if>
+        </if>
+    </sql>
+
+    <select id="getTourUserLikeTopicList" resultMap="BaseResultMap" parameterType="com.tourism.webadmin.back.model.TourUserLikeTopic">
+        SELECT * FROM tour_user_like_topic
+        <where>
+            <include refid="filterRef"/>
+        </where>
+        <if test="orderBy != null and orderBy != ''">
+            ORDER BY ${orderBy}
+        </if>
+    </select>
+</mapper>

+ 47 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/dto/TourUserLikeTopicDto.java

@@ -0,0 +1,47 @@
+package com.tourism.webadmin.back.dto;
+
+import com.tourism.common.core.validator.UpdateGroup;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import jakarta.validation.constraints.*;
+
+/**
+ * 用户与话题的关联表Dto对象。
+ *
+ * @author 吃饭睡觉
+ * @date 2024-09-06
+ */
+@Schema(description = "用户与话题的关联表Dto对象")
+@Data
+public class TourUserLikeTopicDto {
+
+    /**
+     * 主键id。
+     */
+    @Schema(description = "主键id。", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "数据验证失败,主键id不能为空!", groups = {UpdateGroup.class})
+    private Long id;
+
+    /**
+     * 门户用户id。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "门户用户id。可支持等于操作符的列表数据过滤。")
+    private Long tourUserId;
+
+    /**
+     * 游记话题id。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "游记话题id。可支持等于操作符的列表数据过滤。")
+    private Long tourTravelNotesTopicId;
+
+    /**
+     * 游记话题名称。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "游记话题名称。可支持等于操作符的列表数据过滤。")
+    private String tourTravelNotesTopicName;
+}

+ 39 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourUserLikeTopic.java

@@ -0,0 +1,39 @@
+package com.tourism.webadmin.back.model;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+
+/**
+ * 用户与话题的关联表实体对象。
+ *
+ * @author 吃饭睡觉
+ * @date 2024-09-06
+ */
+@Data
+@TableName(value = "tour_user_like_topic")
+public class TourUserLikeTopic {
+
+    /**
+     * 主键id。
+     */
+    @TableId(value = "id")
+    private Long id;
+
+    /**
+     * 门户用户id。
+     */
+    @TableField(value = "tour_user_id")
+    private Long tourUserId;
+
+    /**
+     * 游记话题id。
+     */
+    @TableField(value = "tour_travel_notes_topic_id")
+    private Long tourTravelNotesTopicId;
+
+    /**
+     * 游记话题名称。
+     */
+    @TableField(value = "tour_travel_notes_topic_name")
+    private String tourTravelNotesTopicName;
+}

+ 68 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/service/TourUserLikeTopicService.java

@@ -0,0 +1,68 @@
+package com.tourism.webadmin.back.service;
+
+import com.tourism.webadmin.back.model.*;
+import com.tourism.common.core.base.service.IBaseService;
+
+import java.util.*;
+
+/**
+ * 用户与话题的关联表数据操作服务接口。
+ *
+ * @author 吃饭睡觉
+ * @date 2024-09-06
+ */
+public interface TourUserLikeTopicService extends IBaseService<TourUserLikeTopic, Long> {
+
+    /**
+     * 保存新增对象。
+     *
+     * @param tourUserLikeTopic 新增对象。
+     * @return 返回新增对象。
+     */
+    TourUserLikeTopic saveNew(TourUserLikeTopic tourUserLikeTopic);
+
+    /**
+     * 利用数据库的insertList语法,批量插入对象列表。
+     *
+     * @param tourUserLikeTopicList 新增对象列表。
+     */
+    void saveNewBatch(List<TourUserLikeTopic> tourUserLikeTopicList);
+
+    /**
+     * 更新数据对象。
+     *
+     * @param tourUserLikeTopic         更新的对象。
+     * @param originalTourUserLikeTopic 原有数据对象。
+     * @return 成功返回true,否则false。
+     */
+    boolean update(TourUserLikeTopic tourUserLikeTopic, TourUserLikeTopic originalTourUserLikeTopic);
+
+    /**
+     * 删除指定数据。
+     *
+     * @param id 主键Id。
+     * @return 成功返回true,否则false。
+     */
+    boolean remove(Long id);
+
+    /**
+     * 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
+     * 如果需要同时获取关联数据,请移步(getTourUserLikeTopicListWithRelation)方法。
+     *
+     * @param filter  过滤对象。
+     * @param orderBy 排序参数。
+     * @return 查询结果集。
+     */
+    List<TourUserLikeTopic> getTourUserLikeTopicList(TourUserLikeTopic filter, String orderBy);
+
+    /**
+     * 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
+     * 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
+     * 如果仅仅需要获取主表数据,请移步(getTourUserLikeTopicList),以便获取更好的查询性能。
+     *
+     * @param filter 主表过滤对象。
+     * @param orderBy 排序参数。
+     * @return 查询结果集。
+     */
+    List<TourUserLikeTopic> getTourUserLikeTopicListWithRelation(TourUserLikeTopic filter, String orderBy);
+}

+ 100 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/TourUserLikeTopicServiceImpl.java

@@ -0,0 +1,100 @@
+package com.tourism.webadmin.back.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.tourism.webadmin.back.service.*;
+import com.tourism.webadmin.back.dao.*;
+import com.tourism.webadmin.back.model.*;
+import com.tourism.webadmin.config.DataSourceType;
+import com.tourism.common.core.annotation.MyDataSource;
+import com.tourism.common.core.base.dao.BaseDaoMapper;
+import com.tourism.common.core.object.MyRelationParam;
+import com.tourism.common.core.base.service.BaseService;
+import com.tourism.common.core.util.MyModelUtil;
+import com.tourism.common.sequence.wrapper.IdGeneratorWrapper;
+import com.github.pagehelper.Page;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+
+/**
+ * 用户与话题的关联表数据操作服务类。
+ *
+ * @author 吃饭睡觉
+ * @date 2024-09-06
+ */
+@Slf4j
+@Service("tourUserLikeTopicService")
+public class TourUserLikeTopicServiceImpl extends BaseService<TourUserLikeTopic, Long> implements TourUserLikeTopicService {
+
+    @Autowired
+    private IdGeneratorWrapper idGenerator;
+    @Autowired
+    private TourUserLikeTopicMapper tourUserLikeTopicMapper;
+
+    /**
+     * 返回当前Service的主表Mapper对象。
+     *
+     * @return 主表Mapper对象。
+     */
+    @Override
+    protected BaseDaoMapper<TourUserLikeTopic> mapper() {
+        return tourUserLikeTopicMapper;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public TourUserLikeTopic saveNew(TourUserLikeTopic tourUserLikeTopic) {
+        tourUserLikeTopicMapper.insert(this.buildDefaultValue(tourUserLikeTopic));
+        return tourUserLikeTopic;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void saveNewBatch(List<TourUserLikeTopic> tourUserLikeTopicList) {
+        if (CollUtil.isNotEmpty(tourUserLikeTopicList)) {
+            tourUserLikeTopicList.forEach(this::buildDefaultValue);
+            tourUserLikeTopicMapper.insertList(tourUserLikeTopicList);
+        }
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public boolean update(TourUserLikeTopic tourUserLikeTopic, TourUserLikeTopic originalTourUserLikeTopic) {
+        // 这里重点提示,在执行主表数据更新之前,如果有哪些字段不支持修改操作,请用原有数据对象字段替换当前数据字段。
+        UpdateWrapper<TourUserLikeTopic> uw = this.createUpdateQueryForNullValue(tourUserLikeTopic, tourUserLikeTopic.getId());
+        return tourUserLikeTopicMapper.update(tourUserLikeTopic, uw) == 1;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public boolean remove(Long id) {
+        return tourUserLikeTopicMapper.deleteById(id) == 1;
+    }
+
+    @Override
+    public List<TourUserLikeTopic> getTourUserLikeTopicList(TourUserLikeTopic filter, String orderBy) {
+        return tourUserLikeTopicMapper.getTourUserLikeTopicList(filter, orderBy);
+    }
+
+    @Override
+    public List<TourUserLikeTopic> getTourUserLikeTopicListWithRelation(TourUserLikeTopic filter, String orderBy) {
+        List<TourUserLikeTopic> resultList = tourUserLikeTopicMapper.getTourUserLikeTopicList(filter, orderBy);
+        // 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
+        // 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
+        int batchSize = resultList instanceof Page ? 0 : 1000;
+        this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
+        return resultList;
+    }
+
+    private TourUserLikeTopic buildDefaultValue(TourUserLikeTopic tourUserLikeTopic) {
+        if (tourUserLikeTopic.getId() == null) {
+            tourUserLikeTopic.setId(idGenerator.nextLongId());
+        }
+        MyModelUtil.setDefaultValue(tourUserLikeTopic, "tourTravelNotesTopicName", "");
+        return tourUserLikeTopic;
+    }
+}

+ 1 - 1
application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourTravelNotesTopicVo.java

@@ -21,7 +21,7 @@ public class TourTravelNotesTopicVo extends BaseVo {
      * 主键id。
      */
     @Schema(description = "主键id")
-    private Long id;
+    private String id;
 
     /**
      * 话题名称。

+ 39 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourUserLikeTopicVo.java

@@ -0,0 +1,39 @@
+package com.tourism.webadmin.back.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * 用户与话题的关联表VO视图对象。
+ *
+ * @author 吃饭睡觉
+ * @date 2024-09-06
+ */
+@Schema(description = "用户与话题的关联表VO视图对象")
+@Data
+public class TourUserLikeTopicVo {
+
+    /**
+     * 主键id。
+     */
+    @Schema(description = "主键id")
+    private Long id;
+
+    /**
+     * 门户用户id。
+     */
+    @Schema(description = "门户用户id")
+    private Long tourUserId;
+
+    /**
+     * 游记话题id。
+     */
+    @Schema(description = "游记话题id")
+    private Long tourTravelNotesTopicId;
+
+    /**
+     * 游记话题名称。
+     */
+    @Schema(description = "游记话题名称")
+    private String tourTravelNotesTopicName;
+}