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.TCarTaskInspect;
import com.zehong.system.service.ITCarTaskInspectService;
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/inspect")
public class TCarTaskInspectController extends BaseController
{
    @Autowired
    private ITCarTaskInspectService tCarTaskInspectService;

    /**
     * 查询巡检车打卡列表
     */
    //@PreAuthorize("@ss.hasPermi('system:inspect:list')")
    @GetMapping("/list")
    public TableDataInfo list(TCarTaskInspect tCarTaskInspect)
    {
        startPage();
        List<TCarTaskInspect> list = tCarTaskInspectService.selectTCarTaskInspectList(tCarTaskInspect);
        return getDataTable(list);
    }

    @GetMapping("/inspectListInfo")
    public AjaxResult inspectListInfo(TCarTaskInspect tCarTaskInspect) {
        List<TCarTaskInspect> list = tCarTaskInspectService.selectTCarTaskInspectList(tCarTaskInspect);
        return AjaxResult.success(list);
    }

    /**
     * 导出巡检车打卡列表
     */
    //@PreAuthorize("@ss.hasPermi('system:inspect:export')")
    @Log(title = "巡检车打卡", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TCarTaskInspect tCarTaskInspect)
    {
        List<TCarTaskInspect> list = tCarTaskInspectService.selectTCarTaskInspectList(tCarTaskInspect);
        ExcelUtil<TCarTaskInspect> util = new ExcelUtil<TCarTaskInspect>(TCarTaskInspect.class);
        return util.exportExcel(list, "巡检车打卡数据");
    }

    /**
     * 获取巡检车打卡详细信息
     */
    //@PreAuthorize("@ss.hasPermi('system:inspect:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tCarTaskInspectService.selectTCarTaskInspectById(id));
    }

    /**
     * 新增巡检车打卡
     */
    //@PreAuthorize("@ss.hasPermi('system:inspect:add')")
    @Log(title = "巡检车打卡", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TCarTaskInspect tCarTaskInspect)
    {
        return toAjax(tCarTaskInspectService.insertTCarTaskInspect(tCarTaskInspect));
    }

    /**
     * 修改巡检车打卡
     */
    //@PreAuthorize("@ss.hasPermi('system:inspect:edit')")
    @Log(title = "巡检车打卡", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TCarTaskInspect tCarTaskInspect)
    {
        return toAjax(tCarTaskInspectService.updateTCarTaskInspect(tCarTaskInspect));
    }

    /**
     * 删除巡检车打卡
     */
    //@PreAuthorize("@ss.hasPermi('system:inspect:remove')")
    @Log(title = "巡检车打卡", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tCarTaskInspectService.deleteTCarTaskInspectByIds(ids));
    }
}
