package com.ffii.fpsms.modules.deliveryOrder.entity

import com.ffii.core.support.AbstractRepository
import com.ffii.fpsms.modules.deliveryOrder.entity.models.DeliveryOrderInfo
import com.ffii.fpsms.modules.deliveryOrder.enums.DeliveryOrderStatus
import com.ffii.fpsms.modules.deliveryOrder.enums.DoPickOrderStatus
import com.ffii.fpsms.modules.master.entity.projections.SearchId
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Query
import org.springframework.stereotype.Repository
import java.io.Serializable
import java.time.LocalDateTime
import java.time.LocalDate
@Repository
interface DoPickOrderRepository : JpaRepository<DoPickOrder, Long> {
    fun findByTicketNoStartingWith(prefix: String): List<DoPickOrder>
    fun findByStoreIdAndTicketStatusOrderByTruckDepartureTimeAsc(
        storeId: String, 
        status: DoPickOrderStatus
    ): List<DoPickOrder>
    fun findByPickOrderId(pickOrderId: Long): List<DoPickOrder>

    fun findByTicketStatusIn(statuses: List<DoPickOrderStatus>): List<DoPickOrder>
    // 在 DoPickOrderRepository 中添加这个方法
fun findByHandledByAndTicketStatusIn(handledBy: Long, status: List<DoPickOrderStatus>): List<DoPickOrder>
fun findByStoreIdAndTicketStatusIn(storeId: String, status: List<DoPickOrderStatus>): List<DoPickOrder>
fun findByStoreIdAndRequiredDeliveryDateAndTicketStatusIn(
    storeId: String, 
    requiredDeliveryDate: LocalDate,
    status: List<DoPickOrderStatus>
): List<DoPickOrder>
}