package com.tmerclub.cloud.user.mapper;

import com.tmerclub.cloud.user.model.UserWithdrawCash;
import com.tmerclub.cloud.user.vo.UserWithdrawCashVO;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author gaozijie
 * @date 2023-04-24
 */
public interface UserWithdrawCashMapper {

    /**
     * 新增
     * @param withdrawCash
     */
    void save(@Param("withdrawCash") UserWithdrawCash withdrawCash);

    /**
     * 更新
     * @param withdrawCash
     */
    void update(@Param("withdrawCash") UserWithdrawCash withdrawCash);

    /**
     * 通过orderNo获取提现记录
     * @param orderNo 订单号
     * @return
     */
    UserWithdrawCash getByOrderNo(@Param("orderNo") String orderNo);

    /**
     * 统计指定时间内提现次数
     * @param userId 用户id
     * @param startTime 起始时间
     * @return
     */
    Integer countWithdrawTimes(@Param("userId") Long userId,
                               @Param("startTime") LocalDateTime startTime);

    /**
     * 获取用户提现总金额
     * @param userId
     * @return
     */
    BigDecimal getTotalWithdrawAmount(@Param("userId") Long userId);

    /**
     * 获取用户提现记录
     * @param userId
     * @return
     */
    List<UserWithdrawCashVO> listUserWithdrawCashVOList(@Param("userId") Long userId);
}
