package com.mcwl.web.controller.resource;

import com.mcwl.common.core.domain.R;
import com.mcwl.resource.domain.WorkFlowVersion;
import com.mcwl.resource.service.WorkFlowVersionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;

/**
 * 工作流版本
 *
 * @author DaiZibo
 * @date 2025/1/14
 * @apiNote
 */
@Api(tags = "工作流版本")
@RequestMapping("/WorkFlowVersion")
@RestController
public class WorkFlowVersionController {

    @Autowired
    private WorkFlowVersionService workFlowVersionService;

    /**
     * 查询工作流下的所有版本信息
     *
     * @param workId
     * @return
     */
    @ApiOperation(value = "查询工作流下的所有版本信息")
    @GetMapping("/selectVersionByWorkId")
    public R<List<WorkFlowVersion>> selectVersionByWorkId(@RequestParam Long workId) {

        return workFlowVersionService.selectVersionByWorkId(workId);
    }

    /**
     * 下载工作流
     * @param id
     * @return
     */
    @ApiOperation("下载工作流")
    @GetMapping("/workFlowFileDownload")
    public R workFlowFileDownload(@RequestParam Long id){

        return workFlowVersionService.workFlowFileDownload(id);
    }

}
