Beneficiary must be able to add to favorite a Call

This commit is contained in:
harish
2024-10-14 15:39:34 +05:30
parent ee59ae10c4
commit 82bf9ff789
18 changed files with 610 additions and 4 deletions

View File

@@ -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);
}

View File

@@ -18,4 +18,5 @@ public interface UserRepository extends JpaRepository<UserEntity, Long> {
Optional<UserEntity> findByBeneficiaryCodiceFiscale(String codiceFiscale);
boolean existsByBeneficiaryCodiceFiscale(String codiceFiscale);
UserEntity findByBeneficiaryId(Long beneficiaryId);
}