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


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.*;

import java.util.Arrays;
import java.util.List;

import static cn.newfeifan.mall.module.distri.constant.DistriConstants.PT_ID;
import static cn.newfeifan.mall.module.distri.enums.CaclEnum.*;
import static cn.newfeifan.mall.module.distri.enums.CaclEnum.COMMISSION_TRANSITION;

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

    default PageResult<PtProfitLogDO> selectPage(PtProfitLogPageReqVO reqVO) {
        LambdaQueryWrapperX<PtProfitLogDO> queryWrapper = new LambdaQueryWrapperX<PtProfitLogDO>()
                .eq(PtProfitLogDO::getProfitType, reqVO.getProfitType())
                .eqIfPresent(PtProfitLogDO::getGenerateUserId, reqVO.getGenerateUserId())
                .orderByDesc(PtProfitLogDO::getCreateTime)
                .orderByDesc(PtProfitLogDO::getId);

        return selectPage(reqVO, queryWrapper
        );
    }
}