diff --git a/src/main/java/com/iemr/common/repo/customization/SectionAndFieldsMappingRepo.java b/src/main/java/com/iemr/common/repo/customization/SectionAndFieldsMappingRepo.java index 098f51f9..79b770d2 100644 --- a/src/main/java/com/iemr/common/repo/customization/SectionAndFieldsMappingRepo.java +++ b/src/main/java/com/iemr/common/repo/customization/SectionAndFieldsMappingRepo.java @@ -23,7 +23,7 @@ List findSectionIdAndSectionNameAndServiceProviderId( @Query("SELECT sfm FROM SectionAndFieldsMapping sfm WHERE sfm.id = :id") SectionAndFieldsMapping getById(@Param("id") Integer id); - @Query("SELECT sfm FROM SectionAndFieldsMapping sfm WHERE sfm.fieldName = :fieldName") - List getByFieldName(@Param("fieldName") String fieldName); + @Query("SELECT sfm FROM SectionAndFieldsMapping sfm WHERE sfm.fieldName = :fieldName and sfm.serviceProviderId = :serviceProviderId") + List getByFieldName(@Param("fieldName") String fieldName,@Param("serviceProviderId") Integer serviceProviderId); } diff --git a/src/main/java/com/iemr/common/service/customization/CustomizationServiceImpl.java b/src/main/java/com/iemr/common/service/customization/CustomizationServiceImpl.java index 911c64cc..d1b18598 100644 --- a/src/main/java/com/iemr/common/service/customization/CustomizationServiceImpl.java +++ b/src/main/java/com/iemr/common/service/customization/CustomizationServiceImpl.java @@ -185,7 +185,7 @@ public String saveSectionAndFields(SectionFieldsMappingDTO sectionFieldsMappingD List sectionAndFieldsMappingList = new ArrayList<>(); for (SectionAndFieldsMapping sectionFieldsMapping : sectionFieldsMappingDTO.getFields()) { List byFieldName = sectionAndFieldsMappingRepo - .getByFieldName(sectionFieldsMapping.getFieldName()); + .getByFieldName(sectionFieldsMapping.getFieldName(),sectionFieldsMapping.getServiceProviderId()); sectionAndFieldsMapping = new SectionAndFieldsMapping(); sectionAndFieldsMapping.setSectionId(sectionFieldsMappingDTO.getSectionId()); sectionAndFieldsMapping.setCreatedBy(sectionFieldsMappingDTO.getCreatedBy());