updated code
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||
import net.gepafin.tendermanagement.entities.FaqEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -11,9 +11,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface ApplicationRepository extends JpaRepository<ApplicationEntity,Long> {
|
||||
|
||||
public Optional<ApplicationEntity> findByUserIdAndCallIdAndIsDeletedFalse(Long userId,Long callId);
|
||||
public interface ApplicationRepository extends JpaRepository<ApplicationEntity, Long>, JpaSpecificationExecutor<ApplicationEntity> {
|
||||
|
||||
public List<ApplicationEntity> findByUserIdAndIsDeletedFalse(Long userId);
|
||||
|
||||
@@ -23,4 +21,24 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,L
|
||||
public List<ApplicationEntity> findByCallIdAndIsDeletedFalse(Long callId);
|
||||
|
||||
public List<ApplicationEntity> findByIsDeletedFalse();
|
||||
|
||||
public Optional<ApplicationEntity> findByIdAndUserIdAndIsDeletedFalse(Long id,Long userId);
|
||||
|
||||
Optional<ApplicationEntity> findByUserIdAndCompanyIdAndCallIdAndIsDeletedFalse(Long userId, Long companyId, Long callId);
|
||||
|
||||
public Optional<ApplicationEntity> findByIdAndUserIdAndCallIdAndIsDeletedFalse(Long applicationId, Long userId,
|
||||
Long callId);
|
||||
|
||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.userId = :userId AND a.company.id = :companyId AND a.status = 'SUBMIT' ")
|
||||
Long countSubmittedApplicationsByUserId(@Param("userId") Long userId, @Param("companyId") Long companyId);
|
||||
|
||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.status = 'SUBMIT'")
|
||||
Long countSubmittedApplications();
|
||||
|
||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.status = 'DRAFT'")
|
||||
Long countDraftApplications();
|
||||
|
||||
List<ApplicationEntity> findByCompanyIdAndUserIdAndIsDeletedFalse(Long companyId,Long userId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.ApplicationSignedDocumentEntity;
|
||||
|
||||
@Repository
|
||||
public interface ApplicationSignedDocumentRepository extends JpaRepository<ApplicationSignedDocumentEntity, Long> {
|
||||
|
||||
ApplicationSignedDocumentEntity findByApplicationIdAndStatus(Long applicationId, String status);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
import net.gepafin.tendermanagement.entities.BeneficiaryPreferredCallEntity;
|
||||
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;
|
||||
|
||||
@Repository
|
||||
public interface BeneficiaryPreferredCallRepository extends JpaRepository<BeneficiaryPreferredCallEntity, Long> {
|
||||
List<BeneficiaryPreferredCallEntity> findByBeneficiaryId(Long beneficiaryId);
|
||||
List<BeneficiaryPreferredCallEntity> findByUserId(Long userId);
|
||||
|
||||
@Query("SELECT preferredCall FROM BeneficiaryPreferredCallEntity preferredCall where preferredCall.userId=:userId AND (:companyId is null OR preferredCall.companyId=:companyId)")
|
||||
List<BeneficiaryPreferredCallEntity> findByUserIdAndCompanyId(@Param("userId") Long userId, @Param("companyId") Long companyId);
|
||||
List<BeneficiaryPreferredCallEntity> findByBeneficiaryIdAndCompanyId(Long beneficiaryId,Long companyId);
|
||||
}
|
||||
@@ -3,9 +3,9 @@ package net.gepafin.tendermanagement.repositories;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.SamlResponseLogEntity;
|
||||
import net.gepafin.tendermanagement.entities.BeneficiaryEntity;
|
||||
|
||||
@Repository
|
||||
public interface SamlResponseLogRepository extends JpaRepository<SamlResponseLogEntity, Long> {
|
||||
public interface BeneficiaryRepository extends JpaRepository<BeneficiaryEntity, Long> {
|
||||
|
||||
}
|
||||
@@ -2,8 +2,10 @@ package net.gepafin.tendermanagement.repositories;
|
||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
@@ -13,4 +15,14 @@ public interface CallRepository extends JpaRepository<CallEntity, Long> {
|
||||
List<CallEntity> findByStatusIn(List<String> callStatus);
|
||||
|
||||
public CallEntity findByIdAndStatus(Long id,String status);
|
||||
|
||||
public Long countByStatus(String status);
|
||||
|
||||
@Query("SELECT COALESCE(SUM(c.amount), 0) FROM CallEntity c WHERE c.status = 'PUBLISH'")
|
||||
BigDecimal findTotalAmountOfPublishedCalls();
|
||||
|
||||
@Query("SELECT c.name, COUNT(a.id) " +
|
||||
"FROM CallEntity c LEFT JOIN ApplicationEntity a ON c.id = a.call.id " +
|
||||
"GROUP BY c.name")
|
||||
List<Object[]> findApplicationsPerCall();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
||||
|
||||
@Repository
|
||||
public interface CompanyRepository extends JpaRepository<CompanyEntity, Long> {
|
||||
|
||||
List<CompanyEntity> findByIdIn(List<Long> companyIds);
|
||||
|
||||
Boolean existsByVatNumber(String vatNumber);
|
||||
CompanyEntity findByVatNumber(String vatNumber);
|
||||
|
||||
@Query("SELECT COUNT(c) FROM CompanyEntity c")
|
||||
long countTotalCompanies();
|
||||
|
||||
|
||||
}
|
||||
@@ -19,5 +19,8 @@ public interface DocumentRepository extends JpaRepository<DocumentEntity, Long>
|
||||
|
||||
Optional<DocumentEntity> findByIdAndSourceIdAndIsDeletedFalse(Long id, Long sourceId);
|
||||
|
||||
List<DocumentEntity> findBySource(String source);
|
||||
List<DocumentEntity> findBySourceIdAndSourceAndTypeAndIsDeletedFalse(Long sourceId, String source, String type);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,5 +19,6 @@ public interface FaqRepository extends JpaRepository<FaqEntity, Long> {
|
||||
List<FaqEntity> findByCallIdAndIsDeletedFalse(Long callId);
|
||||
|
||||
Optional<FaqEntity> findByIdAndCallIdAndIsDeletedFalse(Long id, Long callId);
|
||||
List<FaqEntity> findByCompanyIdAndUserIdAndIsDeletedFalse(Long companyId,Long userId);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.LoginAttemptEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface LoginAttemptRepository extends JpaRepository<LoginAttemptEntity,Long> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.ProtocolEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface ProtocolRepository extends JpaRepository<ProtocolEntity,Long> {
|
||||
|
||||
@Query("SELECT MAX(p.protocolNumber) FROM ProtocolEntity p")
|
||||
Long findMaxProtocolNumber();
|
||||
}
|
||||
@@ -6,4 +6,6 @@ import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface RoleRepository extends JpaRepository<RoleEntity, Long> {
|
||||
|
||||
RoleEntity findByRoleType(String roleType);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.SamlResponseEntity;
|
||||
|
||||
@Repository
|
||||
public interface SamlResponseRepository extends JpaRepository<SamlResponseEntity, Long> {
|
||||
|
||||
SamlResponseEntity findByToken(String token);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.SystemEmailTemplatesEntity;
|
||||
|
||||
public interface SystemEmailTemplatesRespository extends JpaRepository<SystemEmailTemplatesEntity, Long> {
|
||||
|
||||
// @Query("select s from SystemEmailTemplatesEntity s where s.type=:type and s.call.id=:callId and s.isDeleted =false and s.system = false")
|
||||
// SystemEmailTemplatesEntity findByTypeAndCallId(@Param("type") String type, @Param("callId") Long callId);
|
||||
|
||||
@Query("select s from SystemEmailTemplatesEntity s where s.type=:type and s.isDeleted =false and s.system = true")
|
||||
SystemEmailTemplatesEntity findByType(@Param("type") String type);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import net.gepafin.tendermanagement.entities.UserCompanyDelegationEntity;
|
||||
|
||||
public interface UserCompanyDelegationRepository extends JpaRepository<UserCompanyDelegationEntity, Long> {
|
||||
|
||||
UserCompanyDelegationEntity findByUserIdAndCompanyIdAndStatus(Long userId, Long companyId, String status);
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
|
||||
import net.gepafin.tendermanagement.entities.UserHubEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserHubRepository extends JpaRepository<UserHubEntity, Long> {
|
||||
List<UserHubEntity> findByHubId(String hubId);
|
||||
UserHubEntity findByHubIdAndUserId(String hubId, Long userId);
|
||||
}
|
||||
@@ -1,12 +1,31 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.model.response.UserResponseBean;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface UserRepository extends JpaRepository<UserEntity, Long> {
|
||||
Optional<UserEntity> findByEmailIgnoreCase(String email);
|
||||
boolean existsByEmailIgnoreCase(String email);
|
||||
UserEntity findByEmail(String email);
|
||||
|
||||
// Optional<UserEntity> findByEmailIgnoreCase(String email);
|
||||
|
||||
// boolean existsByEmailIgnoreCase(String email);
|
||||
|
||||
// UserEntity findByEmail(String email);
|
||||
|
||||
Optional<UserEntity> findByBeneficiaryCodiceFiscale(String codiceFiscale);
|
||||
|
||||
boolean existsByBeneficiaryCodiceFiscale(String codiceFiscale);
|
||||
UserEntity findByBeneficiaryId(Long beneficiaryId);
|
||||
|
||||
Long countByStatusAndRoleEntityRoleType(String status, String roleName);
|
||||
List<UserEntity> findByRoleEntityId(Long roleId);
|
||||
|
||||
Optional<UserEntity> findByEmailIgnoreCaseAndhubUniqueUuid(String email, String hubId);
|
||||
|
||||
boolean existsByEmailIgnoreCaseAndhubUniqueUuid(String email, String hubUuid);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.UserWithCompanyEntity;
|
||||
|
||||
|
||||
public interface UserWithCompanyRepository extends JpaRepository<UserWithCompanyEntity, Long> {
|
||||
|
||||
void deleteByCompanyIdAndIsDeletedFalse(Long companyId);
|
||||
|
||||
@Query("SELECT u.companyId FROM UserWithCompanyEntity u WHERE u.userId = :userId AND u.isDeleted = false")
|
||||
List<Long> findActiveCompanyIdsByUserId(@Param("userId") Long userId);
|
||||
|
||||
|
||||
|
||||
Optional<UserWithCompanyEntity> findByUserIdAndCompanyIdAndIsDeletedFalse(Long userId, Long companyId);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user