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

import java.util.*;

import com.yolo.keyboard.framework.common.pojo.PageResult;
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.KeyboardUserWalletDO;
import org.apache.ibatis.annotations.Mapper;
import com.yolo.keyboard.controller.admin.userwallet.vo.*;

/**
 * 用户钱包 Mapper
 *
 * @author ziin
 */
@Mapper
public interface KeyboardUserWalletMapper extends BaseMapperX<KeyboardUserWalletDO> {

    default PageResult<KeyboardUserWalletDO> selectPage(KeyboardUserWalletPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardUserWalletDO>()
                .eqIfPresent(KeyboardUserWalletDO::getUserId, reqVO.getUserId())
                .eqIfPresent(KeyboardUserWalletDO::getBalance, reqVO.getBalance())
                .eqIfPresent(KeyboardUserWalletDO::getVersion, reqVO.getVersion())
                .eqIfPresent(KeyboardUserWalletDO::getStatus, reqVO.getStatus())
                .eqIfPresent(KeyboardUserWalletDO::getCreatedAt, reqVO.getCreatedAt())
                .eqIfPresent(KeyboardUserWalletDO::getUpdatedAt, reqVO.getUpdatedAt())
                .orderByDesc(KeyboardUserWalletDO::getId));
    }

}