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.TGasIllegal;
import com.zehong.system.service.ITGasIllegalService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;

/**
 * 违法行为档案Controller
 * 
 * @author zehong
 * @date 2026-03-19
 */
@RestController
@RequestMapping("/gasBottleTrack/illegal")
public class TGasIllegalController extends BaseController
{
    @Autowired
    private ITGasIllegalService tGasIllegalService;

    /**
     * 查询违法行为档案列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TGasIllegal tGasIllegal)
    {
        startPage();
        List<TGasIllegal> list = tGasIllegalService.selectTGasIllegalList(tGasIllegal);
        return getDataTable(list);
    }

    /**
     * 导出违法行为档案列表
     */
    @Log(title = "违法行为档案", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TGasIllegal tGasIllegal)
    {
        List<TGasIllegal> list = tGasIllegalService.selectTGasIllegalList(tGasIllegal);
        ExcelUtil<TGasIllegal> util = new ExcelUtil<TGasIllegal>(TGasIllegal.class);
        return util.exportExcel(list, "违法行为档案数据");
    }

    /**
     * 获取违法行为档案详细信息
     */
    @GetMapping(value = "/{illegalId}")
    public AjaxResult getInfo(@PathVariable("illegalId") Long illegalId)
    {
        return AjaxResult.success(tGasIllegalService.selectTGasIllegalById(illegalId));
    }

    /**
     * 新增违法行为档案
     */
    @Log(title = "违法行为档案", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TGasIllegal tGasIllegal)
    {
        return toAjax(tGasIllegalService.insertTGasIllegal(tGasIllegal));
    }

    /**
     * 修改违法行为档案
     */
    @Log(title = "违法行为档案", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TGasIllegal tGasIllegal)
    {
        return toAjax(tGasIllegalService.updateTGasIllegal(tGasIllegal));
    }

    /**
     * 删除违法行为档案
     */
    @Log(title = "违法行为档案", businessType = BusinessType.DELETE)
	@DeleteMapping("/{illegalIds}")
    public AjaxResult remove(@PathVariable Long[] illegalIds)
    {
        return toAjax(tGasIllegalService.deleteTGasIllegalByIds(illegalIds));
    }
}
