package cn.iocoder.yudao.module.member.dal.mysql.money;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.money.MoneyDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.money.vo.*;

/**
 * 金额 Mapper
 *
 * @author 秦俊旗
 */
@Mapper
public interface MoneyMapper extends BaseMapperX<MoneyDO> {

    default PageResult<MoneyDO> selectPage(MoneyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MoneyDO>()
                .eqIfPresent(MoneyDO::getUserId, reqVO.getUserId())
                .eqIfPresent(MoneyDO::getCarteenId, reqVO.getCarteenId())
                .eqIfPresent(MoneyDO::getCashAmount, reqVO.getCashAmount())
                .eqIfPresent(MoneyDO::getDebtAmount, reqVO.getDebtAmount())
                .betweenIfPresent(MoneyDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MoneyDO::getId));
    }

}