package cn.iocoder.yudao.module.member.dal.mysql.activityvoucher;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.activityvoucher.ActivityVoucherDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.activityvoucher.vo.*;

/**
 * 活动代金券 Mapper
 *
 * @author 我是秦俊旗
 */
@Mapper
public interface ActivityVoucherMapper extends BaseMapperX<ActivityVoucherDO> {

    default PageResult<ActivityVoucherDO> selectPage(ActivityVoucherPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ActivityVoucherDO>()
                .likeIfPresent(ActivityVoucherDO::getName, reqVO.getName())
                .eqIfPresent(ActivityVoucherDO::getType, reqVO.getType())
                .eqIfPresent(ActivityVoucherDO::getNum, reqVO.getNum())
                .eqIfPresent(ActivityVoucherDO::getLimitNum, reqVO.getLimitNum())
                .betweenIfPresent(ActivityVoucherDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ActivityVoucherDO::getId));
    }

}