updated code for hub new changes

This commit is contained in:
harish
2024-10-24 14:51:03 +05:30
parent 8f7eb354ea
commit 3c40470dfc
15 changed files with 130 additions and 47 deletions

View File

@@ -4,6 +4,7 @@ import java.util.List;
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 net.gepafin.tendermanagement.entities.CompanyEntity;
@@ -11,13 +12,14 @@ import net.gepafin.tendermanagement.entities.CompanyEntity;
@Repository
public interface CompanyRepository extends JpaRepository<CompanyEntity, Long> {
List<CompanyEntity> findByIdIn(List<Long> companyIds);
List<CompanyEntity> findByIdInAndHubId(List<Long> companyIds, Long hubId);
Boolean existsByVatNumber(String vatNumber);
CompanyEntity findByVatNumber(String vatNumber);
Boolean existsByVatNumberAndHubId(String vatNumber, Long hubId);
@Query("SELECT COUNT(c) FROM CompanyEntity c")
long countTotalCompanies();
@Query("SELECT COUNT(c) FROM CompanyEntity c where c.hub.id = :hubId")
long countTotalCompaniesByHubId(@Param("hubId") Long hubId);
CompanyEntity findByVatNumberAndHubId(String vatNumber, Long hubId);
}

View File

@@ -10,21 +10,9 @@ 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> findByBeneficiaryCodiceFiscale(String codiceFiscale);
boolean existsByBeneficiaryCodiceFiscale(String codiceFiscale);
UserEntity findByBeneficiaryId(Long beneficiaryId);
Long countByStatusAndRoleEntityRoleType(String status, String roleName);
Optional<UserEntity> findByEmailIgnoreCaseAndHubUniqueUuid(String email, String hubId);
Optional<UserEntity> findByEmailIgnoreCaseAndHubUniqueUuid(String email, String hubUuid);
boolean existsByEmailIgnoreCaseAndHubUniqueUuid(String email, String hubUuid);
@@ -35,4 +23,6 @@ public interface UserRepository extends JpaRepository<UserEntity, Long> {
Long countByStatusAndRoleEntityRoleTypeAndHubId(String status, String roleName, Long hubId);
Optional<UserEntity> findByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
boolean existsByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
}

View File

@@ -14,10 +14,8 @@ public interface UserWithCompanyRepository extends JpaRepository<UserWithCompany
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);
@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);