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

import java.util.*;

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

/**
 * 平台利润记录 Mapper
 *
 * @author 非繁人
 */
@Mapper
public interface PtProfitLogMapper extends BaseMapperX<PtProfitLogDO> {

    default PageResult<PtProfitLogDO> selectPage(PtProfitLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PtProfitLogDO>()
                .eqIfPresent(PtProfitLogDO::getAmount, reqVO.getAmount())
                .eqIfPresent(PtProfitLogDO::getAfterAmount, reqVO.getAfterAmount())
                .eqIfPresent(PtProfitLogDO::getPercentTemplate, reqVO.getPercentTemplate())
                .betweenIfPresent(PtProfitLogDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PtProfitLogDO::getProfitStatus, reqVO.getProfitStatus())
                .eqIfPresent(PtProfitLogDO::getUserId, reqVO.getUserId())
                .eqIfPresent(PtProfitLogDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(PtProfitLogDO::getOrderNo, reqVO.getOrderNo())
                .orderByDesc(PtProfitLogDO::getId));
    }
}