package cn.pluss.platform.merchant;

import cn.pluss.platform.dto.MerchantRateNewRecordDTO;
import cn.pluss.platform.entity.MerchantRateNewRecord;
import cn.pluss.platform.mapper.MerchantRateNewRecordMapper;
import cn.pluss.platform.vo.MerchantRateNewRecordVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;

/**
 * <p>
 * 商户费率表(新) 服务类
 * </p>
 *
 * @author Djh
 * @since 2021-08-09
 */
public interface MerchantRateNewRecordService extends IService<MerchantRateNewRecord> {

    default MerchantRateNewRecord getExaminedDataByUserId(String userId, String channel) {
        return ((MerchantRateNewRecordMapper) getBaseMapper()).selectLastExaminedDataByUserId(userId, channel);
    }

    default MerchantRateNewRecord getExaminedDataByMerchantCode(String merchantCode, String channel) {
        return ((MerchantRateNewRecordMapper) getBaseMapper()).selectLastExaminedDataByMerchantCode(merchantCode, channel);
    }

    default MerchantRateNewRecord getValidRecordByMerchantCode(String merchantCode, String channel) {
        return ((MerchantRateNewRecordMapper) getBaseMapper()).selectValidDataByMerchantCode(merchantCode, channel);
    }

    Page<MerchantRateNewRecordVO> apiPage(Page<MerchantRateNewRecord> page, MerchantRateNewRecordDTO entity);

    /**
     * 修改费率成功
     *
     * @param rateNewRecord 费率修改记录
     */
    void onSuccess(MerchantRateNewRecord rateNewRecord);

    /**
     * 修改费率失败
     *
     * @param rateNewRecord 费率修改记录
     */
    void onFail(MerchantRateNewRecord rateNewRecord);
}
