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


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

/**
 * 推荐用户 Mapper
 *
 * @author 非繁人
 */
@Mapper
public interface DuserMapper extends BaseMapperX<DuserDO> {


    default PageResult<DuserDO> selectPage(DuserPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DuserDO>()
                .eqIfPresent(DuserDO::getUserId, reqVO.getUserId())
                .likeIfPresent(DuserDO::getName, reqVO.getName())
                .eqIfPresent(DuserDO::getMobile, reqVO.getMobile())
                .eqIfPresent(DuserDO::getIntegralId, reqVO.getIntegralId())
                .eqIfPresent(DuserDO::getSocialStatus, reqVO.getSocialStatus())
                .eqIfPresent(DuserDO::getSocialStatusPoint, reqVO.getSocialStatusPoint())
                .betweenIfPresent(DuserDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DuserDO::getSource, reqVO.getSource())
                .eqIfPresent(DuserDO::getSocialUpNeed, reqVO.getSocialUpNeed())
                .eqIfPresent(DuserDO::getCategoryId, reqVO.getCategoryId())
                .likeIfPresent(DuserDO::getNickName, reqVO.getNickName())
                .orderByAsc(DuserDO::getId));
    }
    int hasParent(Long userId);
}