package com.labelsys.backend.controller; import com.labelsys.backend.context.UserContext; import com.labelsys.backend.dto.common.PageResult; import com.labelsys.backend.dto.request.AnnotationResultHistoryPageQuery; import com.labelsys.backend.dto.response.AnnotationResultHistoryResponse; import com.labelsys.backend.dto.response.FileContentResponse; import com.labelsys.backend.service.AnnotationResultArchiveService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/api/annotation-result-history") @RequiredArgsConstructor @Tag(name = "标注结果归档管理", description = "标注结果归档历史查询接口") public class AnnotationResultArchiveController { private final AnnotationResultArchiveService annotationResultArchiveService; @Operation(summary = "分页查询归档历史") @GetMapping public ResponseEntity> pageHistory( @Valid AnnotationResultHistoryPageQuery query) { return ResponseEntity.ok(annotationResultArchiveService.pageHistory(UserContext.requireUser(), query)); } @Operation(summary = "查询归档历史详情") @GetMapping("/{id}") public ResponseEntity getHistory( @Parameter(description = "历史记录ID", example = "901") @PathVariable Long id) { return ResponseEntity.ok(annotationResultArchiveService.getHistory(UserContext.requireUser(), id)); } @Operation(summary = "加载归档文件内容") @GetMapping("/{id}/content") public ResponseEntity loadFileContent( @Parameter(description = "历史记录ID", example = "901") @PathVariable Long id) { return ResponseEntity.ok(annotationResultArchiveService.loadFileContent(UserContext.requireUser(), id)); } }