package com.example.fuzzControll.controller.dataController;

import com.example.fuzzControll.domain.bo.FuzzLogTransEntity;
import com.example.fuzzControll.service.FuzzLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/log")
@Slf4j
public class FuzzLogController {
    @Autowired
    FuzzLogService FuzzLogService;

    /**
     * 下载对应任务的日志;不同任务返回数据类型不同,需要做个表来区分
     */
    @RequestMapping(value = "/download/{missionId}", method = RequestMethod.GET)
    public List<FuzzLogTransEntity> getFuzzLog(@PathVariable("missionId") int missionId) throws IOException {
        try {
            return FuzzLogService.getFuzzLog(missionId);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}