package com.ruoyi.interfaces.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.interfaces.domain.MdModelStepExecution;
import com.ruoyi.interfaces.service.MdModelStepExecutionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author lql
 * @date 2025-7-15
 */
@Api(value = "步骤执行记录", tags = "步骤执行记录")
@RestController
@RequestMapping("/model/step/execution")
public class MdModelStepExecutionController extends BaseController {

    @Autowired
    private MdModelStepExecutionService mdModelStepExecutionService;


    @ApiOperation(value = "新增/修改步骤执行记录")
    @PostMapping("")
    public AjaxResult save(@ApiParam(name = "mdModelStepExecution", value = "MdModelStepExecution", required = true) @RequestBody MdModelStepExecution mdModelStepExecution) {
        return AjaxResult.success(mdModelStepExecutionService.saveOrUpdate(mdModelStepExecution));
    }

    @ApiOperation(value = "根据ID删除步骤执行记录")
    @DeleteMapping(value = "/{id}")
    public AjaxResult delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
        return AjaxResult.success(mdModelStepExecutionService.removeById(id));
    }

    @ApiOperation(value = "根据ID获取步骤执行记录（单表）")
    @GetMapping("/{id}")
    public AjaxResult get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
        return AjaxResult.success(mdModelStepExecutionService.getById(id));
    }


}
