package com.sptg.pay.biz.controller;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.pay.api.dto.PayCertificateDto;
import com.sptg.pay.api.entity.PayCertificate;
import com.sptg.pay.api.feigns.PayCertificateFeign;
import com.sptg.pay.biz.service.PayCertificateServiceInterface;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zwx
 * @create 2020/5/25 10:16
 */
@RestController
@RequiredArgsConstructor
public class PayCertificateController implements PayCertificateFeign {

    private final PayCertificateServiceInterface payCertificateServiceInterface;

//    @Autowired
//    public PayCertificateController(PayCertificateServiceInterface payCertificateServiceInterface){
//        this.payCertificateServiceInterface = payCertificateServiceInterface;
//    }

    @Override
    @PostMapping(value = "/payCertificate/showPayCertificatePage")
    public ResultBean<Page<PayCertificate>> showPayCertificatePage(@RequestBody PayCertificateDto payCertificateDto) {
        return this.payCertificateServiceInterface.showPayCertificatePage(payCertificateDto);
    }

    @Override
    @PostMapping(value = "/payCertificate/addPayCertificate")
    public ResultBean<Boolean> addPayCertificate(@RequestBody PayCertificateDto payCertificateDto) {
        return this.payCertificateServiceInterface.addPayCertificate(payCertificateDto);
    }

    @Override
    @PostMapping(value = "/payCertificate/addPayCertificateByImport")
    public PayCertificate addPayCertificateByImport(@RequestBody PayCertificateDto payCertificateDto) {
        return this.payCertificateServiceInterface.addPayCertificateByImport(payCertificateDto);
    }

    @Override
    @PostMapping(value = "/payCertificate/updatePayCertificate")
    public ResultBean<Boolean> updatePayCertificate(@RequestBody PayCertificate payCertificate) {
        return this.payCertificateServiceInterface.updatePayCertificate(payCertificate);
    }

    @Override
    @GetMapping(value = "/payCertificate/findPayCertificateById/{id}")
    public PayCertificate findPayCertificateById(@PathVariable Long id) {
        return this.payCertificateServiceInterface.findPayCertificateById(id);
    }

    @Override
    @PostMapping(value = "/payCertificate/findPayCertificateByCondition")
    public PayCertificate findPayCertificateByCondition(@RequestBody PayCertificateDto payCertificateDto) {
        return this.payCertificateServiceInterface.findPayCertificateByCondition(payCertificateDto);
    }

    @Override
    @PostMapping(value = "/payCertificate/findPayCertificateListByCondition")
    public List<PayCertificate> findPayCertificateListByCondition(@RequestBody PayCertificateDto payCertificateDto) {
        return this.payCertificateServiceInterface.findPayCertificateListByCondition(payCertificateDto);
    }
}
