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.MemberCardIssuancePageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberCardIssuanceRecordDO;
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 MemberCardIssuanceRecordMapper extends BaseMapperX<MemberCardIssuanceRecordDO> {

    default PageResult<MemberCardIssuanceRecordDO> selectPage(MemberCardIssuancePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MemberCardIssuanceRecordDO>()
                .eqIfPresent(MemberCardIssuanceRecordDO::getMemberUserId, reqVO.getMemberUserId())
                .eqIfPresent(MemberCardIssuanceRecordDO::getType, reqVO.getType())
                .betweenIfPresent(MemberCardIssuanceRecordDO::getCreatedTime, reqVO.getChangeDate())
                .orderByDesc(MemberCardIssuanceRecordDO::getCreatedTime));
    }

    List<MemberCardIssuanceRecordDO> statisticsMemberCardIssuanceRecordPage(Page<MemberCardIssuanceRecordDO> page, @Param("params") MemberCardIssuancePageReqVO pageReqVO);
}