package com.cyl.manager.oms.controller;

import com.cyl.manager.oms.domain.OmsOrderService;
import com.cyl.manager.oms.service.OmsOrderServiceService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 预约订单服务详细信息记录表Controller
 * 
 * @author daixiande
 * @date 2024-01-04
 */
@RestController
@RequestMapping("/order/omsOrderService")
public class OMSOrderServiceController extends BaseController {
    @Autowired
    private OmsOrderServiceService omsOrderServiceService;

    /**
     * 查询预约订单服务详细信息记录表列表
     */
    @PreAuthorize("@ss.hasPermi('order:omsOrderService:list')")
    @GetMapping("/list")
    public TableDataInfo list(OmsOrderService omsOrderService) {
        startPage();
        List<OmsOrderService> list = omsOrderServiceService.selectOmsOrderServiceList(omsOrderService);
        return getDataTable(list);
    }

    /**
     * 导出预约订单服务详细信息记录表列表
     */
    @PreAuthorize("@ss.hasPermi('order:omsOrderService:export')")
    @Log(title = "预约订单服务详细信息记录表", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(OmsOrderService omsOrderService) {
        List<OmsOrderService> list = omsOrderServiceService.selectOmsOrderServiceList(omsOrderService);
        ExcelUtil<OmsOrderService> util = new ExcelUtil<OmsOrderService>(OmsOrderService.class);
        return util.exportExcel(list, "预约订单服务详细信息记录表数据");
    }

    /**
     * 获取预约订单服务详细信息记录表详细信息
     */
    @PreAuthorize("@ss.hasPermi('order:omsOrderService:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(omsOrderServiceService.selectOmsOrderServiceById(id));
    }

    /**
     * 新增预约订单服务详细信息记录表
     */
    @PreAuthorize("@ss.hasPermi('order:omsOrderService:add')")
    @Log(title = "预约订单服务详细信息记录表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OmsOrderService omsOrderService) {
        return toAjax(omsOrderServiceService.insertOmsOrderService(omsOrderService));
    }

    /**
     * 修改预约订单服务详细信息记录表
     */
    @PreAuthorize("@ss.hasPermi('order:omsOrderService:edit')")
    @Log(title = "预约订单服务详细信息记录表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OmsOrderService omsOrderService) {
        return toAjax(omsOrderServiceService.updateOmsOrderService(omsOrderService));
    }

    /**
     * 删除预约订单服务详细信息记录表
     */
    @PreAuthorize("@ss.hasPermi('order:omsOrderService:remove')")
    @Log(title = "预约订单服务详细信息记录表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(omsOrderServiceService.deleteOmsOrderServiceByIds(ids));
    }
}
