package com.jojubanking.boot.module.system.dal.mysql.carousel;

import java.util.*;

import com.jojubanking.boot.framework.common.pojo.PageResult;
import com.jojubanking.boot.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.jojubanking.boot.framework.mybatis.core.mapper.BaseMapperX;
import com.jojubanking.boot.module.system.dal.dataobject.carousel.CarouselDO;
import org.apache.ibatis.annotations.Mapper;
import com.jojubanking.boot.module.system.controller.admin.carousel.vo.*;

/**
 * 轮播图 Mapper
 *
 * @author admin
 */
@Mapper
public interface CarouselMapper extends BaseMapperX<CarouselDO> {

    default PageResult<CarouselDO> selectPage(CarouselPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CarouselDO>()
                .eqIfPresent(CarouselDO::getTitle, reqVO.getTitle())
                .eqIfPresent(CarouselDO::getImg, reqVO.getImg())
                .eqIfPresent(CarouselDO::getType, reqVO.getType())
                .betweenIfPresent(CarouselDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CarouselDO::getId));
    }

    default List<CarouselDO> selectList(CarouselExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<CarouselDO>()
                .eqIfPresent(CarouselDO::getTitle, reqVO.getTitle())
                .eqIfPresent(CarouselDO::getImg, reqVO.getImg())
                .eqIfPresent(CarouselDO::getType, reqVO.getType())
                .betweenIfPresent(CarouselDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CarouselDO::getId));
    }

}
