package com.jjt.rz.controller;

import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
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.jjt.common.annotation.Log;
import com.jjt.common.core.controller.BaseController;
import com.jjt.common.core.domain.AjaxResult;
import com.jjt.common.enums.BusinessType;
import com.jjt.rz.domain.TwinCalcHourRz;
import com.jjt.rz.service.ITwinCalcHourRzService;
import com.jjt.common.utils.poi.ExcelUtil;
import com.jjt.common.core.page.TableDataInfo;

/**
 * 染整线小时工艺参数Controller
 *
 * @author wukai
 * @date 2025-06-03
 */
@Api(tags="染整线小时工艺参数")
@RestController
@RequestMapping("/rz/hour")
public class TwinCalcHourRzController extends BaseController{
    @Resource
    private ITwinCalcHourRzService twinCalcHourRzService;

    /**
     * 查询染整线小时工艺参数列表
     */
    @ApiOperation("查询染整线小时工艺参数列表")
    //@PreAuthorize("@ss.hasPermi('rz:hourData:list')")
    @GetMapping("/list")
    public TableDataInfo list(TwinCalcHourRz twinCalcHourRz)
    {
        startPage();
        List<TwinCalcHourRz> list = twinCalcHourRzService.selectTwinCalcHourRzList(twinCalcHourRz);
        return getDataTable(list);
    }

    /**
     * 导出染整线小时工艺参数列表
     */
    @ApiOperation("导出染整线小时工艺参数列表")
    //@PreAuthorize("@ss.hasPermi('rz:hourData:export')")
    @Log(title = "染整线小时工艺参数", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TwinCalcHourRz twinCalcHourRz)
    {
        List<TwinCalcHourRz> list = twinCalcHourRzService.selectTwinCalcHourRzList(twinCalcHourRz);
        ExcelUtil<TwinCalcHourRz> util = new ExcelUtil<TwinCalcHourRz>(TwinCalcHourRz.class);
        util.exportExcel(response, list, "染整线小时工艺参数数据");
    }

    /**
     * 获取染整线小时工艺参数详细信息
     */
    @ApiOperation("获取染整线小时工艺参数详细信息")
    //@PreAuthorize("@ss.hasPermi('rz:hourData:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(twinCalcHourRzService.selectTwinCalcHourRzById(id));
    }

    /**
     * 新增染整线小时工艺参数
     */
    @ApiOperation("新增染整线小时工艺参数")
    //@PreAuthorize("@ss.hasPermi('rz:hourData:add')")
    @Log(title = "染整线小时工艺参数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TwinCalcHourRz twinCalcHourRz)
    {
        return toAjax(twinCalcHourRzService.insertTwinCalcHourRz(twinCalcHourRz));
    }

    /**
     * 修改染整线小时工艺参数
     */
    @ApiOperation("修改染整线小时工艺参数")
    //@PreAuthorize("@ss.hasPermi('rz:hourData:edit')")
    @Log(title = "染整线小时工艺参数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TwinCalcHourRz twinCalcHourRz)
    {
        return toAjax(twinCalcHourRzService.updateTwinCalcHourRz(twinCalcHourRz));
    }

    /**
     * 删除染整线小时工艺参数
     */
    @ApiOperation("删除染整线小时工艺参数")
    //@PreAuthorize("@ss.hasPermi('rz:hourData:remove')")
    @Log(title = "染整线小时工艺参数", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(twinCalcHourRzService.deleteTwinCalcHourRzByIds(ids));
    }
}
