package org.dromara.ems.base.controller;

import org.dromara.common.log.annotation.Log;
import org.dromara.ems.common.web.EmsBaseController;
import org.dromara.common.core.domain.R;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.ems.base.domain.EmsAlarmActionStepImage;
import org.dromara.ems.base.service.IEmsAlarmActionStepImageService;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 报警措施步骤图片Controller
 * 
 * @author zch
 * @date 2025-05-29
 */
@RestController
@RequiredArgsConstructor

@RequestMapping("/ems/base/emsAlarmActionStepImage")
public class EmsAlarmActionStepImageController extends EmsBaseController
{
    
    private final IEmsAlarmActionStepImageService emsAlarmActionStepImageService;

    /**
     * 查询报警措施步骤图片列表
     */
    @SaCheckPermission("ems/base:emsAlarmActionStepImage:list")
    @GetMapping("/list")
    public TableDataInfo list(EmsAlarmActionStepImage emsAlarmActionStepImage)
    {
        startPage();
        List<EmsAlarmActionStepImage> list = emsAlarmActionStepImageService.selectEmsAlarmActionStepImageList(emsAlarmActionStepImage);
        return getDataTable(list);
    }

    /**
     * 导出报警措施步骤图片列表
     */
    @SaCheckPermission("ems/base:emsAlarmActionStepImage:export")
    @Log(title = "报警措施步骤图片", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EmsAlarmActionStepImage emsAlarmActionStepImage)
    {
        List<EmsAlarmActionStepImage> list = emsAlarmActionStepImageService.selectEmsAlarmActionStepImageList(emsAlarmActionStepImage);
        ExcelUtil.exportExcel(list, "报警措施步骤图片数据", EmsAlarmActionStepImage.class, response);
    }

    /**
     * 获取报警措施步骤图片详细信息
     */
    @SaCheckPermission("ems/base:emsAlarmActionStepImage:query")
    @GetMapping(value = "/{objId}")
    public R<?> getInfo(@PathVariable("objId") String objId)
    {
        return success(emsAlarmActionStepImageService.selectEmsAlarmActionStepImageByObjId(objId));
    }

    /**
     * 新增报警措施步骤图片
     */
    @SaCheckPermission("ems/base:emsAlarmActionStepImage:add")
    @Log(title = "报警措施步骤图片", businessType = BusinessType.INSERT)
    @PostMapping
    public R<?> add(@RequestBody EmsAlarmActionStepImage emsAlarmActionStepImage)
    {
        return toAjax(emsAlarmActionStepImageService.insertEmsAlarmActionStepImage(emsAlarmActionStepImage));
    }

    /**
     * 修改报警措施步骤图片
     */
    @SaCheckPermission("ems/base:emsAlarmActionStepImage:edit")
    @Log(title = "报警措施步骤图片", businessType = BusinessType.UPDATE)
    @PutMapping
    public R<?> edit(@RequestBody EmsAlarmActionStepImage emsAlarmActionStepImage)
    {
        return toAjax(emsAlarmActionStepImageService.updateEmsAlarmActionStepImage(emsAlarmActionStepImage));
    }

    /**
     * 删除报警措施步骤图片
     */
    @SaCheckPermission("ems/base:emsAlarmActionStepImage:remove")
    @Log(title = "报警措施步骤图片", businessType = BusinessType.DELETE)
	@DeleteMapping("/{objIds}")
    public R<?> remove(@PathVariable String[] objIds)
    {
        return toAjax(emsAlarmActionStepImageService.deleteEmsAlarmActionStepImageByObjIds(objIds));
    }
}
