Files
lablesys_backend/src/main/java/com/labelsys/backend/controller/AnnotationResultArchiveController.java

50 lines
2.3 KiB
Java
Raw Normal View History

package com.labelsys.backend.controller;
2026-05-07 00:23:27 +08:00
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<PageResult<AnnotationResultHistoryResponse>> pageHistory(
2026-05-07 00:23:27 +08:00
@Valid AnnotationResultHistoryPageQuery query) {
return ResponseEntity.ok(annotationResultArchiveService.pageHistory(UserContext.requireUser(), query));
}
@Operation(summary = "查询归档历史详情")
@GetMapping("/{id}")
public ResponseEntity<AnnotationResultHistoryResponse> getHistory(
@Parameter(description = "历史记录ID", example = "901")
2026-05-07 00:23:27 +08:00
@PathVariable Long id) {
return ResponseEntity.ok(annotationResultArchiveService.getHistory(UserContext.requireUser(), id));
}
@Operation(summary = "加载归档文件内容")
@GetMapping("/{id}/content")
public ResponseEntity<FileContentResponse> loadFileContent(
@Parameter(description = "历史记录ID", example = "901")
@PathVariable Long id) {
return ResponseEntity.ok(annotationResultArchiveService.loadFileContent(UserContext.requireUser(), id));
}
}