package com.ruoyi.web.controller.fleet;

import java.util.List;

import com.ruoyi.orderManagement.domain.Ftmsorderbillscntrs;
import com.ruoyi.orderManagement.service.IftmsorderbillscntrsService;
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.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 箱型箱量Controller
 *
 * @author ruoyi
 * @date 2021-02-22
 */
@RestController
@RequestMapping("/fleet/ftmsorderbillscntrs")
public class ftmsorderbillscntrsController extends BaseController {
    @Autowired
    private IftmsorderbillscntrsService ftmsorderbillscntrsService;

    /**
     * 查询箱型箱量列表
     */
    @GetMapping("/list")
    public TableDataInfo list(Ftmsorderbillscntrs ftmsorderbillscntrs) {
        startPage();
        List<Ftmsorderbillscntrs> list = ftmsorderbillscntrsService.selectftmsorderbillscntrsList(ftmsorderbillscntrs);
        return getDataTable(list);
    }

    /**
     * 导出箱型箱量列表
     */
    @PreAuthorize("@ss.hasPermi('fleet:ftmsorderbillscntrs:export')")
    @Log(title = "箱型箱量", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Ftmsorderbillscntrs ftmsorderbillscntrs) {
        List<Ftmsorderbillscntrs> list = ftmsorderbillscntrsService.selectftmsorderbillscntrsList(ftmsorderbillscntrs);
        ExcelUtil<Ftmsorderbillscntrs> util = new ExcelUtil<Ftmsorderbillscntrs>(Ftmsorderbillscntrs.class);
        return util.exportExcel(list, "ftmsorderbillscntrs");
    }

    /**
     * 获取箱型箱量详细信息
     */
    @PreAuthorize("@ss.hasPermi('fleet:ftmsorderbillscntrs:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(ftmsorderbillscntrsService.selectftmsorderbillscntrsById(id));
    }

    /**
     * 新增箱型箱量
     */
    @PreAuthorize("@ss.hasPermi('fleet:ftmsorderbillscntrs:add')")
    @Log(title = "箱型箱量", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Ftmsorderbillscntrs ftmsorderbillscntrs) {
        return toAjax(ftmsorderbillscntrsService.insertftmsorderbillscntrs(ftmsorderbillscntrs));
    }

    /**
     * 修改箱型箱量
     */
    @PreAuthorize("@ss.hasPermi('fleet:ftmsorderbillscntrs:edit')")
    @Log(title = "箱型箱量", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Ftmsorderbillscntrs ftmsorderbillscntrs) {
        return toAjax(ftmsorderbillscntrsService.updateftmsorderbillscntrs(ftmsorderbillscntrs));
    }

    /**
     * 删除箱型箱量
     */
    @PreAuthorize("@ss.hasPermi('fleet:ftmsorderbillscntrs:remove')")
    @Log(title = "箱型箱量", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(ftmsorderbillscntrsService.deleteftmsorderbillscntrsByIds(ids));
    }
}
