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.dal.dataobject.integraltopuplog.IntegralTopUpLogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.newfeifan.mall.module.distri.controller.admin.integraltopuplog.vo.*;

import java.util.List;

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

    default PageResult<IntegralTopUpLogDO> selectPage(IntegralTopUpLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IntegralTopUpLogDO>()
                .eqIfPresent(IntegralTopUpLogDO::getUserId, reqVO.getUserId())
                .eqIfPresent(IntegralTopUpLogDO::getAttachment, reqVO.getAttachment())
                .eqIfPresent(IntegralTopUpLogDO::getIntegralPoints, reqVO.getIntegralPoints())
                .eqIfPresent(IntegralTopUpLogDO::getPracticalIntegralPoints, reqVO.getPracticalIntegralPoints())
                .betweenIfPresent(IntegralTopUpLogDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(IntegralTopUpLogDO::getUserName, reqVO.getUserName())
                .orderByDesc(IntegralTopUpLogDO::getId));
    }

    List<TopUpRespVO> ptTopUpWithUserTopUpList();

    Long getTotalConsumptionPoints();
}