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

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.carousel.CarouselDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.carousel.vo.*;

/**
 * 小程序轮播图 Mapper
 *
 * @author 秦俊旗
 */
@Mapper
public interface CarouselMapper extends BaseMapperX<CarouselDO> {

    default PageResult<CarouselDO> selectPage(CarouselPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CarouselDO>()
                .likeIfPresent(CarouselDO::getName, reqVO.getName())
                .eqIfPresent(CarouselDO::getUrl, reqVO.getUrl())
                .eqIfPresent(CarouselDO::getState, reqVO.getState())
                .betweenIfPresent(CarouselDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CarouselDO::getId));
    }

}