package com.fizz.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.fizz.business.domain.SetupFurTemp;
import com.fizz.business.service.ISetupFurTempService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 炉火段工艺参数Controller
 * 
 * @author ruoyi
 * @date 2025-09-29
 */
@RestController
@RequestMapping("/business/fur")
public class SetupFurTempController extends BaseController
{
    @Autowired
    private ISetupFurTempService setupFurTempService;

    /**
     * 查询炉火段工艺参数列表
     */
    @PreAuthorize("@ss.hasPermi('business:fur:list')")
    @GetMapping("/list")
    public TableDataInfo list(SetupFurTemp setupFurTemp)
    {
        startPage();
        List<SetupFurTemp> list = setupFurTempService.selectSetupFurTempList(setupFurTemp);
        return getDataTable(list);
    }

    /**
     * 导出炉火段工艺参数列表
     */
    @PreAuthorize("@ss.hasPermi('business:fur:export')")
    @Log(title = "炉火段工艺参数", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SetupFurTemp setupFurTemp)
    {
        List<SetupFurTemp> list = setupFurTempService.selectSetupFurTempList(setupFurTemp);
        ExcelUtil<SetupFurTemp> util = new ExcelUtil<SetupFurTemp>(SetupFurTemp.class);
        util.exportExcel(response, list, "炉火段工艺参数数据");
    }

    /**
     * 获取炉火段工艺参数详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:fur:query')")
    @GetMapping(value = "/{steelGrade}")
    public AjaxResult getInfo(@PathVariable("steelGrade") String steelGrade)
    {
        return success(setupFurTempService.selectSetupFurTempBySteelGrade(steelGrade));
    }

    /**
     * 新增炉火段工艺参数
     */
    @PreAuthorize("@ss.hasPermi('business:fur:add')")
    @Log(title = "炉火段工艺参数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SetupFurTemp setupFurTemp)
    {
        return toAjax(setupFurTempService.insertSetupFurTemp(setupFurTemp));
    }

    /**
     * 修改炉火段工艺参数
     */
    @PreAuthorize("@ss.hasPermi('business:fur:edit')")
    @Log(title = "炉火段工艺参数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SetupFurTemp setupFurTemp)
    {
        return toAjax(setupFurTempService.updateSetupFurTemp(setupFurTemp));
    }

    /**
     * 删除炉火段工艺参数
     */
    @PreAuthorize("@ss.hasPermi('business:fur:remove')")
    @Log(title = "炉火段工艺参数", businessType = BusinessType.DELETE)
	@DeleteMapping("/{steelGrades}")
    public AjaxResult remove(@PathVariable String[] steelGrades)
    {
        return toAjax(setupFurTempService.deleteSetupFurTempBySteelGrades(steelGrades));
    }
}
