package com.ics.admin.controller.meeting;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ics.common.core.domain.R;
import com.ics.common.core.controller.BaseController;
import com.ics.admin.domain.meeting.Order;
import com.ics.admin.service.meeting.IOrderService;
import org.wf.jwtp.annotation.RequiresPermissions;

/**
 * 订单 提供者
 *
 * @author chen
 * @date 2024-02-25
 */
@RestController
@RequestMapping("/meeting/order")
public class OrderController extends BaseController {

    @Autowired
    private IOrderService orderService;

    /**
     * 查询订单
     */
    @GetMapping("get/{id}")
    public Order get(@PathVariable("id") Long id) {
        return orderService.selectOrderById(id);
    }

    /**
     * 查询订单列表
     */
    @RequiresPermissions("meeting:order:list")
    @GetMapping("list")
    public R list(Order order) {
        startPage();
        return result(orderService.selectOrderList(order));
    }


    /**
     * 新增保存订单
     */
    @RequiresPermissions("meeting:order:add")
    @PostMapping("save")
    public R addSave(@RequestBody Order order) {
        return toAjax(orderService.insertOrder(order));
    }

    /**
     * 修改保存订单
     */
    @RequiresPermissions("meeting:order:edit")
    @PostMapping("update")
    public R editSave(@RequestBody Order order) {
        return toAjax(orderService.updateOrder(order));
    }

    /**
     * 删除订单
     */
    @RequiresPermissions("meeting:order:remove")
    @PostMapping("remove")
    public R remove(String ids) {
        return toAjax(orderService.deleteOrderByIds(ids));
    }

}
