package co.yixiang.yshop.module.shop.dal.mysql.popup;

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.shop.controller.admin.popup.param.PopupCheckParam;
import co.yixiang.yshop.module.shop.dal.dataobject.popup.PopupDO;
import org.apache.ibatis.annotations.Mapper;
import co.yixiang.yshop.module.shop.controller.admin.popup.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 弹窗 Mapper
 *
 * @author moxiangrong
 */
@Mapper
public interface PopupMapper extends BaseMapperX<PopupDO> {

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

    List<Long> checkPopup(@Param("param") PopupCheckParam param);

}
