feat: 全量 Controller 接口中文注解补全完成
- 39 个 Controller 全部添加 @Tag/@Operation/@Parameter 中文注解(共 278 个 @Operation) - 分 3 批实施:Batch 1 AI+社区(7)、Batch 2 情绪+日记+互动(11)、Batch 3 其他(13) - 已有注解的 8 个 Controller 不重复修改 - 编译验证通过:mvn clean install -DskipTests — BUILD SUCCESS Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,9 @@ import com.emotion.dto.request.ConversationCreateRequest;
|
||||
import com.emotion.dto.request.ConversationPageRequest;
|
||||
import com.emotion.dto.response.ConversationResponse;
|
||||
import com.emotion.service.ConversationService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -15,12 +18,13 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 对话控制器
|
||||
*
|
||||
*
|
||||
* @author huazhongmin
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/conversation")
|
||||
@Tag(name = "会话管理", description = "AI 对话会话的查询、创建、更新、删除和状态管理接口")
|
||||
public class ConversationController {
|
||||
|
||||
@Autowired
|
||||
@@ -29,6 +33,7 @@ public class ConversationController {
|
||||
/**
|
||||
* 分页查询对话
|
||||
*/
|
||||
@Operation(summary = "分页查询会话", description = "分页查询当前用户的对话会话列表。")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<PageResult<ConversationResponse>> getPage(@Valid ConversationPageRequest request) {
|
||||
PageResult<ConversationResponse> pageResult = conversationService.getPageWithResponse(request);
|
||||
@@ -38,8 +43,9 @@ public class ConversationController {
|
||||
/**
|
||||
* 根据ID获取对话
|
||||
*/
|
||||
@Operation(summary = "获取会话详情", description = "根据 ID 获取会话的详细信息。")
|
||||
@GetMapping(value = "/detail")
|
||||
public Result<ConversationResponse> getById(@RequestParam String id) {
|
||||
public Result<ConversationResponse> getById(@Parameter(description = "会话 ID") @RequestParam String id) {
|
||||
ConversationResponse response = conversationService.getConversationResponseById(id);
|
||||
if (response == null) {
|
||||
return Result.notFound("对话不存在");
|
||||
@@ -50,6 +56,7 @@ public class ConversationController {
|
||||
/**
|
||||
* 创建对话
|
||||
*/
|
||||
@Operation(summary = "创建会话", description = "创建一个新的 AI 对话会话。")
|
||||
@PostMapping(value = "/create")
|
||||
public Result<ConversationResponse> create(@Valid @RequestBody ConversationCreateRequest request,
|
||||
HttpServletRequest httpRequest) {
|
||||
@@ -60,6 +67,7 @@ public class ConversationController {
|
||||
/**
|
||||
* 更新对话
|
||||
*/
|
||||
@Operation(summary = "更新会话", description = "修改已有会话的标题等属性。")
|
||||
@PutMapping(value = "/update")
|
||||
public Result<ConversationResponse> update(@RequestBody ConversationCreateRequest request) {
|
||||
ConversationResponse response = conversationService.updateConversationWithResponse(request);
|
||||
@@ -69,8 +77,9 @@ public class ConversationController {
|
||||
/**
|
||||
* 删除对话
|
||||
*/
|
||||
@Operation(summary = "删除会话", description = "删除指定的对话会话。")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<Void> delete(@RequestParam String id) {
|
||||
public Result<Void> delete(@Parameter(description = "会话 ID") @RequestParam String id) {
|
||||
boolean deleted = conversationService.removeById(id);
|
||||
if (!deleted) {
|
||||
return Result.error("删除失败");
|
||||
@@ -81,6 +90,7 @@ public class ConversationController {
|
||||
/**
|
||||
* 获取活跃对话
|
||||
*/
|
||||
@Operation(summary = "获取活跃会话", description = "获取当前用户最近的活跃会话列表。")
|
||||
@GetMapping(value = "/active")
|
||||
public Result<List<ConversationResponse>> getActiveConversations() {
|
||||
List<ConversationResponse> responses = conversationService.getActiveConversationsWithResponse();
|
||||
@@ -90,6 +100,7 @@ public class ConversationController {
|
||||
/**
|
||||
* 获取归档对话
|
||||
*/
|
||||
@Operation(summary = "获取归档会话", description = "获取当前用户已归档的会话列表。")
|
||||
@GetMapping(value = "/archived")
|
||||
public Result<List<ConversationResponse>> getArchivedConversations() {
|
||||
List<ConversationResponse> responses = conversationService.getArchivedConversationsWithResponse();
|
||||
@@ -99,9 +110,10 @@ public class ConversationController {
|
||||
/**
|
||||
* 更新对话状态
|
||||
*/
|
||||
@Operation(summary = "获取会话状态", description = "获取指定会话的当前状态信息。")
|
||||
@PutMapping(value = "/status")
|
||||
public Result<Void> updateConversationStatus(
|
||||
@RequestParam String id,
|
||||
@Parameter(description = "会话 ID") @RequestParam String id,
|
||||
@RequestParam String status) {
|
||||
boolean updated = conversationService.updateConversationStatus(id, status);
|
||||
if (!updated) {
|
||||
@@ -109,4 +121,4 @@ public class ConversationController {
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user