package com.fjhx.sale.controller.contract;

import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.sale.entity.contract.vo.ContractInvoiceDetailsVo;
import com.fjhx.sale.entity.contract.dto.ContractInvoiceDetailsSelectDto;
import com.fjhx.sale.entity.contract.dto.ContractInvoiceDetailsDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.sale.service.contract.ContractInvoiceDetailsService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 合同发票明细 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-09-08
 */
@RestController
@RequestMapping("/contractInvoiceDetails")
public class ContractInvoiceDetailsController {

    @Autowired
    private ContractInvoiceDetailsService contractInvoiceDetailsService;

    /**
     * 合同发票明细分页
     */
    @PostMapping("/page")
    public Page<ContractInvoiceDetailsVo> page(@RequestBody ContractInvoiceDetailsSelectDto dto) {
        return contractInvoiceDetailsService.getPage(dto);
    }

    /**
     * 合同发票明细明细
     */
    @PostMapping("/detail")
    public ContractInvoiceDetailsVo detail(@RequestBody BaseSelectDto dto) {
        return contractInvoiceDetailsService.detail(dto.getId());
    }

    /**
     * 合同发票明细新增
     */
    @PostMapping("/add")
    public void add(@RequestBody ContractInvoiceDetailsDto contractInvoiceDetailsDto) {
        contractInvoiceDetailsService.add(contractInvoiceDetailsDto);
    }

    /**
     * 合同发票明细编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody ContractInvoiceDetailsDto contractInvoiceDetailsDto) {
        contractInvoiceDetailsService.edit(contractInvoiceDetailsDto);
    }

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

}
