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

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.AppointmentPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.reservation.VisitAppointmentDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 长者来访预约 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface VisitAppointmentMapper extends BaseMapperX<VisitAppointmentDO> {

    default PageResult<VisitAppointmentDO> selectPage(AppointmentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VisitAppointmentDO>()
                .eqIfPresent(VisitAppointmentDO::getAppointmentPurpose, reqVO.getAppointmentPurpose())
                .eqIfPresent(VisitAppointmentDO::getAppointedBy, reqVO.getAppointedBy())
                .betweenIfPresent(VisitAppointmentDO::getAppointmentDate, reqVO.getAppointmentDate())
                .eqIfPresent(VisitAppointmentDO::getAppointmentForm, reqVO.getAppointmentForm())
                .eqIfPresent(VisitAppointmentDO::getGender, reqVO.getGender())
                .eqIfPresent(VisitAppointmentDO::getPhone, reqVO.getPhone())
                .eqIfPresent(VisitAppointmentDO::getAppointmentInstructions, reqVO.getAppointmentInstructions())
                .eqIfPresent(VisitAppointmentDO::getRelation, reqVO.getRelation())
                .eqIfPresent(VisitAppointmentDO::getBedId, reqVO.getBedId())
                .likeIfPresent(VisitAppointmentDO::getElderName, reqVO.getElderName())
                .eqIfPresent(VisitAppointmentDO::getStatus, reqVO.getStatus())
                .eqIfPresent(VisitAppointmentDO::getIdNumber, reqVO.getIdNumber())
                .betweenIfPresent(VisitAppointmentDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(VisitAppointmentDO::getOrgType, reqVO.getOrgType())
                .likeIfPresent(VisitAppointmentDO::getSalesperson,reqVO.getSalesperson())
                .inIfPresent(VisitAppointmentDO::getTenantId,reqVO.getTenantIds())
                .orderByDesc(VisitAppointmentDO::getCreateTime));
    }

}