Resolve Conflicts
This commit is contained in:
@@ -8,6 +8,8 @@ import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -38,4 +40,27 @@ public interface ApplicationEvaluationRepository extends JpaRepository<Applicati
|
||||
"AND a.status NOT IN ('CLOSE', 'EXPIRED') " +
|
||||
"AND a.endDate BETWEEN :startTime AND :endTime")
|
||||
List<ApplicationEvaluationEntity> findExpiringBetween(LocalDateTime startTime, LocalDateTime endTime);
|
||||
// @Query("SELECT AVG(DATEDIFF(DAY, e.startDate, e.endDate)) FROM ApplicationEvaluationEntity e WHERE e.applicationId IN :applicationIds AND e.startDate IS NOT NULL AND e.endDate IS NOT NULL AND e.isDeleted = false ")
|
||||
@Query("""
|
||||
SELECT AVG(e.activeDays)
|
||||
FROM ApplicationEvaluationEntity e
|
||||
WHERE e.applicationId IN :applicationIds
|
||||
AND e.activeDays IS NOT NULL
|
||||
AND e.isDeleted = false
|
||||
""")
|
||||
BigDecimal findAverageEvaluationTimeByApplicationIds(@Param("applicationIds") List<Long> applicationIds);
|
||||
@Query("""
|
||||
SELECT COUNT(e)
|
||||
FROM ApplicationEvaluationEntity e
|
||||
WHERE e.applicationId IN :applicationIds
|
||||
AND FUNCTION('DATE', e.endDate) BETWEEN :startDate AND :endDate
|
||||
AND e.isDeleted = false
|
||||
""")
|
||||
Long countDueApplicationsBetween(
|
||||
@Param("applicationIds") List<Long> applicationIds,
|
||||
@Param("startDate") LocalDate startDate,
|
||||
@Param("endDate") LocalDate endDate
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -44,4 +44,20 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
|
||||
|
||||
@Query("SELECT a.call.id FROM ApplicationEntity a WHERE a.id = :id AND a.isDeleted = false")
|
||||
Long findCallIdById(@Param("id") Long id);
|
||||
|
||||
@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);
|
||||
|
||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.status = 'EVALUATION' AND a.isDeleted = false")
|
||||
Long countAssignedApplicationsByHubId(@Param("hubId") Long hubId);
|
||||
|
||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.status = 'APPROVED' AND a.isDeleted = false")
|
||||
Long countApprovedApplicationsByHubId(@Param("hubId") Long hubId);
|
||||
|
||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.status = 'SOCCORSO' AND a.isDeleted = false")
|
||||
Long countSoccorsoApplicationsByHubId(@Param("hubId") Long hubId);
|
||||
@Query("SELECT a.id FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.isDeleted = false")
|
||||
List<Long> findApplicationIdsByHubId(@Param("hubId") Long hubId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,5 +6,5 @@ import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface UserActionsRepository extends JpaRepository<UserActionEntity, Long> {
|
||||
UserActionEntity findUserActionById(Long id);
|
||||
UserActionEntity findUserActionByIdAndIsDeletedFalse(Long id);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@@ -12,9 +14,16 @@ public interface UserRepository extends JpaRepository<UserEntity, Long> {
|
||||
|
||||
UserEntity findByBeneficiaryId(Long beneficiaryId);
|
||||
|
||||
Optional<UserEntity> findByEmailIgnoreCaseAndHubUniqueUuid(String email, String hubUuid);
|
||||
// Optional<UserEntity> findByEmailIgnoreCaseAndHubUniqueUuid(String email, String hubUuid);
|
||||
|
||||
boolean existsByEmailIgnoreCaseAndHubUniqueUuid(String email, String hubUuid);
|
||||
@Query("SELECT u FROM UserEntity u WHERE LOWER(u.email) = LOWER(:email) AND u.hub.uniqueUuid = :hubUuid AND u.roleEntity.roleType <> :roleType")
|
||||
Optional<UserEntity> findUserExcludingRoleType(
|
||||
@Param("email") String email,
|
||||
@Param("hubUuid") String hubUuid,
|
||||
@Param("roleType") String roleType
|
||||
);
|
||||
|
||||
// boolean existsByEmailIgnoreCaseAndHubUniqueUuid(String email, String hubUuid);
|
||||
|
||||
List<UserEntity> findByRoleEntityIdInAndHubId(List<Long> roleIds, Long hubId);
|
||||
|
||||
@@ -24,7 +33,28 @@ public interface UserRepository extends JpaRepository<UserEntity, Long> {
|
||||
|
||||
Optional<UserEntity> findByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
|
||||
|
||||
boolean existsByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
|
||||
// Boolean existsByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
|
||||
|
||||
@Query("SELECT COUNT(u) > 0 " +
|
||||
"FROM UserEntity u " +
|
||||
"WHERE LOWER(u.email) = LOWER(:email) " +
|
||||
"AND u.hub.uniqueUuid = :hubUuid " +
|
||||
"AND u.roleEntity.roleType <> :beneficiaryRoleType")
|
||||
Boolean existsByEmailIgnoreCaseForNonBeneficiaries(@Param("email") String email,
|
||||
@Param("hubUuid") String hubUuid,
|
||||
@Param("beneficiaryRoleType") String beneficiaryRoleType);
|
||||
|
||||
@Query("SELECT COUNT(u) > 0 " +
|
||||
"FROM UserEntity u " +
|
||||
"WHERE LOWER(u.email) = LOWER(:email) " +
|
||||
"AND u.hub.uniqueUuid = :hubUuid " +
|
||||
"AND u.roleEntity.roleType = :beneficiaryRoleType")
|
||||
Boolean existsByEmailIgnoreCaseForBeneficiaries(@Param("email") String email,
|
||||
@Param("hubUuid") String hubUuid,
|
||||
@Param("beneficiaryRoleType") String beneficiaryRoleType);
|
||||
|
||||
|
||||
boolean existsByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
|
||||
|
||||
List<UserEntity> findByRoleEntity_RoleTypeAndHubId(String roleType, Long hubId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user