Preferred call changes

This commit is contained in:
harish
2024-11-13 13:08:48 +05:30
parent a62d704124
commit 33332b01c8
8 changed files with 49 additions and 19 deletions

View File

@@ -6,15 +6,17 @@ import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
@Repository
public interface BeneficiaryPreferredCallRepository extends JpaRepository<BeneficiaryPreferredCallEntity, Long> {
List<BeneficiaryPreferredCallEntity> findByBeneficiaryId(Long beneficiaryId);
List<BeneficiaryPreferredCallEntity> findByUserId(Long userId);
List<BeneficiaryPreferredCallEntity> findByBeneficiaryIdAndIsDeletedFalse(Long beneficiaryId);
List<BeneficiaryPreferredCallEntity> findByUserIdAndIsDeletedFalse(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> findByUserIdAndCompanyIdAndIsDeletedFalse(@Param("userId") Long userId, @Param("companyId") Long companyId);
List<BeneficiaryPreferredCallEntity> findByBeneficiaryIdAndCompanyId(Long beneficiaryId,Long companyId);
@Query("SELECT preferredCall FROM BeneficiaryPreferredCallEntity preferredCall WHERE preferredCall.userId = :userId AND preferredCall.callId IN :callIds")
List<BeneficiaryPreferredCallEntity> findByUserIdAndCallIdIn(@Param("userId") Long userId, @Param("callIds") List<Long> callIds);
public List<BeneficiaryPreferredCallEntity> findByUserIdAndCallIdInAndIsDeletedFalse(Long userId, List<Long> callIds);
Optional<BeneficiaryPreferredCallEntity> findByIdAndIsDeletedFalse(Long id);
}