package com.hzs.member.account.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hzs.common.domain.member.account.CuMemberWithdraw;
import com.hzs.common.domain.member.account.CuMemberWithdrawExt;
import com.hzs.member.account.vo.CuMemberWithdrawVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 会员提现表 Mapper 接口
 * </p>
 *
 * @author hzs
 * @since 2022-09-06
 */
public interface CuMemberWithdrawMapper extends BaseMapper<CuMemberWithdraw> {


    /**
     * 根据用户ID查询用户的提现次数
     *
     * @param pkMember 用户ID
     * @return Long
     */
    List<CuMemberWithdraw> getWithdrawTimes(@Param("pkMember") Long pkMember);


    List<CuMemberWithdrawExt> getWithdrawTimesByPkCountry(@Param("pkCountry") Integer pkCountry);

    /**
     * 按周期查询个税
     *
     * @param pkMember 用户ID
     * @param cycle    周期
     * @return CuMemberWithdraw
     */
    CuMemberWithdraw getIncomeTaxByCycle(@Param("pkMember") Long pkMember, @Param("cycle") Integer cycle);

    /**
     * 更新审核信息
     *
     * @param cuMemberWithdraw 提现信息
     * @return Integer
     */
    Integer updateWithdrawByCode(CuMemberWithdraw cuMemberWithdraw);

    /**
     * 查询列表信息
     *
     * @param cuMemberWithdrawVO 提现信息
     * @return List<CuMemberWithdrawExt>
     */
    List<CuMemberWithdrawExt> selectMemberWithdrawList(CuMemberWithdrawVO cuMemberWithdrawVO);

    /**
     * 查询列表总计信息
     *
     * @param cuMemberWithdrawVO 提现信息
     * @return List<CuMemberWithdrawExt>
     */
    CuMemberWithdrawExt selectMemberWithdrawListTotal(CuMemberWithdrawVO cuMemberWithdrawVO);


    /**
     * 根据条件查询提现总金额、个税
     *
     * @param cuMemberWithdrawVO
     * @return CuMemberWithdrawExt
     */
    CuMemberWithdrawExt selectMemberWithdrawListCount(CuMemberWithdrawVO cuMemberWithdrawVO);

    /**
     * 查询提现信息详情
     *
     * @param pkId
     * @return CuMemberWithdrawExt
     */
    CuMemberWithdrawExt queryCuMemberWithdrawDetail(@Param("pkId") Long pkId);


    /**
     * 打款
     *
     * @param cuMemberWithdraw 打款信息
     * @return Integer
     */
    Integer withdrawPaymentByPkId(CuMemberWithdrawExt cuMemberWithdraw);

    /**
     * @param pkIds        主键集合
     * @param approveState 审核状态
     * @return List<CuMemberWithdraw>
     */
    List<CuMemberWithdraw> getWithdrawApproveStateByIds(@Param("pkIds") List<Long> pkIds, @Param("approveState") Integer approveState);


    /**
     * 提现签呈显示
     *
     * @param pkIds
     * @return
     */
    List<CuMemberWithdrawExt> showMemberWithdrawPetition(@Param("pkIds") List<Long> pkIds, @Param("approveState") Integer approveState);


    /**
     * 会员端查询提现列表
     *
     * @param pkMember  会员编号
     * @param pkCountry 国家ID
     * @return List<CuMemberWithdrawExt>
     */
    List<CuMemberWithdrawExt> selectMemberWithdrawListByPkMember(@Param("pkMember") Long pkMember, @Param("pkCountry") Integer pkCountry);

    /**
     * 根据ID 修改提现状态
     *
     * @param pkId       主键ID
     * @param pkModified 修改人
     * @return Integer
     */
    Integer updateWithdrawStatusByPkId(@Param("pkId") Long pkId, @Param("pkModified") Long pkModified);
}
