Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge #128

Merged
merged 2 commits into from
Feb 28, 2024
Merged

merge #128

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public interface AgencyRepository extends JpaRepository<Agency, Long> {
String SELECT_WITH_TOPICS = "SELECT a.*, :tenantId FROM agency a "
+ "LEFT JOIN agency_postcode_range r ON a.id = r.agency_id "
+ "INNER JOIN agency_topic at ON a.id = at.agency_id "
+ "WHERE :postcode is NULL OR ((CAST(:postcode AS INT) BETWEEN CAST(SUBSTR(r.postcode_from, 1, :length) AS int) "
+ "AND CAST(SUBSTR(r.postcode_to, 1, :length) AS int))) " + "AND a.is_offline = false "
+ "WHERE (:postcode is NULL OR ((CAST(:postcode AS INT) BETWEEN CAST(SUBSTR(r.postcode_from, 1, :length) AS int) "
+ "AND CAST(SUBSTR(r.postcode_to, 1, :length) AS int)))) " + "AND a.is_offline = false "
+ "AND (:type is NULL OR a.consulting_type = :type) "
+ "AND at.topic_id = :topicId "
+ AND_WITH_BRACKET
Expand All @@ -33,8 +33,8 @@ public interface AgencyRepository extends JpaRepository<Agency, Long> {
String SELECT_WITHOUT_TOPICS = "SELECT a.*, :tenantId FROM agency a "
+ "LEFT JOIN agency_postcode_range r ON a.id = r.agency_id "
+ "WHERE "
+ ":postcode is NULL OR ((CAST(:postcode AS INT) BETWEEN CAST(SUBSTR(r.postcode_from, 1, :length) AS int) "
+ "AND CAST(SUBSTR(r.postcode_to, 1, :length) AS int))) " + "AND a.is_offline = false "
+ "(:postcode is NULL OR ((CAST(:postcode AS INT) BETWEEN CAST(SUBSTR(r.postcode_from, 1, :length) AS int) "
+ "AND CAST(SUBSTR(r.postcode_to, 1, :length) AS int)))) " + "AND a.is_offline = false "
+ "AND (:type is NULL OR a.consulting_type = :type) "
+ AND_WITH_BRACKET
+ " (:age IS NULL) OR (a.age_from <= :age)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void searchWithoutTopic_Should_findAgencyByOnlyConsultingTypeSkippingPostCodeFil
// given, when
var agencyList = agencyRepository.searchWithoutTopic(null, 5, 0, null, null, null, 1L);
// then
assertThat(agencyList).hasSize(1138);
assertThat(agencyList).hasSize(104);
}


Expand All @@ -79,7 +79,7 @@ void searchWithTopic_Should_findAgencyConsultingTypeAndTopicIdSkippingPostCode()
// given, when
var agencyList = agencyRepository.searchWithTopic(null, 5, 0, 1, null, null, null, 1L);
// then
assertThat(agencyList).hasSize(4);
assertThat(agencyList).hasSize(2);
}

@Test
Expand Down
Loading