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.ContractInvoiceVo;
import com.fjhx.sale.entity.contract.dto.ContractInvoiceSelectDto;
import com.fjhx.sale.entity.contract.dto.ContractInvoiceDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.sale.service.contract.ContractInvoiceService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 合同发票管理 前端控制器
 * </p>
 *
 * @author
 * @since 2023-09-08
 */
@RestController
@RequestMapping("/contractInvoice")
public class ContractInvoiceController {

    @Autowired
    private ContractInvoiceService contractInvoiceService;

    /**
     * 合同发票管理分页
     */
    @PostMapping("/page")
    public Page<ContractInvoiceVo> page(@RequestBody ContractInvoiceSelectDto dto) {
        return contractInvoiceService.getPage(dto);
    }

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

    /**
     * 合同发票管理新增
     */
    @PostMapping("/add")
    public void add(@RequestBody ContractInvoiceDto contractInvoiceDto) {
        contractInvoiceService.add(contractInvoiceDto);
    }

    /**
     * 合同发票管理编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody ContractInvoiceDto contractInvoiceDto) {
        contractInvoiceService.edit(contractInvoiceDto);
    }

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

}
