@Repository public interface BoundaryRepository extends org.springframework.data.jpa.repository.JpaRepository<Boundary,Long>
deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAll, flush, getOne, save, saveAndFlushfindAllList<Boundary> findBoundariesByBoundaryType(@Param(value="boundaryTypeId") Long boundaryTypeId)
Boundary findBoundarieByBoundaryTypeAndBoundaryNum(@Param(value="boundaryType") BoundaryType boundaryType, @Param(value="boundaryNum") Long boundaryNum)
@Query(value="select b from Boundary b where b.isHistory=false AND b.boundaryType.id =:boundaryTypeId order by b.name") List<Boundary> findActiveBoundariesByBoundaryTypeId(@Param(value="boundaryTypeId") Long boundaryTypeId)
@Query(value="select b from Boundary b where b.isHistory=false AND b.boundaryType.hierarchyType = :hierarchyType AND b.boundaryType.hierarchy = :hierarchyLevel AND ((b.toDate IS NULL AND b.fromDate <= :asOnDate) OR (b.toDate IS NOT NULL AND b.fromDate <= :asOnDate AND b.toDate >= :asOnDate)) order by b.name") List<Boundary> findActiveBoundariesByHierarchyTypeAndLevelAndAsOnDate(@Param(value="hierarchyType") HierarchyType hierarchyType, @Param(value="hierarchyLevel") Long hierarchyLevel, @Param(value="asOnDate") Date asOnDate)
@Query(value="select b from Boundary b where b.isHistory=false AND b.parent is not null AND b.parent.id = :parentBoundaryId AND ((b.toDate IS NULL AND b.fromDate <= :asOnDate) OR (b.toDate IS NOT NULL AND b.fromDate <= :asOnDate AND b.toDate >= :asOnDate)) order by b.name") List<Boundary> findActiveChildBoundariesByBoundaryIdAndAsOnDate(@Param(value="parentBoundaryId") Long parentBoundaryId, @Param(value="asOnDate") Date asOnDate)
@Query(value="from Boundary BND where BND.isHistory=false AND BND.materializedPath like (select B.materializedPath from Boundary B where B.id=:parentId)||\'%\'") List<Boundary> findActiveChildrenWithParent(@Param(value="parentId") Long parentId)
@Query(value="from Boundary BND where BND.isHistory=false AND BND.materializedPath in :mpath ") List<Boundary> findActiveBoundariesForMpath(@Param(value="mpath") Set<String> mpath)
@Query(value="select b from Boundary b where b.parent is not null AND b.parent.id = :parentBoundaryId AND ((b.toDate IS NULL AND b.fromDate <= :asOnDate) OR (b.toDate IS NOT NULL AND b.fromDate <= :asOnDate AND b.toDate >= :asOnDate)) order by b.name") List<Boundary> findChildBoundariesByBoundaryIdAndAsOnDate(@Param(value="parentBoundaryId") Long parentBoundaryId, @Param(value="asOnDate") Date asOnDate)
@Query(value="select b from Boundary b where b.isHistory=false AND b.boundaryNum = :boundaryNum AND b.boundaryType.name = :boundaryType AND upper(b.boundaryType.hierarchyType.code) = :hierarchyTypeCode AND ((b.toDate IS NULL AND b.fromDate <= :asOnDate) OR (b.toDate IS NOT NULL AND b.fromDate <= :asOnDate AND b.toDate >= :asOnDate))") Boundary findActiveBoundaryByBndryNumAndTypeAndHierarchyTypeCodeAndAsOnDate(@Param(value="boundaryNum") Long boundaryNum, @Param(value="boundaryType") String boundaryType, @Param(value="hierarchyTypeCode") String hierarchyTypeCode, @Param(value="asOnDate") Date asOnDate)
@Query(value="select b from Boundary b where b.isHistory=false AND upper(b.boundaryType.name) = upper(:boundaryTypeName) AND upper(b.boundaryType.hierarchyType.name) = upper(:hierarchyTypeName) order by b.name") List<Boundary> findActiveBoundariesByBndryTypeNameAndHierarchyTypeName(@Param(value="boundaryTypeName") String boundaryTypeName, @Param(value="hierarchyTypeName") String hierarchyTypeName)
@Query(value="select b from Boundary b where upper(b.boundaryType.name) = UPPER(:boundaryTypeName) AND upper(b.boundaryType.hierarchyType.name) = UPPER(:hierarchyTypeName) order by b.id") List<Boundary> findBoundariesByBndryTypeNameAndHierarchyTypeName(@Param(value="boundaryTypeName") String boundaryTypeName, @Param(value="hierarchyTypeName") String hierarchyTypeName)
@Query(value="select b from Boundary b where upper(b.boundaryType.name) = UPPER(:boundaryTypeName) AND upper(b.boundaryType.hierarchyType.name) = UPPER(:hierarchyTypeName) order by b.id") Boundary findBoundaryByBndryTypeNameAndHierarchyTypeName(@Param(value="boundaryTypeName") String boundaryTypeName, @Param(value="hierarchyTypeName") String hierarchyTypeName)
@Query(value="select b from Boundary b where b.isHistory=false and UPPER(b.name) like UPPER(:boundaryName) and b.boundaryType.id=:boundaryTypeId order by b.boundaryNum asc") List<Boundary> findByNameAndBoundaryTypeOrderByBoundaryNumAsc(@Param(value="boundaryName") String boundaryName, @Param(value="boundaryTypeId") Long boundaryTypeId)
@Query(value="select b from Boundary b where b.boundaryType.name=:boundaryType and b.boundaryType.hierarchyType.name=:hierarchyType and b.boundaryType.hierarchy=:hierarchyLevel") Boundary findByBoundaryTypeNameAndHierarchyTypeNameAndLevel(@Param(value="boundaryType") String boundaryType, @Param(value="hierarchyType") String hierarchyType, @Param(value="hierarchyLevel") Long hierarchyLevel)
@Query(value="select b from Boundary b where b.isHistory=false AND upper(b.boundaryType.name) = upper(:boundaryTypeName) AND upper(b.boundaryType.hierarchyType.name) = upper(:hierarchyTypeName) AND UPPER(b.name) like UPPER(:name)||\'%\' order by b.id") List<Boundary> findActiveBoundariesByNameAndBndryTypeNameAndHierarchyTypeName(@Param(value="boundaryTypeName") String boundaryTypeName, @Param(value="hierarchyTypeName") String hierarchyTypeName, @Param(value="name") String name)
@Query(value="from Boundary BND where BND.isHistory=false AND BND.parent.id=:parentId)") List<Boundary> findActiveImmediateChildrenWithOutParent(@Param(value="parentId") Long parentId)
@Query(value="from Boundary BND where BND.parent is null") List<Boundary> findAllParents()
List<Boundary> findByBoundaryTypeOrderByBoundaryNumAsc(BoundaryType boundaryType)
Copyright © 2015–2017 eGovernments Foundation. All rights reserved.