package co.yixiang.yshop.module.member.dal.mysql.userlevelequityref;

import java.util.*;

import co.yixiang.yshop.framework.common.pojo.PageResult;
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
import co.yixiang.yshop.module.member.dal.dataobject.userlevelequity.UserLevelEquityDO;
import co.yixiang.yshop.module.member.dal.dataobject.userlevelequityref.UserLevelEquityRefDO;
import org.apache.ibatis.annotations.Mapper;
import co.yixiang.yshop.module.member.controller.admin.userlevelequityref.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 会员等级权益中间 Mapper
 *
 * @author admin
 */
@Mapper
public interface UserLevelEquityRefMapper extends BaseMapperX<UserLevelEquityRefDO> {

    default PageResult<UserLevelEquityRefDO> selectPage(UserLevelEquityRefPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserLevelEquityRefDO>()
                .eqIfPresent(UserLevelEquityRefDO::getLevelId, reqVO.getLevelId())
                .eqIfPresent(UserLevelEquityRefDO::getEquityId, reqVO.getEquityId())
                .betweenIfPresent(UserLevelEquityRefDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserLevelEquityRefDO::getId));
    }

    default List<UserLevelEquityRefDO> selectList(UserLevelEquityRefExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<UserLevelEquityRefDO>()
                .eqIfPresent(UserLevelEquityRefDO::getLevelId, reqVO.getLevelId())
                .eqIfPresent(UserLevelEquityRefDO::getEquityId, reqVO.getEquityId())
                .betweenIfPresent(UserLevelEquityRefDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserLevelEquityRefDO::getId));
    }

    List<UserLevelEquityDO> getUserLevelEquityList(@Param("levelId") Long levelId);
}
