feat(kv): 初始化 KV 服务模块
- 添加了笔记内容的增删查 DTO 类 - 配置了 Cassandra 数据库连接 - 实现了基于 Cassandra 的笔记内容存储与查询功能 feat(kv): 初始化 distributeID 服务模块 - 实现了分布式 ID 生成器服务(Snowflake与 Segment) - 添加了 ID 生成器监控接口 - 配置了 MyBatis 与数据库交互 - 添加了 Segment 与 Snowflake 服务实现 - 添加了 Leaf 相关模型类与分配器接口 - 添加了 Leaf 分配器实现类 - 添加了 Leaf 控制器与监控视图 - 添加了 Leaf 异常处理类 - 添加了 Leaf 日志配置文件 - 添加了 Leaf 启动类 - 添加了 Leaf 常量定义 - 添加了 Leaf ID 生成接口 - 添加了 Leaf 初始化异常类 - 添加了 Leaf 配置文件 - 添加了 Leaf 模型类 - 添加了 Leaf 服务类 - 添加了 Leaf 工具类 - 添加了 Leaf 相关注解 - 添加了 Leaf 相关配置类 - 添加了 Leaf 相关枚举类 - 添加了 Leaf 相关工具类 后续考虑复刻Leaf代码至Java21平台
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package com.hanserwei.hannote.kv.api;
|
||||
|
||||
import com.hanserwei.framework.common.response.Response;
|
||||
import com.hanserwei.hannote.kv.constant.ApiConstants;
|
||||
import com.hanserwei.hannote.kv.dto.req.AddNoteContentReqDTO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@FeignClient(name = ApiConstants.SERVICE_NAME)
|
||||
public interface KeyValueFeignApi {
|
||||
|
||||
String PREFIX = "/kv";
|
||||
|
||||
@PostMapping(value = PREFIX + "/note/content/add")
|
||||
Response<?> addNoteContent(@RequestBody AddNoteContentReqDTO addNoteContentReqDTO);
|
||||
|
||||
@PostMapping(value = PREFIX + "/note/content/find")
|
||||
Response<?> findNoteContent(@RequestBody AddNoteContentReqDTO addNoteContentReqDTO);
|
||||
|
||||
@PostMapping(value = PREFIX + "/note/content/delete")
|
||||
Response<?> deleteNoteContent(@RequestBody AddNoteContentReqDTO addNoteContentReqDTO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.hanserwei.hannote.kv.constant;
|
||||
|
||||
public interface ApiConstants {
|
||||
|
||||
/**
|
||||
* 服务名称
|
||||
*/
|
||||
String SERVICE_NAME = "han-note-kv";
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.hanserwei.hannote.kv.dto.req;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class AddNoteContentReqDTO {
|
||||
|
||||
@NotNull(message = "笔记 ID 不能为空")
|
||||
private Long noteId;
|
||||
|
||||
@NotBlank(message = "笔记内容不能为空")
|
||||
private String content;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
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 DeleteNoteContentReqDTO {
|
||||
|
||||
@NotBlank(message = "笔记 ID 不能为空")
|
||||
private String noteId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
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 FindNoteContentReqDTO {
|
||||
|
||||
@NotBlank(message = "笔记 ID 不能为空")
|
||||
private String noteId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.hanserwei.hannote.kv.dto.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class FindNoteContentRspDTO {
|
||||
|
||||
/**
|
||||
* 笔记 ID
|
||||
*/
|
||||
private UUID noteId;
|
||||
|
||||
/**
|
||||
* 笔记内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user