package com.fjhx.sale.controller.pack;

import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.sale.entity.pack.vo.PackShipmentVo;
import com.fjhx.sale.entity.pack.dto.PackShipmentSelectDto;
import com.fjhx.sale.entity.pack.dto.PackShipmentDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.sale.service.pack.PackShipmentService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;


/**
 * <p>
 * 出货绑定主合同表 前端控制器
 * </p>
 *
 * @author
 * @since 2023-04-19
 */
@RestController
@RequestMapping("/packShipment")
public class PackShipmentController {

    @Autowired
    private PackShipmentService packShipmentService;

    /**
     * 出货绑定主合同表分页
     */
    @PostMapping("/page")
    public Page<PackShipmentVo> page(@RequestBody PackShipmentSelectDto dto) {
        return packShipmentService.getPage(dto);
    }

    /**
     * 查询出货绑定主合同列表详情
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public List<PackShipmentVo> list(@RequestBody PackShipmentSelectDto dto) {
        return packShipmentService.getList(dto);
    }

    /**
     * 查询出货-主合同表的产品信息详情列表
     * @param dto
     * @return
     */
    @PostMapping("/productDetailList")
    public List<Map<String,Object>> productDetailList(@RequestBody PackShipmentSelectDto dto) {
        return packShipmentService.productDetailList(dto);
    }

    /**
     * 出货绑定主合同表明细
     */
    @PostMapping("/detail")
    public PackShipmentVo detail(@RequestBody BaseSelectDto dto) {
        return packShipmentService.detail(dto.getId());
    }

    /**
     * 出货绑定主合同表新增
     */
    @PostMapping("/add")
    public void add(@RequestBody PackShipmentDto packShipmentDto) {
        packShipmentService.add(packShipmentDto);
    }

    /**
     * 出货绑定主合同表编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody PackShipmentDto packShipmentDto) {
        packShipmentService.edit(packShipmentDto);
    }

    /**
     * 出货绑定主合同表删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        packShipmentService.delete(dto.getId());
    }

}
