
package com.tmerclub.cloud.multishop.mapper;

import com.tmerclub.cloud.multishop.dto.ShopWithdrawCashDTO;
import com.tmerclub.cloud.multishop.model.ShopWithdrawCash;
import com.tmerclub.cloud.multishop.vo.ShopWithdrawCashVO;
import org.apache.ibatis.annotations.Param;

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

/**
 * 商家提现申请信息
 *
 * @author tmerclub
 * @date 2021-01-07 16:41:03
 */
public interface ShopWithdrawCashMapper {

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

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

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

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

    /**
     * 根据参数获取提现记录列表
     *
     * @param shopWithdrawCashDTO 搜索筛选参数
     * @return 提现记录列表
     */
    List<ShopWithdrawCashVO> listByParam(@Param("shopWithdrawCash") ShopWithdrawCashDTO shopWithdrawCashDTO);

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

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

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