package com.ruoyi.web.controller.shipping.controller;

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.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.shipping.domain.TCntrtracking;
import com.ruoyi.shipping.service.ITCntrtrackingService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 箱跟踪Controller
 * 
 * @author ruoyi
 * @date 2021-03-22
 */
@RestController
@RequestMapping("/shipping/cntrtracking")
public class TCntrtrackingController extends BaseController
{
    @Autowired
    private ITCntrtrackingService tCntrtrackingService;

    /**
     * 查询箱跟踪列表
     */
    @PreAuthorize("@ss.hasPermi('shipping:cntrtracking:list')")
    @GetMapping("/list")
    public TableDataInfo list(TCntrtracking tCntrtracking)
    {
        startPage();
        List<TCntrtracking> list = tCntrtrackingService.selectTCntrtrackingList(tCntrtracking);
        return getDataTable(list);
    }

    /**
     * 导出箱跟踪列表
     */
    @PreAuthorize("@ss.hasPermi('shipping:cntrtracking:export')")
    @Log(title = "箱跟踪", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TCntrtracking tCntrtracking)
    {
        List<TCntrtracking> list = tCntrtrackingService.selectTCntrtrackingList(tCntrtracking);
        ExcelUtil<TCntrtracking> util = new ExcelUtil<TCntrtracking>(TCntrtracking.class);
        return util.exportExcel(list, "cntrtracking");
    }

    /**
     * 获取箱跟踪详细信息
     */
    @PreAuthorize("@ss.hasPermi('shipping:cntrtracking:query')")
    @GetMapping(value = "/{fId}")
    public AjaxResult getInfo(@PathVariable("fId") Long fId)
    {
        return AjaxResult.success(tCntrtrackingService.selectTCntrtrackingById(fId));
    }

    /**
     * 新增箱跟踪
     */
    @PreAuthorize("@ss.hasPermi('shipping:cntrtracking:add')")
    @Log(title = "箱跟踪", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TCntrtracking tCntrtracking)
    {
        return toAjax(tCntrtrackingService.insertTCntrtracking(tCntrtracking));
    }

    /**
     * 修改箱跟踪
     */
    @PreAuthorize("@ss.hasPermi('shipping:cntrtracking:edit')")
    @Log(title = "箱跟踪", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TCntrtracking tCntrtracking)
    {
        return toAjax(tCntrtrackingService.updateTCntrtracking(tCntrtracking));
    }

    /**
     * 删除箱跟踪
     */
    @PreAuthorize("@ss.hasPermi('shipping:cntrtracking:remove')")
    @Log(title = "箱跟踪", businessType = BusinessType.DELETE)
	@DeleteMapping("/{fIds}")
    public AjaxResult remove(@PathVariable Long[] fIds)
    {
        return toAjax(tCntrtrackingService.deleteTCntrtrackingByIds(fIds));
    }
}
