From 041d0f6bdb31cc5d122b7cfd9b49d5f8cb073cc3 Mon Sep 17 00:00:00 2001 From: "antonio.torre" Date: Thu, 16 Jan 2025 18:47:27 +0100 Subject: [PATCH] renamed query methods --- openapi/generated.openapi.json | 498 +++++++++--------- .../taxonomy/TaxonomyCodeRepository.java | 11 +- .../TaxonomyCollectionReasonRepository.java | 12 +- .../TaxonomyMacroAreaCodeRepository.java | 7 +- .../TaxonomyOrganizationTypeRepository.java | 5 +- .../TaxonomyServiceTypeCodeRepository.java | 8 +- 6 files changed, 286 insertions(+), 255 deletions(-) diff --git a/openapi/generated.openapi.json b/openapi/generated.openapi.json index 2c69a06..fe7c1d9 100644 --- a/openapi/generated.openapi.json +++ b/openapi/generated.openapi.json @@ -994,10 +994,10 @@ } } }, - "/crud/taxonomies-collection-reason/search/findDistinctCollectionReasonByOrganizationTypeAndMacroAreaCodeAndServiceTypeCodeOrderByCollectionReasonAsc" : { + "/crud/taxonomies-collection-reason/search/findCollectionReasons" : { "get" : { "tags" : [ "taxonomy-collection-reason-dto-search-controller" ], - "operationId" : "crud-taxonomies-collection-reason-findDistinctCollectionReasonByOrganizationTypeAndMacroAreaCodeAndServiceTypeCodeOrderByCollectionReasonAsc", + "operationId" : "crud-taxonomies-collection-reason-findCollectionReasons", "parameters" : [ { "name" : "organizationType", "in" : "query", @@ -1034,10 +1034,10 @@ } } }, - "/crud/taxonomies-macro-area/search/findDistinctMacroAreaCodeByOrganizationTypeOrderByMacroAreaCodeAsc" : { + "/crud/taxonomies-macro-area/search/findMacroAreaCodes" : { "get" : { "tags" : [ "taxonomy-macro-area-code-dto-search-controller" ], - "operationId" : "crud-taxonomies-macro-area-findDistinctMacroAreaCodeByOrganizationTypeOrderByMacroAreaCodeAsc", + "operationId" : "crud-taxonomies-macro-area-findMacroAreaCodes", "parameters" : [ { "name" : "organizationType", "in" : "query", @@ -1062,10 +1062,10 @@ } } }, - "/crud/taxonomies-organization-types/search/findDistinctOrganizationTypeByOrderByOrganizationTypeAsc" : { + "/crud/taxonomies-organization-types/search/findOrganizationTypes" : { "get" : { "tags" : [ "taxonomy-organization-type-dto-search-controller" ], - "operationId" : "crud-taxonomies-organization-types-findDistinctOrganizationTypeByOrderByOrganizationTypeAsc", + "operationId" : "crud-taxonomies-organization-types-findOrganizationTypes", "responses" : { "200" : { "description" : "OK", @@ -1083,10 +1083,10 @@ } } }, - "/crud/taxonomies-service-type/search/findDistinctServiceTypeCodeByOrganizationTypeAndMacroAreaCodeOrderByServiceTypeCodeAsc" : { + "/crud/taxonomies-service-type/search/findServiceTypeCodes" : { "get" : { "tags" : [ "taxonomy-service-type-code-dto-search-controller" ], - "operationId" : "crud-taxonomies-service-type-findDistinctServiceTypeCodeByOrganizationTypeAndMacroAreaCodeOrderByServiceTypeCodeAsc", + "operationId" : "crud-taxonomies-service-type-findServiceTypeCodes", "parameters" : [ { "name" : "organizationType", "in" : "query", @@ -1117,10 +1117,10 @@ } } }, - "/crud/taxonomies-taxonomy-code/search/findDistinctTaxonomyCodeByOrganizationTypeAndMacroAreaCodeAndServiceTypeCodeAndCollectionReasonOrderByTaxonomyCodeAsc" : { + "/crud/taxonomies-taxonomy-code/search/findTaxonomyCodes" : { "get" : { "tags" : [ "taxonomy-code-dto-search-controller" ], - "operationId" : "crud-taxonomies-taxonomy-code-findDistinctTaxonomyCodeByOrganizationTypeAndMacroAreaCodeAndServiceTypeCodeAndCollectionReasonOrderByTaxonomyCodeAsc", + "operationId" : "crud-taxonomies-taxonomy-code-findTaxonomyCodes", "parameters" : [ { "name" : "organizationType", "in" : "query", @@ -1366,6 +1366,69 @@ }, "components" : { "schemas" : { + "CollectionModelTaxonomyCodeDTO" : { + "type" : "object", + "properties" : { + "_embedded" : { + "type" : "object", + "properties" : { + "taxonomyCodeDTOes" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/TaxonomyCodeDTO" + } + } + } + }, + "_links" : { + "$ref" : "#/components/schemas/Links" + } + } + }, + "TaxonomyCodeDTO" : { + "type" : "object", + "properties" : { + "organizationType" : { + "type" : "string" + }, + "organizationTypeDescription" : { + "type" : "string" + }, + "macroAreaCode" : { + "type" : "string" + }, + "macroAreaName" : { + "type" : "string" + }, + "macroAreaDescription" : { + "type" : "string" + }, + "serviceTypeCode" : { + "type" : "string" + }, + "serviceType" : { + "type" : "string" + }, + "serviceTypeDescription" : { + "type" : "string" + }, + "collectionReason" : { + "type" : "string" + }, + "taxonomyCode" : { + "type" : "string" + }, + "_links" : { + "$ref" : "#/components/schemas/Links" + } + } + }, + "Links" : { + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/Link" + } + }, "CollectionModelTaxonomyCollectionReasonDTO" : { "type" : "object", "properties" : { @@ -1420,10 +1483,37 @@ } } }, - "Links" : { + "CollectionModelTaxonomyOrganizationTypeDTO" : { "type" : "object", - "additionalProperties" : { - "$ref" : "#/components/schemas/Link" + "properties" : { + "_embedded" : { + "type" : "object", + "properties" : { + "taxonomyOrganizationTypeDTOes" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/TaxonomyOrganizationTypeDTO" + } + } + } + }, + "_links" : { + "$ref" : "#/components/schemas/Links" + } + } + }, + "TaxonomyOrganizationTypeDTO" : { + "type" : "object", + "properties" : { + "organizationType" : { + "type" : "string" + }, + "organizationTypeDescription" : { + "type" : "string" + }, + "_links" : { + "$ref" : "#/components/schemas/Links" + } } }, "AbstractJsonSchemaPropertyObject" : { @@ -1500,7 +1590,7 @@ } } }, - "Broker" : { + "Taxonomy" : { "type" : "object", "properties" : { "creationDate" : { @@ -1514,73 +1604,50 @@ "updateOperatorExternalId" : { "type" : "string" }, - "brokerId" : { - "type" : "integer", - "format" : "int64" - }, - "organizationId" : { + "taxonomyId" : { "type" : "integer", "format" : "int64" }, - "brokerFiscalCode" : { + "organizationType" : { "type" : "string" }, - "brokerName" : { + "organizationTypeDescription" : { "type" : "string" }, - "pagoPaInteractionModel" : { - "type" : "string", - "enum" : [ "SYNC", "SYNC_ACA", "SYNC$GPDPRELOAD", "SYNC_ACA$GPDPRELOAD", "ASYNC_GPD" ] - }, - "stationId" : { + "macroAreaCode" : { "type" : "string" }, - "broadcastStationId" : { + "macroAreaName" : { "type" : "string" }, - "syncKey" : { - "type" : "string", - "format" : "byte" - }, - "gpdKey" : { - "type" : "string", - "format" : "byte" - }, - "acaKey" : { - "type" : "string", - "format" : "byte" - }, - "personalisationFe" : { - "$ref" : "#/components/schemas/PersonalisationFe" - }, - "_links" : { - "$ref" : "#/components/schemas/Links" - } - } - }, - "PersonalisationFe" : { - "type" : "object", - "properties" : { - "headerAssistanceUrl" : { + "macroAreaDescription" : { "type" : "string" }, - "logoFooterImg" : { + "serviceTypeCode" : { "type" : "string" }, - "footerDescText" : { + "serviceType" : { "type" : "string" }, - "footerPrivacyInfoUrl" : { + "serviceTypeDescription" : { "type" : "string" }, - "footerGDPRUrl" : { + "collectionReason" : { "type" : "string" }, - "footerTermsCondUrl" : { - "type" : "string" + "startDateValidity" : { + "type" : "string", + "format" : "date-time" }, - "footerAccessibilityUrl" : { + "endDateOfValidity" : { + "type" : "string", + "format" : "date-time" + }, + "taxonomyCode" : { "type" : "string" + }, + "_links" : { + "$ref" : "#/components/schemas/Links" } } }, @@ -1605,16 +1672,16 @@ } } }, - "PagedModelBroker" : { + "PagedModelTaxonomy" : { "type" : "object", "properties" : { "_embedded" : { "type" : "object", "properties" : { - "brokers" : { + "taxonomies" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/Broker" + "$ref" : "#/components/schemas/Taxonomy" } } } @@ -1627,147 +1694,6 @@ } } }, - "CollectionModelTaxonomyOrganizationTypeDTO" : { - "type" : "object", - "properties" : { - "_embedded" : { - "type" : "object", - "properties" : { - "taxonomyOrganizationTypeDTOes" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/TaxonomyOrganizationTypeDTO" - } - } - } - }, - "_links" : { - "$ref" : "#/components/schemas/Links" - } - } - }, - "TaxonomyOrganizationTypeDTO" : { - "type" : "object", - "properties" : { - "organizationType" : { - "type" : "string" - }, - "organizationTypeDescription" : { - "type" : "string" - }, - "_links" : { - "$ref" : "#/components/schemas/Links" - } - } - }, - "CollectionModelTaxonomyCodeDTO" : { - "type" : "object", - "properties" : { - "_embedded" : { - "type" : "object", - "properties" : { - "taxonomyCodeDTOes" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/TaxonomyCodeDTO" - } - } - } - }, - "_links" : { - "$ref" : "#/components/schemas/Links" - } - } - }, - "TaxonomyCodeDTO" : { - "type" : "object", - "properties" : { - "organizationType" : { - "type" : "string" - }, - "organizationTypeDescription" : { - "type" : "string" - }, - "macroAreaCode" : { - "type" : "string" - }, - "macroAreaName" : { - "type" : "string" - }, - "macroAreaDescription" : { - "type" : "string" - }, - "serviceTypeCode" : { - "type" : "string" - }, - "serviceType" : { - "type" : "string" - }, - "serviceTypeDescription" : { - "type" : "string" - }, - "collectionReason" : { - "type" : "string" - }, - "taxonomyCode" : { - "type" : "string" - }, - "_links" : { - "$ref" : "#/components/schemas/Links" - } - } - }, - "CollectionModelTaxonomyServiceTypeCodeDTO" : { - "type" : "object", - "properties" : { - "_embedded" : { - "type" : "object", - "properties" : { - "taxonomyServiceTypeCodeDTOes" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/TaxonomyServiceTypeCodeDTO" - } - } - } - }, - "_links" : { - "$ref" : "#/components/schemas/Links" - } - } - }, - "TaxonomyServiceTypeCodeDTO" : { - "type" : "object", - "properties" : { - "organizationType" : { - "type" : "string" - }, - "organizationTypeDescription" : { - "type" : "string" - }, - "macroAreaCode" : { - "type" : "string" - }, - "macroAreaName" : { - "type" : "string" - }, - "macroAreaDescription" : { - "type" : "string" - }, - "serviceTypeCode" : { - "type" : "string" - }, - "serviceType" : { - "type" : "string" - }, - "serviceTypeDescription" : { - "type" : "string" - }, - "_links" : { - "$ref" : "#/components/schemas/Links" - } - } - }, "Organization" : { "type" : "object", "properties" : { @@ -1898,16 +1824,16 @@ } } }, - "CollectionModelTaxonomyMacroAreaCodeDTO" : { + "CollectionModelTaxonomyServiceTypeCodeDTO" : { "type" : "object", "properties" : { "_embedded" : { "type" : "object", "properties" : { - "taxonomyMacroAreaCodeDTOes" : { + "taxonomyServiceTypeCodeDTOes" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/TaxonomyMacroAreaCodeDTO" + "$ref" : "#/components/schemas/TaxonomyServiceTypeCodeDTO" } } } @@ -1917,7 +1843,7 @@ } } }, - "TaxonomyMacroAreaCodeDTO" : { + "TaxonomyServiceTypeCodeDTO" : { "type" : "object", "properties" : { "organizationType" : { @@ -1935,12 +1861,47 @@ "macroAreaDescription" : { "type" : "string" }, + "serviceTypeCode" : { + "type" : "string" + }, + "serviceType" : { + "type" : "string" + }, + "serviceTypeDescription" : { + "type" : "string" + }, "_links" : { "$ref" : "#/components/schemas/Links" } } }, - "OrgSilService" : { + "PersonalisationFe" : { + "type" : "object", + "properties" : { + "headerAssistanceUrl" : { + "type" : "string" + }, + "logoFooterImg" : { + "type" : "string" + }, + "footerDescText" : { + "type" : "string" + }, + "footerPrivacyInfoUrl" : { + "type" : "string" + }, + "footerGDPRUrl" : { + "type" : "string" + }, + "footerTermsCondUrl" : { + "type" : "string" + }, + "footerAccessibilityUrl" : { + "type" : "string" + } + } + }, + "Broker" : { "type" : "object", "properties" : { "creationDate" : { @@ -1954,7 +1915,7 @@ "updateOperatorExternalId" : { "type" : "string" }, - "orgSilServiceId" : { + "brokerId" : { "type" : "integer", "format" : "int64" }, @@ -1962,43 +1923,52 @@ "type" : "integer", "format" : "int64" }, - "applicationName" : { + "brokerFiscalCode" : { "type" : "string" }, - "notifyOutcomePushUrl" : { + "brokerName" : { "type" : "string" }, - "flagLegacy" : { - "type" : "boolean" + "pagoPaInteractionModel" : { + "type" : "string", + "enum" : [ "SYNC", "SYNC_ACA", "SYNC$GPDPRELOAD", "SYNC_ACA$GPDPRELOAD", "ASYNC_GPD" ] }, - "legacyJwtId" : { + "stationId" : { "type" : "string" }, - "legacyJwtMail" : { + "broadcastStationId" : { "type" : "string" }, - "legacyJwtSecretKeyId" : { - "type" : "string" + "syncKey" : { + "type" : "string", + "format" : "byte" }, - "legacyJwtSecretKey" : { + "gpdKey" : { + "type" : "string", + "format" : "byte" + }, + "acaKey" : { "type" : "string", "format" : "byte" }, + "personalisationFe" : { + "$ref" : "#/components/schemas/PersonalisationFe" + }, "_links" : { "$ref" : "#/components/schemas/Links" } } }, - "PagedModelOrgSilService" : { + "PagedModelBroker" : { "type" : "object", "properties" : { "_embedded" : { "type" : "object", "properties" : { - "orgSilServices" : { + "brokers" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/OrgSilService" + "$ref" : "#/components/schemas/Broker" } } } @@ -2011,7 +1981,7 @@ } } }, - "Taxonomy" : { + "OrgSilService" : { "type" : "object", "properties" : { "creationDate" : { @@ -2025,63 +1995,51 @@ "updateOperatorExternalId" : { "type" : "string" }, - "taxonomyId" : { + "orgSilServiceId" : { "type" : "integer", "format" : "int64" }, - "organizationType" : { - "type" : "string" - }, - "organizationTypeDescription" : { - "type" : "string" - }, - "macroAreaCode" : { - "type" : "string" + "organizationId" : { + "type" : "integer", + "format" : "int64" }, - "macroAreaName" : { + "applicationName" : { "type" : "string" }, - "macroAreaDescription" : { + "notifyOutcomePushUrl" : { "type" : "string" }, - "serviceTypeCode" : { - "type" : "string" + "flagLegacy" : { + "type" : "boolean" }, - "serviceType" : { + "legacyJwtId" : { "type" : "string" }, - "serviceTypeDescription" : { + "legacyJwtMail" : { "type" : "string" }, - "collectionReason" : { + "legacyJwtSecretKeyId" : { "type" : "string" }, - "startDateValidity" : { - "type" : "string", - "format" : "date-time" - }, - "endDateOfValidity" : { + "legacyJwtSecretKey" : { "type" : "string", - "format" : "date-time" - }, - "taxonomyCode" : { - "type" : "string" + "format" : "byte" }, "_links" : { "$ref" : "#/components/schemas/Links" } } }, - "PagedModelTaxonomy" : { + "PagedModelOrgSilService" : { "type" : "object", "properties" : { "_embedded" : { "type" : "object", "properties" : { - "taxonomies" : { + "orgSilServices" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/Taxonomy" + "$ref" : "#/components/schemas/OrgSilService" } } } @@ -2094,6 +2052,48 @@ } } }, + "CollectionModelTaxonomyMacroAreaCodeDTO" : { + "type" : "object", + "properties" : { + "_embedded" : { + "type" : "object", + "properties" : { + "taxonomyMacroAreaCodeDTOes" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/TaxonomyMacroAreaCodeDTO" + } + } + } + }, + "_links" : { + "$ref" : "#/components/schemas/Links" + } + } + }, + "TaxonomyMacroAreaCodeDTO" : { + "type" : "object", + "properties" : { + "organizationType" : { + "type" : "string" + }, + "organizationTypeDescription" : { + "type" : "string" + }, + "macroAreaCode" : { + "type" : "string" + }, + "macroAreaName" : { + "type" : "string" + }, + "macroAreaDescription" : { + "type" : "string" + }, + "_links" : { + "$ref" : "#/components/schemas/Links" + } + } + }, "BrokerRequestBody" : { "type" : "object", "properties" : { diff --git a/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyCodeRepository.java b/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyCodeRepository.java index d41f17a..8ef1a27 100644 --- a/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyCodeRepository.java +++ b/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyCodeRepository.java @@ -1,7 +1,10 @@ package it.gov.pagopa.pu.organization.repository.taxonomy; import it.gov.pagopa.pu.organization.model.taxonomy.TaxonomyCodeDTO; + import java.util.List; + +import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @@ -9,6 +12,12 @@ public interface TaxonomyCodeRepository extends Repository { - List findDistinctTaxonomyCodeByOrganizationTypeAndMacroAreaCodeAndServiceTypeCodeAndCollectionReasonOrderByTaxonomyCodeAsc(String organizationType,String macroAreaCode,String serviceTypeCode,String collectionReason); + @Query("SELECT distinct t from TaxonomyCodeDTO t WHERE " + + "t.organizationType=:organizationType AND " + + "t.macroAreaCode=:macroAreaCode AND " + + "t.serviceTypeCode=:serviceTypeCode AND " + + "t.collectionReason=:collectionReason " + + "ORDER BY t.taxonomyCode") + List findTaxonomyCodes(String organizationType, String macroAreaCode, String serviceTypeCode, String collectionReason); } diff --git a/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyCollectionReasonRepository.java b/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyCollectionReasonRepository.java index 62e7376..f72faa7 100644 --- a/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyCollectionReasonRepository.java +++ b/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyCollectionReasonRepository.java @@ -1,14 +1,22 @@ package it.gov.pagopa.pu.organization.repository.taxonomy; import it.gov.pagopa.pu.organization.model.taxonomy.TaxonomyCollectionReasonDTO; -import java.util.List; +import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; +import java.util.List; + @RepositoryRestResource(path = "taxonomies-collection-reason") public interface TaxonomyCollectionReasonRepository extends Repository { - List findDistinctCollectionReasonByOrganizationTypeAndMacroAreaCodeAndServiceTypeCodeOrderByCollectionReasonAsc(String organizationType,String macroAreaCode,String serviceTypeCode); + @Query("SELECT distinct c FROM TaxonomyCollectionReasonDTO c WHERE " + + "c.organizationType=:organizationType AND " + + "c.macroAreaCode=:macroAreaCode AND " + + "c.serviceTypeCode=:serviceTypeCode " + + "ORDER BY c.collectionReason" + ) + List findCollectionReasons(String organizationType, String macroAreaCode, String serviceTypeCode); } diff --git a/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyMacroAreaCodeRepository.java b/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyMacroAreaCodeRepository.java index b3a7582..4485812 100644 --- a/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyMacroAreaCodeRepository.java +++ b/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyMacroAreaCodeRepository.java @@ -2,6 +2,8 @@ import it.gov.pagopa.pu.organization.model.taxonomy.TaxonomyMacroAreaCodeDTO; import java.util.List; + +import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @@ -9,6 +11,9 @@ public interface TaxonomyMacroAreaCodeRepository extends Repository { - List findDistinctMacroAreaCodeByOrganizationTypeOrderByMacroAreaCodeAsc(String organizationType); + @Query("SELECT distinct m FROM TaxonomyMacroAreaCodeDTO m WHERE " + + "m.organizationType=:organizationType " + + "ORDER BY m.macroAreaCode") + List findMacroAreaCodes(String organizationType); } diff --git a/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyOrganizationTypeRepository.java b/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyOrganizationTypeRepository.java index fb998ba..9cd6a37 100644 --- a/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyOrganizationTypeRepository.java +++ b/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyOrganizationTypeRepository.java @@ -1,6 +1,7 @@ package it.gov.pagopa.pu.organization.repository.taxonomy; import it.gov.pagopa.pu.organization.model.taxonomy.TaxonomyOrganizationTypeDTO; +import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @@ -8,5 +9,7 @@ @RepositoryRestResource(path = "taxonomies-organization-types") public interface TaxonomyOrganizationTypeRepository extends Repository { - List findDistinctOrganizationTypeByOrderByOrganizationTypeAsc(); + + @Query("SELECT distinct t FROM TaxonomyOrganizationTypeDTO t ORDER BY t.organizationType") + List findOrganizationTypes(); } diff --git a/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyServiceTypeCodeRepository.java b/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyServiceTypeCodeRepository.java index 53ffdc7..b84961c 100644 --- a/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyServiceTypeCodeRepository.java +++ b/src/main/java/it/gov/pagopa/pu/organization/repository/taxonomy/TaxonomyServiceTypeCodeRepository.java @@ -2,6 +2,8 @@ import it.gov.pagopa.pu.organization.model.taxonomy.TaxonomyServiceTypeCodeDTO; import java.util.List; + +import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @@ -9,6 +11,10 @@ public interface TaxonomyServiceTypeCodeRepository extends Repository { - List findDistinctServiceTypeCodeByOrganizationTypeAndMacroAreaCodeOrderByServiceTypeCodeAsc(String organizationType,String macroAreaCode); + @Query("SELECT distinct s FROM TaxonomyServiceTypeCodeDTO s WHERE " + + "s.organizationType=:organizationType AND " + + "s.macroAreaCode=:macroAreaCode " + + "ORDER BY s.serviceTypeCode") + List findServiceTypeCodes(String organizationType,String macroAreaCode); }