Updated code
This commit is contained in:
@@ -54,13 +54,14 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
|
||||
|
||||
@Query("SELECT SUM(a.amountRequested) " +
|
||||
"FROM ApplicationEntity a " +
|
||||
"WHERE a.hubId = :hubId AND a.status = 'SUBMIT'")
|
||||
"WHERE a.hubId = :hubId AND a.status IN ('SUBMIT', 'SOCCORSO', 'APPROVED', 'EVALUATION', 'APPOINTMENT', 'NDG', 'ADMISSIBLE','REJECTED')")
|
||||
BigDecimal findTotalAmountRequestedOfApplication(@Param("hubId") Long hubId);
|
||||
|
||||
@Query("SELECT SUM(a.amountAccepted) " +
|
||||
"FROM ApplicationEntity a " +
|
||||
"WHERE a.hubId = :hubId AND a.status = 'APPROVED'")
|
||||
BigDecimal findTotalAmountAcceptedOfApplication(@Param("hubId") Long hubId);
|
||||
|
||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.status = 'SUBMIT' AND a.isDeleted = false")
|
||||
public Long countApplicationsByHubId(@Param("hubId") Long hubId);
|
||||
|
||||
|
||||
@@ -13,27 +13,6 @@ import java.util.List;
|
||||
@Repository
|
||||
public interface UserActionsRepository extends JpaRepository<UserActionEntity, Long> {
|
||||
UserActionEntity findUserActionById(Long id);
|
||||
|
||||
//
|
||||
// @Query("SELECT ua FROM UserActionEntity ua " +
|
||||
// "JOIN ua.user u " +
|
||||
// "WHERE u.roleEntity.roleType IN :roleNames " +
|
||||
// "AND ua.hub.id = :hubId " +
|
||||
// "AND ua.isDeleted = false")
|
||||
// Page<UserActionEntity> findActionsByRoleNamesAndHubId(
|
||||
// @Param("roleNames") List<String> roleNames,
|
||||
// @Param("hubId") Long hubId, Pageable pageable);
|
||||
|
||||
@Query("SELECT ua FROM UserActionEntity ua " +
|
||||
"JOIN UserEntity u ON ua.userId = u.id " + // Join on userId field
|
||||
"JOIN u.roleEntity r " + // Join the RoleEntity via the UserEntity
|
||||
"WHERE r.roleType IN :roleNames " + // Filter by role name
|
||||
"AND ua.hubId = :hubId " + // Filter by hubId
|
||||
"AND ua.isDeleted = false")
|
||||
Page<UserActionEntity> findActionsByRoleNamesAndHubId(
|
||||
@Param("roleNames") List<String> roleNames,
|
||||
@Param("hubId") Long hubId,
|
||||
Pageable pageable);
|
||||
|
||||
|
||||
UserActionEntity findUserActionByIdAndIsDeletedFalse(Long id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user