Interface UinRepository
-
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<UinEntity,String>,org.springframework.data.jpa.repository.JpaRepository<UinEntity,String>,org.springframework.data.repository.PagingAndSortingRepository<UinEntity,String>,org.springframework.data.repository.query.QueryByExampleExecutor<UinEntity>,org.springframework.data.repository.Repository<UinEntity,String>
@Repository public interface UinRepository extends org.springframework.data.jpa.repository.JpaRepository<UinEntity,String>
Repository having function to count free uins and find an unused uin- Since:
- 1.0.0
- Author:
- Dharmesh Khandelwal
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longcountByStatus(String status)Finds the number of free uins,longcountByStatusAndIsDeletedFalse(String status)List<UinEntity>findByStatus(String status)UinEntityfindByUin(String uin)find a UIN in poolUinEntityfindFirstByStatus(String status)Finds an unused uinvoidupdateStatus(String status, String contextUser, LocalDateTime uptimes, String uin)-
Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteById, existsById, findById, save
-
Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getOne, saveAll, saveAndFlush
-
-
-
-
Method Detail
-
countByStatus
long countByStatus(String status)
Finds the number of free uins,- Parameters:
status- status of the uin- Returns:
- the number of free uins
-
findFirstByStatus
@Query(value="select uu.uin, uu.cr_by, uu.cr_dtimes, uu.del_dtimes, uu.is_deleted, uu.upd_by, uu.upd_dtimes, uu.uin_status from kernel.uin uu where uu.uin_status=? limit 1 FOR UPDATE", nativeQuery=true) UinEntity findFirstByStatus(String status)Finds an unused uin- Parameters:
status- status of the uin- Returns:
- an unused uin
-
findByUin
UinEntity findByUin(String uin)
find a UIN in pool- Parameters:
uin- pass uin as param- Returns:
- an unused uin
-
updateStatus
@Modifying @Query(value="UPDATE kernel.uin SET uin_status=:status, upd_by=:contextUser, upd_dtimes=:uptimes where uin=:uin", nativeQuery=true) void updateStatus(@Param("status") String status, @Param("contextUser") String contextUser, @Param("uptimes") LocalDateTime uptimes, @Param("uin") String uin)
-
findByStatus
@Query(value="select uu.uin, uu.cr_by, uu.cr_dtimes, uu.del_dtimes, uu.is_deleted, uu.upd_by, uu.upd_dtimes, uu.uin_status from kernel.uin uu where uu.uin_status=?", nativeQuery=true) List<UinEntity> findByStatus(String status)
-
countByStatusAndIsDeletedFalse
long countByStatusAndIsDeletedFalse(String status)
-
-