package com.ffii.fpsms.modules.pickOrder.entity

import com.ffii.core.support.AbstractRepository
import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.query.Param
import org.springframework.stereotype.Repository

@Repository
interface RouterOrderRepository : AbstractRepository<RouterOrder, Long> {
    
    @Query("SELECT ro FROM RouterOrder ro WHERE ro.routeArea = :routeArea AND ro.deleted = false")
    fun findByRouteAreaAndDeletedFalse(@Param("routeArea") routeArea: String): RouterOrder?
    
    @Query("SELECT ro FROM RouterOrder ro WHERE ro.deleted = false ORDER BY ro.order ASC")
    fun findAllByDeletedFalseOrderByOrder(): List<RouterOrder>
}