package com.game.business.mapper;

import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.game.business.domain.AppUsersCashrecord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 提现记录Mapper接口
 *
 * @author game
 * @date 2024-06-18
 */
public interface AppUsersCashrecordMapper extends BaseMapper<AppUsersCashrecord> {
    /**
     * 查询提现记录
     *
     * @param id 提现记录主键
     * @return 提现记录
     */
    public AppUsersCashrecord selectAppUsersCashrecordById(Long id);

    /**
     * 查询提现记录列表
     *
     * @param appUsersCashrecord 提现记录
     * @return 提现记录集合
     */
    public List<AppUsersCashrecord> selectAppUsersCashrecordList(AppUsersCashrecord appUsersCashrecord);

    /**
     * 新增提现记录
     *
     * @param appUsersCashrecord 提现记录
     * @return 结果
     */
    public int insertAppUsersCashrecord(AppUsersCashrecord appUsersCashrecord);

    /**
     * 修改提现记录
     *
     * @param appUsersCashrecord 提现记录
     * @return 结果
     */
    public int updateAppUsersCashrecord(AppUsersCashrecord appUsersCashrecord);

    /**
     * 删除提现记录
     *
     * @param id 提现记录主键
     * @return 结果
     */
    public int deleteAppUsersCashrecordById(Long id);

    /**
     * 批量删除提现记录
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteAppUsersCashrecordByIds(Long[] ids);

    @Select("select IFNULL(sum(money),0) from app_users_cashrecord where status = 1 and cash_out_status in(1,0) and uid = #{userId}")
    public Double sumWithdraw(@Param("userId") Long userId);
}