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.dto.PayChannelConfigDto;
import com.sptg.pay.api.entity.PayCertificate;
import com.sptg.pay.api.entity.PayChannelConfig;
import com.sptg.pay.api.feigns.PayCertificateFeign;
import com.sptg.pay.api.feigns.PayChannelConfigFeign;
import com.sptg.pay.biz.service.PayCertificateServiceInterface;
import com.sptg.pay.biz.service.PayChannelConfigServiceInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zwx
 * @create 2020/5/25 10:16
 */
@RestController
public class PayChannelConfigController implements PayChannelConfigFeign {

    private PayChannelConfigServiceInterface payChannelConfigServiceInterface;

    @Autowired
    public PayChannelConfigController(PayChannelConfigServiceInterface payChannelConfigServiceInterface){
        this.payChannelConfigServiceInterface = payChannelConfigServiceInterface;
    }

    @Override
    @PostMapping(value = "/payChannelConfig/showPayChannelConfigPage")
    public ResultBean<Page<PayChannelConfig>> showPayChannelConfigPage(PayChannelConfigDto payChannelConfigDto) {
        return this.payChannelConfigServiceInterface.showPayChannelConfigPage(payChannelConfigDto);
    }

    @Override
    @PostMapping(value = "/payChannelConfig/addPayChannelConfig")
    public ResultBean<Boolean> addPayChannelConfig(PayChannelConfigDto payChannelConfigDto) {
        return this.payChannelConfigServiceInterface.addPayChannelConfig(payChannelConfigDto);
    }

    @Override
    @PostMapping(value = "/payChannelConfig/updatePayChannelConfig")
    public ResultBean<Boolean> updatePayChannelConfig(PayChannelConfig payChannelConfig) {
        return this.payChannelConfigServiceInterface.updatePayChannelConfig(payChannelConfig);
    }

    @Override
    @GetMapping(value = "/payChannelConfig/findPayChannelConfigById/{id}")
    public PayChannelConfig findPayChannelConfigById(@PathVariable Long id) {
        return this.payChannelConfigServiceInterface.findPayChannelConfigById(id);
    }

    @Override
    @PostMapping(value = "/payChannelConfig/findUnitByCondition")
    public PayChannelConfig findUnitByCondition(PayChannelConfigDto payChannelConfigDto) {
        return this.payChannelConfigServiceInterface.findPayChannelConfigByCondition(payChannelConfigDto);
    }
}
