package com.zehong.web.controller.car;

import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.TCarTaskPoint;
import com.zehong.system.service.ITCarTaskPointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 泄漏点Controller
 * 
 * @author zehong
 * @date 2026-05-15
 */
@RestController
@RequestMapping("/car/point")
public class TCarTaskPointController extends BaseController
{
    @Autowired
    private ITCarTaskPointService tCarTaskPointService;

    /**
     * 查询泄漏点列表
     */
    //@PreAuthorize("@ss.hasPermi('system:point:list')")
    @GetMapping("/list")
    public TableDataInfo list(TCarTaskPoint tCarTaskPoint)
    {
        startPage();
        List<TCarTaskPoint> list = tCarTaskPointService.selectTCarTaskPointList(tCarTaskPoint);
        return getDataTable(list);
    }

    @GetMapping("/pointInfoList")
    public AjaxResult pointInfoList(TCarTaskPoint tCarTaskPoint) {
        List<TCarTaskPoint> list = tCarTaskPointService.selectTCarTaskPointList(tCarTaskPoint);
        return AjaxResult.success(list);
    }

    /**
     * 导出泄漏点列表
     */
    //@PreAuthorize("@ss.hasPermi('system:point:export')")
    @Log(title = "泄漏点", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TCarTaskPoint tCarTaskPoint)
    {
        List<TCarTaskPoint> list = tCarTaskPointService.selectTCarTaskPointList(tCarTaskPoint);
        ExcelUtil<TCarTaskPoint> util = new ExcelUtil<TCarTaskPoint>(TCarTaskPoint.class);
        return util.exportExcel(list, "泄漏点数据");
    }

    /**
     * 获取泄漏点详细信息
     */
    //@PreAuthorize("@ss.hasPermi('system:point:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tCarTaskPointService.selectTCarTaskPointById(id));
    }

    /**
     * 新增泄漏点
     */
    //@PreAuthorize("@ss.hasPermi('system:point:add')")
    @Log(title = "泄漏点", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TCarTaskPoint tCarTaskPoint)
    {
        return toAjax(tCarTaskPointService.insertTCarTaskPoint(tCarTaskPoint));
    }

    /**
     * 修改泄漏点
     */
    //@PreAuthorize("@ss.hasPermi('system:point:edit')")
    @Log(title = "泄漏点", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TCarTaskPoint tCarTaskPoint)
    {
        return toAjax(tCarTaskPointService.updateTCarTaskPoint(tCarTaskPoint));
    }

    /**
     * 删除泄漏点
     */
    //@PreAuthorize("@ss.hasPermi('system:point:remove')")
    @Log(title = "泄漏点", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tCarTaskPointService.deleteTCarTaskPointByIds(ids));
    }
}
