package com.fjhx.purchase.controller.sales;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.fjhx.common.constant.SourceConstant;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.purchase.entity.sales.vo.SalesReturnDetailVo;
import com.fjhx.purchase.entity.sales.dto.SalesReturnDetailSelectDto;
import com.fjhx.purchase.entity.sales.dto.SalesReturnDetailDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.purchase.service.sales.SalesReturnDetailService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 到货明细单 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-04-11
 */
@DS(SourceConstant.PURCHASE)
@RestController
@RequestMapping("/salesReturnDetail")
public class SalesReturnDetailController {

    @Autowired
    private SalesReturnDetailService salesReturnDetailService;

    /**
     * 到货明细单分页
     */
    @PostMapping("/page")
    public Page<SalesReturnDetailVo> page(@RequestBody SalesReturnDetailSelectDto dto) {
        return salesReturnDetailService.getPage(dto);
    }

    /**
     * 到货明细单明细
     */
    @PostMapping("/detail")
    public SalesReturnDetailVo detail(@RequestBody BaseSelectDto dto) {
        return salesReturnDetailService.detail(dto.getId());
    }

    /**
     * 到货明细单新增
     */
    @PostMapping("/add")
    public void add(@RequestBody SalesReturnDetailDto salesReturnDetailDto) {
        salesReturnDetailService.add(salesReturnDetailDto);
    }

    /**
     * 到货明细单编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody SalesReturnDetailDto salesReturnDetailDto) {
        salesReturnDetailService.edit(salesReturnDetailDto);
    }

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

}
