package com.fjhx.victoriatourist.controller.deliver;

import com.fjhx.purchase.entity.purchase.vo.PurchaseVo;
import com.fjhx.victoriatourist.entity.deliver.po.DeliverGoods;
import com.fjhx.victoriatourist.entity.deliver.vo.DeliverGoodsDetailsVo;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.victoriatourist.entity.deliver.vo.DeliverGoodsVo;
import com.fjhx.victoriatourist.entity.deliver.dto.DeliverGoodsSelectDto;
import com.fjhx.victoriatourist.entity.deliver.dto.DeliverGoodsDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.victoriatourist.service.deliver.DeliverGoodsService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


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

    @Autowired
    private DeliverGoodsService deliverGoodsService;

    /**
     * 发货分页
     */
    @PostMapping("/page")
    public Page<DeliverGoodsVo> page(@RequestBody DeliverGoodsSelectDto dto) {
        return deliverGoodsService.getPage(dto);
    }

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

    /**
     * 发货新增
     */
    @PostMapping("/add")
    public void add(@RequestBody DeliverGoodsDto deliverGoodsDto) {
        deliverGoodsService.add(deliverGoodsDto);
    }

    /**
     * 发货编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody DeliverGoodsDto deliverGoodsDto) {
        deliverGoodsService.edit(deliverGoodsDto);
    }

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

    /**
     * 发货列表
     *
     * @return
     */
    @PostMapping("/list")
    public List<DeliverGoods> list(@RequestBody BaseSelectDto dto) {
        return deliverGoodsService.list(dto.getId());
    }

    @PostMapping("/arrivalDetail")
    public PurchaseVo arrivalDetail(@RequestBody DeliverGoodsDto dto) {
        return deliverGoodsService.arrivalDetail(dto.getPurchaseId());
    }

}
