package com.ruoyi.ems.report.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.ruoyi.ems.report.domain.EmsReportPointSteam;
import com.ruoyi.ems.report.service.IEmsReportPointSteamService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 蒸汽整点数据Controller
 *
 * @author Yinq
 * @date 2024-06-11
 */
@RestController
@RequestMapping("/ems/report/reportPointSteam")
public class EmsReportPointSteamController extends BaseController {
    @Autowired
    private IEmsReportPointSteamService emsReportPointSteamService;

    /**
     * 查询蒸汽整点数据列表
     */
    @PreAuthorize("@ss.hasPermi('ems/report:reportPointSteam:list')")
    @GetMapping("/list")
    public TableDataInfo list(EmsReportPointSteam emsReportPointSteam) {
        startPage();
        List<EmsReportPointSteam> list = emsReportPointSteamService.selectEmsReportPointSteamList(emsReportPointSteam);
        return getDataTable(list);
    }

    /**
     * 导出蒸汽整点数据列表
     */
    @PreAuthorize("@ss.hasPermi('ems/report:reportPointSteam:export')")
    @Log(title = "蒸汽整点数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EmsReportPointSteam emsReportPointSteam) {
        List<EmsReportPointSteam> list = emsReportPointSteamService.selectEmsReportPointSteamList(emsReportPointSteam);
        ExcelUtil<EmsReportPointSteam> util = new ExcelUtil<EmsReportPointSteam>(EmsReportPointSteam.class);
        util.exportExcel(response, list, "蒸汽整点数据数据");
    }

    /**
     * 获取蒸汽整点数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('ems/report:reportPointSteam:query')")
    @GetMapping(value = "/{objId}")
    public AjaxResult getInfo(@PathVariable("objId") Long objId) {
        return success(emsReportPointSteamService.selectEmsReportPointSteamByObjId(objId));
    }

    /**
     * 新增蒸汽整点数据
     */
    @PreAuthorize("@ss.hasPermi('ems/report:reportPointSteam:add')")
    @Log(title = "蒸汽整点数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EmsReportPointSteam emsReportPointSteam) {
        emsReportPointSteam.setCreateBy(getUsername());
        return toAjax(emsReportPointSteamService.insertEmsReportPointSteam(emsReportPointSteam));
    }

    /**
     * 修改蒸汽整点数据
     */
    @PreAuthorize("@ss.hasPermi('ems/report:reportPointSteam:edit')")
    @Log(title = "蒸汽整点数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EmsReportPointSteam emsReportPointSteam) {
        emsReportPointSteam.setUpdateBy(getUsername());
        return toAjax(emsReportPointSteamService.updateEmsReportPointSteam(emsReportPointSteam));
    }

    /**
     * 删除蒸汽整点数据
     */
    @PreAuthorize("@ss.hasPermi('ems/report:reportPointSteam:remove')")
    @Log(title = "蒸汽整点数据", businessType = BusinessType.DELETE)
    @DeleteMapping("/{objIds}")
    public AjaxResult remove(@PathVariable Long[] objIds) {
        return toAjax(emsReportPointSteamService.deleteEmsReportPointSteamByObjIds(objIds));
    }
}
