package com.fjhx.victoriatourist.controller.order;

import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.victoriatourist.entity.order.vo.OrderInfoVo;
import com.fjhx.victoriatourist.entity.order.dto.OrderInfoSelectDto;
import com.fjhx.victoriatourist.entity.order.dto.OrderInfoDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.victoriatourist.service.order.OrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 订单 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-04-17
 */
@RestController
@RequestMapping("/orderInfo")
public class OrderInfoController {

    @Autowired
    private OrderInfoService orderInfoService;

    /**
     * 订单分页
     */
    @PostMapping("/page")
    public Page<OrderInfoVo> page(@RequestBody OrderInfoSelectDto dto) {
        return orderInfoService.getPage(dto);
    }

    /**
     * 订单明细
     */
    @PostMapping("/detail")
    public OrderInfoVo detail(@RequestBody BaseSelectDto dto) {
        return orderInfoService.detail(dto.getId());
    }

    /**
     * 订单新增
     */
    @PostMapping("/add")
    public void add(@RequestBody OrderInfoDto orderInfoDto) {
        orderInfoService.add(orderInfoDto);
    }

    /**
     * 订单编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody OrderInfoDto orderInfoDto) {
        orderInfoService.edit(orderInfoDto);
    }

    /**
     * 订单删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        orderInfoService.delete(dto.getId());
    }

}
