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

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

/**
 * 推荐用户积分 Mapper
 *
 * @author 非繁人
 */
@Mapper
public interface IntegralMapper extends BaseMapperX<IntegralDO> {

    default PageResult<IntegralDO> selectPage(IntegralPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IntegralDO>()
                .eqIfPresent(IntegralDO::getUserId, reqVO.getUserId())
                .eqIfPresent(IntegralDO::getCategoryId, reqVO.getCategoryId())
                .betweenIfPresent(IntegralDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(IntegralDO::getName, reqVO.getName())
                .likeIfPresent(IntegralDO::getNickName, reqVO.getNickName())
                .eqIfPresent(IntegralDO::getCurrentQuota, reqVO.getCurrentQuota())
                .eqIfPresent(IntegralDO::getFreezeQuota, reqVO.getFreezeQuota())
                .eqIfPresent(IntegralDO::getHighQuota, reqVO.getHighQuota())
                .orderByDesc(IntegralDO::getId));
    }
}