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


import cn.newfeifan.mall.framework.common.pojo.PageResult;
import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;
import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.newfeifan.mall.module.distri.controller.admin.ptdailybill.vo.*;
import cn.newfeifan.mall.module.distri.dal.dataobject.ptdailybill.PtDailyBillDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 平台每日账单统计 Mapper
 *
 * @author 非繁人
 */
@Mapper
public interface PtDailyBillMapper extends BaseMapperX<PtDailyBillDO> {

    default PageResult<PtDailyBillDO> selectPage(PtDailyBillPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PtDailyBillDO>()
                .eqIfPresent(PtDailyBillDO::getOrderCount, reqVO.getOrderCount())
                .eqIfPresent(PtDailyBillDO::getIntegral, reqVO.getIntegral())
                .eqIfPresent(PtDailyBillDO::getReceivedIntegral, reqVO.getReceivedIntegral())
                .eqIfPresent(PtDailyBillDO::getRefundIntegral, reqVO.getRefundIntegral())
                .betweenIfPresent(PtDailyBillDO::getOrderCalcTime, reqVO.getOrderCalcTime())
                .eqIfPresent(PtDailyBillDO::getOrderIds, reqVO.getOrderIds())
                .betweenIfPresent(PtDailyBillDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PtDailyBillDO::getId));
    }

}