feat(kv): 新增批量查询评论内容功能
- 新增 BatchFindCommentContentReqDTO 用于批量查询请求参数校验 - 新增 FindCommentContentReqDTO 和 FindCommentContentRspDTO 用于查询参数与响应封装 - 在 CommentContentController 中添加 /comment/content/batchFind 接口 - 实现 CommentContentRepository 的批量查询方法 - 在 CommentContentServiceImpl 中完成批量查询逻辑,包括参数解析与数据转换 - 更新 gateApi.http 添加批量查询接口测试用例
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.hanserwei.hannote.kv.dto.req;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class BatchFindCommentContentReqDTO {
|
||||
|
||||
/**
|
||||
* 笔记 ID
|
||||
*/
|
||||
@NotNull(message = "评论 ID 不能为空")
|
||||
private Long noteId;
|
||||
|
||||
@NotEmpty(message = "评论内容 Key 集合")
|
||||
@Valid // 指定集合中的 DTO 也需要进行参数校验
|
||||
private List<FindCommentContentReqDTO> commentContentKeys;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.hanserwei.hannote.kv.dto.req;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class FindCommentContentReqDTO {
|
||||
|
||||
@NotBlank(message = "发布年月不能为空")
|
||||
private String yearMonth;
|
||||
|
||||
@NotBlank(message = "评论正文 ID 不能为空")
|
||||
private String contentId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.hanserwei.hannote.kv.dto.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class FindCommentContentRspDTO {
|
||||
|
||||
/**
|
||||
* 评论内容 UUID
|
||||
*/
|
||||
private String contentId;
|
||||
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user