package com.prolog.rdc.tms.dao.mapper;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import com.prolog.framework.dao.mapper.BaseMapper;
import com.prolog.rdc.tms.model.dto.BookingQueryDTO;
import com.prolog.rdc.tms.model.dto.BranchAppointmentInfoDTO;
import com.prolog.rdc.tms.model.dto.TimeCountDTO;
import com.prolog.rdc.tms.model.entity.TmsAppointmentHeaderModel;
import com.prolog.rdc.tms.model.vo.AppointmentHeadQueryVO;
import com.prolog.rdc.tms.model.vo.BookingAdvancedQueryVO;
import com.prolog.rdc.tms.model.vo.CallNumberQueryVO;
import com.prolog.rdc.tms.model.vo.PickUpAppointmentConfirmVO;

/**
 * 预约单汇总数据库访问层
 *
 * @author xiaoyf
 * @since 2022-04-13 14:13:38
 */
@Repository
public interface TmsAppointmentHeaderMapper extends BaseMapper<TmsAppointmentHeaderModel> {

	/**
	 * 仓库已预约信息查询
	 *
	 * @param queryVO
	 * @return
	 */
	List<BranchAppointmentInfoDTO> queryBranchAppointmentInfo(@Param("vo") AppointmentHeadQueryVO queryVO);

	/**
	 * 仓库最大已预约号查询
	 *
	 * @param confirmVO
	 * @return
	 */
	String queryMaxReserveNumber(@Param("vo") PickUpAppointmentConfirmVO confirmVO);

	/**
	 * 预约管理-高级查询
	 *
	 * @param bookingAdvancedQueryVO
	 * @return
	 */
	List<BookingQueryDTO> bookingAdvancedQuery(@Param("vo") BookingAdvancedQueryVO bookingAdvancedQueryVO);

	/**
	 * 仓库各预约时间段排队数查询
	 *
	 * @param
	 * @return
	 */
	List<TimeCountDTO> queryTimeCount(@Param("vo") CallNumberQueryVO vo);

	/**
	 * 叫号查询预约单
	 *
	 * @param
	 * @return
	 */
	List<TmsAppointmentHeaderModel> callNumberQuery(@Param("enterpriseId") Long enterpriseId, @Param("branchId") Long branchId, @Param("appDate") Date appDate, @Param("appointmentNo") String appointmentNo, @Param("appointmentType") Integer appointmentType, @Param("branchName") String branchName, @Param("driverName") String driverName, @Param("appointmentTime") String appointmentTime);

	/**
	 * 查询装卸中的预约单
	 *
	 * @param
	 * @return
	 */
	List<TmsAppointmentHeaderModel> callNumberQueryLoading(@Param("enterpriseId") Long enterpriseId, @Param("branchId") Long branchId, @Param("appDate") Date appDate);

}
