package com.fjhx.victoriatourist.controller.deliver;

import com.fjhx.purchase.entity.purchase.vo.PurchaseDetailVo;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.victoriatourist.entity.deliver.vo.DeliverGoodsDetailsVo;
import com.fjhx.victoriatourist.entity.deliver.dto.DeliverGoodsDetailsSelectDto;
import com.fjhx.victoriatourist.entity.deliver.dto.DeliverGoodsDetailsDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.victoriatourist.service.deliver.DeliverGoodsDetailsService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


/**
 * <p>
 * 发货明细 前端控制器
 * </p>
 *
 * @author
 * @since 2023-04-13
 */
@RestController
@RequestMapping("/deliverGoodsDetails")
public class DeliverGoodsDetailsController {

    @Autowired
    private DeliverGoodsDetailsService deliverGoodsDetailsService;

    /**
     * 发货明细分页
     */
    @PostMapping("/page")
    public Page<DeliverGoodsDetailsVo> page(@RequestBody DeliverGoodsDetailsSelectDto dto) {
        return deliverGoodsDetailsService.getPage(dto);
    }

    /**
     * 发货明细明细
     */
    @PostMapping("/detail")
    public List<PurchaseDetailVo> detail(@RequestBody BaseSelectDto dto) {
        return deliverGoodsDetailsService.detail(dto.getId());
    }

    /**
     * 发货明细新增
     */
    @PostMapping("/add")
    public void add(@RequestBody DeliverGoodsDetailsDto deliverGoodsDetailsDto) {
        deliverGoodsDetailsService.add(deliverGoodsDetailsDto);
    }

    /**
     * 发货明细编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody DeliverGoodsDetailsDto deliverGoodsDetailsDto) {
        deliverGoodsDetailsService.edit(deliverGoodsDetailsDto);
    }

    /**
     * 发货明细删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        deliverGoodsDetailsService.delete(dto.getId());
    }

}
