package com.yolo.keyboard.dal.mysql.userwallet;

import java.util.*;

import com.yolo.keyboard.framework.common.pojo.PageResult;
import com.yolo.keyboard.framework.common.pojo.PageParam;
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
import com.yolo.keyboard.dal.dataobject.userwallet.KeyboardWalletTransactionDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 钱包交易记录 Mapper
 *
 * @author Ziin
 */
@Mapper
public interface KeyboardWalletTransactionMapper extends BaseMapperX<KeyboardWalletTransactionDO> {

    default PageResult<KeyboardWalletTransactionDO> selectPage(PageParam reqVO, Long userId) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardWalletTransactionDO>()
            .eq(KeyboardWalletTransactionDO::getUserId, userId)
            .orderByDesc(KeyboardWalletTransactionDO::getId));
    }

    default int deleteByUserId(Long userId) {
        return delete(KeyboardWalletTransactionDO::getUserId, userId);
    }

	default int deleteByUserIds(List<Long> userIds) {
	    return deleteBatch(KeyboardWalletTransactionDO::getUserId, userIds);
	}

}