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


import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;

import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberCardChangePageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberCardChangeRecordDO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;


/**
 * 会员卡充值记录 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface MemberCardChangeRecordMapper extends BaseMapperX<MemberCardChangeRecordDO> {

    default PageResult<MemberCardChangeRecordDO> selectPage(MemberCardChangePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MemberCardChangeRecordDO>()
                .eqIfPresent(MemberCardChangeRecordDO::getMemberUserId, reqVO.getMemberUserId())
                .likeIfPresent(MemberCardChangeRecordDO::getCardName, reqVO.getMemberCardName())
                .eqIfPresent(MemberCardChangeRecordDO::getType, reqVO.getType())
                .betweenIfPresent(MemberCardChangeRecordDO::getCreatedTime, reqVO.getChangeDate())
                .orderByDesc(MemberCardChangeRecordDO::getCreatedTime));
    }

    List<MemberCardChangeRecordDO> statisticsMemberCardConsumptionRecordPage(Page<MemberCardChangeRecordDO> page, @Param("params") MemberCardChangePageReqVO pageReqVO);

    List<MemberCardChangeRecordDO> statisticsRechargeAmount(@Param("params") MemberCardChangePageReqVO pageReqVO);
}