package com.ruoyi.frequency.orderpanorama.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.frequency.orderpanorama.entity.OrderPanorama;
import com.ruoyi.frequency.orderpanorama.service.OrderPanoramaService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 订单和3D链接关联Controller
 * 
 * @author zj
 * @date 2023-10-13
 */
@RestController
@RequestMapping("/frequency/orderpanorama")
public class OrderPanoramaController extends BaseController
{
    @Autowired
    private OrderPanoramaService orderPanoramaService;

    /**
     * 查询订单和3D链接关联列表
     */
    @PreAuthorize("@ss.hasPermi('frequency:orderpanorama:list')")
    @GetMapping("/list")
    public TableDataInfo<OrderPanorama> list(OrderPanorama orderPanorama)
    {
        startPage();
        List<OrderPanorama> list = orderPanoramaService.selectOrderPanoramaList(orderPanorama);
        return getDataTable(list);
    }

    /**
     * 导出订单和3D链接关联列表
     */
    @PreAuthorize("@ss.hasPermi('frequency:orderpanorama:export')")
    @Log(title = "订单和3D链接关联", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(OrderPanorama orderPanorama)
    {
        List<OrderPanorama> list = orderPanoramaService.selectOrderPanoramaList(orderPanorama);
        ExcelUtil<OrderPanorama> util = new ExcelUtil<OrderPanorama>(OrderPanorama.class);
        return util.exportExcel(list, "订单和3D链接关联数据");
    }

    /**
     * 获取订单和3D链接关联详细信息
     */
    @PreAuthorize("@ss.hasPermi('frequency:orderpanorama:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult<OrderPanorama> getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(orderPanoramaService.selectOrderPanoramaById(id));
    }

    /**
     * 新增订单和3D链接关联
     */
    @PreAuthorize("@ss.hasPermi('frequency:orderpanorama:add')")
    @Log(title = "订单和3D链接关联", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OrderPanorama orderPanorama)
    {
        return toAjax(orderPanoramaService.insertOrderPanorama(orderPanorama));
    }

    /**
     * 修改订单和3D链接关联
     */
    @PreAuthorize("@ss.hasPermi('frequency:orderpanorama:edit')")
    @Log(title = "订单和3D链接关联", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OrderPanorama orderPanorama)
    {
        return toAjax(orderPanoramaService.updateOrderPanorama(orderPanorama));
    }

    /**
     * 删除订单和3D链接关联
     */
    @PreAuthorize("@ss.hasPermi('frequency:orderpanorama:remove')")
    @Log(title = "订单和3D链接关联", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(orderPanoramaService.deleteOrderPanoramaByIds(ids));
    }
}
