updated code for hub new changes
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user