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.OrderDetailsVo;
import com.fjhx.victoriatourist.entity.order.dto.OrderDetailsSelectDto;
import com.fjhx.victoriatourist.entity.order.dto.OrderDetailsDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.victoriatourist.service.order.OrderDetailsService;
import org.springframework.beans.factory.annotation.Autowired;


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

    @Autowired
    private OrderDetailsService orderDetailsService;

    /**
     * 订单明细分页
     */
    @PostMapping("/page")
    public Page<OrderDetailsVo> page(@RequestBody OrderDetailsSelectDto dto) {
        return orderDetailsService.getPage(dto);
    }

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

    /**
     * 订单明细新增
     */
    @PostMapping("/add")
    public void add(@RequestBody OrderDetailsDto orderDetailsDto) {
        orderDetailsService.add(orderDetailsDto);
    }

    /**
     * 订单明细编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody OrderDetailsDto orderDetailsDto) {
        orderDetailsService.edit(orderDetailsDto);
    }

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

}
