package com.fjhx.sale.controller.claim;

import com.fjhx.sale.entity.claim.po.ClaimContract;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.sale.entity.claim.vo.ClaimContractVo;
import com.fjhx.sale.entity.claim.dto.ClaimContractSelectDto;
import com.fjhx.sale.entity.claim.dto.ClaimContractDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.sale.service.claim.ClaimContractService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


/**
 * <p>
 * 到账认领-合同关联表 前端控制器
 * </p>
 *
 * @author
 * @since 2023-04-18
 */
@RestController
@RequestMapping("/claimContract")
public class ClaimContractController {

    @Autowired
    private ClaimContractService claimContractService;

    /**
     * 到账认领-合同关联表分页
     */
    @PostMapping("/page")
    public Page<ClaimContractVo> page(@RequestBody ClaimContractSelectDto dto) {
        return claimContractService.getPage(dto);
    }

    /**
     * 根据合同批量查询
     */
    @PostMapping("/getListByContractIds")
    public List<ClaimContract> getListByContractIds(@RequestBody List<Long> contractIds) {
        return claimContractService.getListByContractIds(contractIds);
    }

    /**
     * 到账认领-合同关联表明细
     */
    @PostMapping("/detail")
    public ClaimContractVo detail(@RequestBody BaseSelectDto dto) {
        return claimContractService.detail(dto.getId());
    }

    /**
     * 到账认领-合同关联表新增
     */
    @PostMapping("/add")
    public void add(@RequestBody ClaimContractDto claimContractDto) {
        claimContractService.add(claimContractDto);
    }

    /**
     * 到账认领-合同关联表编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody ClaimContractDto claimContractDto) {
        claimContractService.edit(claimContractDto);
    }

    /**
     * 到账认领-合同关联表删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        claimContractService.delete(dto.getId());
    }

}
