more codes

This commit is contained in:
androidlover5842
2026-01-24 22:22:37 +05:30
parent 0d3472c60e
commit 6b6d84e40a
12 changed files with 614 additions and 228 deletions

View File

@@ -0,0 +1,10 @@
package com.android.trisolarisserver.repo
import com.android.trisolarisserver.models.room.RoomImage
import org.springframework.data.jpa.repository.JpaRepository
import java.util.UUID
interface RoomImageRepo : JpaRepository<RoomImage, UUID> {
fun findByRoomIdOrderByCreatedAtDesc(roomId: UUID): List<RoomImage>
fun findByIdAndRoomIdAndPropertyId(id: UUID, roomId: UUID, propertyId: UUID): RoomImage?
}

View File

@@ -14,4 +14,17 @@ interface RoomStayRepo : JpaRepository<RoomStay, UUID> {
and rs.toAt is null
""")
fun findOccupiedRoomIds(@Param("propertyId") propertyId: UUID): List<UUID>
@Query("""
select distinct rs.room.id
from RoomStay rs
where rs.property.id = :propertyId
and rs.fromAt < :toAt
and (rs.toAt is null or rs.toAt > :fromAt)
""")
fun findOccupiedRoomIdsBetween(
@Param("propertyId") propertyId: UUID,
@Param("fromAt") fromAt: java.time.OffsetDateTime,
@Param("toAt") toAt: java.time.OffsetDateTime
): List<UUID>
}