package cn.iocoder.yudao.module.system.dal.mysql.reservation;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.reservation.vo.ReservationBedPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.reservation.ReservationBedDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 长者预约床位 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface ReservationBedMapper extends BaseMapperX<ReservationBedDO> {

    default PageResult<ReservationBedDO> selectPage(ReservationBedPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ReservationBedDO>()
                .likeIfPresent(ReservationBedDO::getElderName, reqVO.getElderName())
                .likeIfPresent(ReservationBedDO::getRelativeName, reqVO.getRelativeName())
                .eqIfPresent(ReservationBedDO::getRelativePhone, reqVO.getRelativePhone())
                .eqIfPresent(ReservationBedDO::getRelation, reqVO.getRelation())
                .eqIfPresent(ReservationBedDO::getReservationCheckInTime, reqVO.getReservationCheckInTime())
                .eqIfPresent(ReservationBedDO::getBedId, reqVO.getBedId())
                .eqIfPresent(ReservationBedDO::getSalesperson, reqVO.getSalesperson())
                .eqIfPresent(ReservationBedDO::getSourceChannel, reqVO.getSourceChannel())
                .eqIfPresent(ReservationBedDO::getStatus, reqVO.getStatus())
                .eqIfPresent(ReservationBedDO::getOrgType, reqVO.getOrgType())
                .eqIfPresent(ReservationBedDO::getPayStatus,reqVO.getPayStatus())
                .inIfPresent(ReservationBedDO::getTenantId,reqVO.getTenantIds())
                .orderByDesc(ReservationBedDO::getCreateTime));
    }

}