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.MemberCardConsumptionPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberCardConsumptionDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 会员卡消费 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface MemberCardConsumptionMapper extends BaseMapperX<MemberCardConsumptionDO> {

    default PageResult<MemberCardConsumptionDO> selectPage(MemberCardConsumptionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MemberCardConsumptionDO>()
                .eqIfPresent(MemberCardConsumptionDO::getMemberUserId, reqVO.getMemberUserId())
                .likeIfPresent(MemberCardConsumptionDO::getMemberUserName, reqVO.getMemberUserName())
                .likeIfPresent(MemberCardConsumptionDO::getCardName, reqVO.getCardName())
                .eqIfPresent(MemberCardConsumptionDO::getCardNumber, reqVO.getCardNumber())
                .eqIfPresent(MemberCardConsumptionDO::getOrderNum, reqVO.getOrderNum())
                .likeIfPresent(MemberCardConsumptionDO::getItemName, reqVO.getItemName())
                .eqIfPresent(MemberCardConsumptionDO::getAmount, reqVO.getAmount())
                .eqIfPresent(MemberCardConsumptionDO::getStatus, reqVO.getStatus())
                .eqIfPresent(MemberCardConsumptionDO::getCreatedBy, reqVO.getCreatedBy())
                .betweenIfPresent(MemberCardConsumptionDO::getCreatedTime, reqVO.getCreatedTime())
                .betweenIfPresent(MemberCardConsumptionDO::getCancelTime, reqVO.getCancelTime())
                .eqIfPresent(MemberCardConsumptionDO::getRemarks, reqVO.getRemarks())
                .eqIfPresent(MemberCardConsumptionDO::getOrgType,reqVO.getOrgType())
                .eqIfPresent(MemberCardConsumptionDO::getTenantId,reqVO.getTenantId())
                .orderByDesc(MemberCardConsumptionDO::getCreatedTime));
    }

}