
package com.tmerclub.cloud.supplier.mapper;

import com.tmerclub.cloud.supplier.dto.SupplierWithdrawCashDTO;
import com.tmerclub.cloud.supplier.model.SupplierWithdrawCash;
import com.tmerclub.cloud.supplier.vo.SupplierWithdrawCashVO;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * 供应商提现申请信息
 *
 * @author lhd
 * @date 2022-03-14 17:04:32
 */
public interface SupplierWithdrawCashMapper {

    /**
     * 根据提现单号查询
     * @param bizOrderNo
     * @return
     */
    SupplierWithdrawCash getByBizOrderNo(@Param("bizOrderNo") String bizOrderNo);

    /**
     * 保存商家提现申请信息
     * @param supplierWithdrawCash 商家提现申请信息
     */
    void save(@Param("supplierWithdrawCash") SupplierWithdrawCash supplierWithdrawCash);

    /**
     * 更新商家提现申请信息
     * @param supplierWithdrawCash 商家提现申请信息
     */
    void update(@Param("supplierWithdrawCash") SupplierWithdrawCash supplierWithdrawCash);

    /**
     * 根据银行卡id与商家提现申请状态获取商家提现申请数量
     * @param supplierBankCardId 银行卡id
     * @param status 提现申请状态
     * @return
     */
    int countBySupplierBandCardIdAndStatus(@Param("supplierBankCardId") Long supplierBankCardId, @Param("status") Integer status);

    /**
     * 根据参数获取提现记录列表
     * @param supplierWithdrawCashDTO 搜索筛选参数
     * @return 提现记录列表
     */
    List<SupplierWithdrawCashVO> listByParam(@Param("supplierWithdrawCash") SupplierWithdrawCashDTO supplierWithdrawCashDTO);

    /**
     * 根据id获取提现申请详情信息
     * @param cashId
     * @return
     */
    SupplierWithdrawCashVO getDetailByCashId(@Param("cashId") Long cashId);

    /**
     * 根据id与状态更新提现申请信息
     * @param supplierWithdrawCash
     * @param cashId
     * @param status
     * @return
     */
    int updateByIdAndStatus(@Param("supplierWithdrawCash") SupplierWithdrawCash supplierWithdrawCash, @Param("cashId") Long cashId, @Param("status") Integer status);

    /**
     * 计算提现频率
     * @param startTimes
     * @param endTimes
     * @param supplierWithdrawCash
     * @return
     */
    int getWithdrawCashCount(@Param("startTimes") Date startTimes, @Param("endTimes") Date endTimes, @Param("supplierWithdrawCash") SupplierWithdrawCash supplierWithdrawCash);
}
