package cn.newfeifan.mall.module.distri.dal.mysql.consumptiontopuplog;

import cn.newfeifan.mall.framework.common.pojo.PageResult;
import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;
import cn.newfeifan.mall.module.distri.controller.app.consumptiontopuplog.vo.ConsumptionTopUpLogPageReqVO;
import cn.newfeifan.mall.module.distri.dal.dataobject.consumptiontopuplog.ConsumptionTopUpLogDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 平台消费分充值记录 Mapper
 *
 * @author 非繁人
 */
@Mapper
public interface ConsumptionTopUpLogMapper extends BaseMapperX<ConsumptionTopUpLogDO> {

    default PageResult<ConsumptionTopUpLogDO> selectPage(ConsumptionTopUpLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ConsumptionTopUpLogDO>()
                .eqIfPresent(ConsumptionTopUpLogDO::getUserId, reqVO.getUserId())
                .eqIfPresent(ConsumptionTopUpLogDO::getAttachment, reqVO.getAttachment())
                .eqIfPresent(ConsumptionTopUpLogDO::getConsumptionPoints, reqVO.getConsumptionPoints())
                .eqIfPresent(ConsumptionTopUpLogDO::getPracticalConsumptionPoints, reqVO.getPracticalConsumptionPoints())
                .betweenIfPresent(ConsumptionTopUpLogDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(ConsumptionTopUpLogDO::getUserName, reqVO.getUserName())
                .orderByDesc(ConsumptionTopUpLogDO::getId));
    }

}