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

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 org.apache.ibatis.annotations.Mapper;
import co.yixiang.yshop.module.member.controller.admin.userlevelequity.vo.*;

/**
 * 会员等级权益配置 Mapper
 *
 * @author admin
 */
@Mapper
public interface UserLevelEquityMapper extends BaseMapperX<UserLevelEquityDO> {

    default PageResult<UserLevelEquityDO> selectPage(UserLevelEquityPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserLevelEquityDO>()
                .eqIfPresent(UserLevelEquityDO::getType, reqVO.getType())
                .likeIfPresent(UserLevelEquityDO::getTypeName, reqVO.getTypeName())
                .betweenIfPresent(UserLevelEquityDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(UserLevelEquityDO::getIconUrl, reqVO.getIconUrl())
                .orderByDesc(UserLevelEquityDO::getId));
    }

    default List<UserLevelEquityDO> selectList(UserLevelEquityExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<UserLevelEquityDO>()
                .eqIfPresent(UserLevelEquityDO::getType, reqVO.getType())
                .likeIfPresent(UserLevelEquityDO::getTypeName, reqVO.getTypeName())
                .betweenIfPresent(UserLevelEquityDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(UserLevelEquityDO::getIconUrl, reqVO.getIconUrl())
                .orderByDesc(UserLevelEquityDO::getId));
    }

}
