package com.cmvr.web.controller.test;

import com.cmvr.common.core.controller.BaseController;
import com.cmvr.common.core.page.TableDataInfo;
import com.cmvr.test.model.domain.TeNodeInst;
import com.cmvr.test.model.vo.TeQueryTaskInstVO;
import com.cmvr.test.model.vo.TeTaskInstVO;
import com.cmvr.test.service.ITeTaskInstService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "测试--任务实例")
@RestController
@RequestMapping("/test/inst")
@RequiredArgsConstructor
public class TeTaskInstController extends BaseController {

    private final ITeTaskInstService teTaskInstService;

    @ApiOperation("查询任务实例列表")
    @PreAuthorize("@ss.hasPermi('test:inst:list')")
    @GetMapping("/list")
    public TableDataInfo list(TeQueryTaskInstVO queryTaskInstVO) {
        startPage();
        List<TeTaskInstVO> list = teTaskInstService.selectTeTaskInstList(queryTaskInstVO);
        return getDataTable(list);
    }

    @ApiOperation("查询节点执行日志")
    @GetMapping("/log/detail")
    public TableDataInfo detail(@RequestParam String instId) {
        startPage();
        List<TeNodeInst> list = teTaskInstService.detail(instId);
        return getDataTable(list);
    }

}