package com.ruoyi.interfaces.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.interfaces.domain.MdModelStep;
import com.ruoyi.interfaces.service.MdModelStepService;
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")
public class MdModelStepController extends BaseController {

    @Autowired
    private MdModelStepService mdModelStepService;


    @ApiOperation(value = "新增/修改步骤表")
    @PostMapping("")
    public AjaxResult save(@ApiParam(name = "mdModelStep", value = "MdModelStep", required = true) @RequestBody MdModelStep mdModelStep) {
        return AjaxResult.success(mdModelStepService.saveOrUpdate(mdModelStep));
    }

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

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


}
