package com.ffii.fpsms.modules.stock.entity

import com.ffii.core.support.AbstractRepository
import org.springframework.data.jpa.repository.Query
import org.springframework.stereotype.Repository
import java.io.Serializable

@Repository
interface StockTakeRepository : AbstractRepository<StockTake, Long> {
    fun findByIdAndDeletedIsFalse(id: Serializable): StockTake;

    @Query("""
        select st.code from StockTake st where st.code like :prefix% order by st.code desc limit 1
    """)
    fun findLatestCodeByPrefix(prefix: String): String?
}