package com.zehong.web.controller.gasBottleTrack;

import java.util.List;
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.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TGasAbnormality;
import com.zehong.system.service.ITGasAbnormalityService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;

/**
 * 气瓶异常分析Controller
 * 
 * @author zehong
 * @date 2026-03-19
 */
@RestController
@RequestMapping("/gasBottleTrack/abnormality")
public class TGasAbnormalityController extends BaseController
{
    @Autowired
    private ITGasAbnormalityService tGasAbnormalityService;

    /**
     * 查询气瓶异常分析列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TGasAbnormality tGasAbnormality)
    {
        startPage();
        List<TGasAbnormality> list = tGasAbnormalityService.selectTGasAbnormalityList(tGasAbnormality);
        return getDataTable(list);
    }

    /**
     * 导出气瓶异常分析列表
     */
    @Log(title = "气瓶异常分析", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TGasAbnormality tGasAbnormality)
    {
        List<TGasAbnormality> list = tGasAbnormalityService.selectTGasAbnormalityList(tGasAbnormality);
        ExcelUtil<TGasAbnormality> util = new ExcelUtil<TGasAbnormality>(TGasAbnormality.class);
        return util.exportExcel(list, "气瓶异常分析数据");
    }

    /**
     * 获取气瓶异常分析详细信息
     */
    @GetMapping(value = "/{abnormalityId}")
    public AjaxResult getInfo(@PathVariable("abnormalityId") Long abnormalityId)
    {
        return AjaxResult.success(tGasAbnormalityService.selectTGasAbnormalityById(abnormalityId));
    }

    /**
     * 新增气瓶异常分析
     */
    @Log(title = "气瓶异常分析", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TGasAbnormality tGasAbnormality)
    {
        return toAjax(tGasAbnormalityService.insertTGasAbnormality(tGasAbnormality));
    }

    /**
     * 修改气瓶异常分析
     */
    @Log(title = "气瓶异常分析", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TGasAbnormality tGasAbnormality)
    {
        return toAjax(tGasAbnormalityService.updateTGasAbnormality(tGasAbnormality));
    }

    /**
     * 删除气瓶异常分析
     */
    @Log(title = "气瓶异常分析", businessType = BusinessType.DELETE)
	@DeleteMapping("/{abnormalityIds}")
    public AjaxResult remove(@PathVariable Long[] abnormalityIds)
    {
        return toAjax(tGasAbnormalityService.deleteTGasAbnormalityByIds(abnormalityIds));
    }
}
