package com.fjhx.purchase.controller.pay;

import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.purchase.entity.pay.vo.PayDetailVo;
import com.fjhx.purchase.entity.pay.dto.PayDetailSelectDto;
import com.fjhx.purchase.entity.pay.dto.PayDetailDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.purchase.service.pay.PayDetailService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 采购付款明细 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-04-13
 */
@RestController
@RequestMapping("/payDetail")
public class PayDetailController {

    @Autowired
    private PayDetailService payDetailService;

    /**
     * 发票明细分页
     */
    @PostMapping("/page")
    public Page<PayDetailVo> page(@RequestBody PayDetailSelectDto dto) {
        return payDetailService.getPage(dto);
    }

    /**
     * 发票明细明细
     */
    @PostMapping("/detail")
    public PayDetailVo detail(@RequestBody BaseSelectDto dto) {
        return payDetailService.detail(dto.getId());
    }

    /**
     * 发票明细新增
     */
    @PostMapping("/add")
    public void add(@RequestBody PayDetailDto payDetailDto) {
        payDetailService.add(payDetailDto);
    }

    /**
     * 发票明细编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody PayDetailDto payDetailDto) {
        payDetailService.edit(payDetailDto);
    }

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

}
