getting started

This commit is contained in:
androidlover5842
2026-01-24 14:42:07 +05:30
commit a5a6aa4999
29 changed files with 1133 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
package com.android.trisolarisserver.db.repo
import com.android.trisolarisserver.models.property.*
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.query.Param
import java.util.UUID
interface PropertyUserRepo : JpaRepository<PropertyUser, PropertyUserId> {
fun existsByIdPropertyIdAndIdUserId(propertyId: UUID, userId: UUID): Boolean
@Query("""
select case when count(pu) > 0 then true else false end
from PropertyUser pu join pu.roles r
where pu.id.propertyId = :propertyId
and pu.id.userId = :userId
and r in :roles
""")
fun hasAnyRole(
@Param("propertyId") propertyId: UUID,
@Param("userId") userId: UUID,
@Param("roles") roles: Set<Role>
): Boolean
}