Skip to content

Commit

Permalink
Added Repo method fetch non deleted medical types
Browse files Browse the repository at this point in the history
  • Loading branch information
mohit10696 committed Nov 22, 2024
1 parent 821d432 commit c5f4a76
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ protected void validateMedicalType(MedicalType medicalType, boolean insert) thro
public List<MedicalType> getMedicalType() throws OHServiceException {
return ioOperations.getMedicalTypes();
}

/**
* Retrieves all the non deleted {@link MedicalType}s.
*
* @return a list of all the {@link MedicalType}s.
* @throws OHServiceException
*/
public List<MedicalType> getAllActiveMedicalType() throws OHServiceException {
return ioOperations.getMedicalTypesNotDeleted();
}

/**
* Saves the specified {@link MedicalType}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public MedicalTypeIoOperation(MedicalTypeIoOperationRepository medicalTypeIoOper
public List<MedicalType> getMedicalTypes() throws OHServiceException {
return repository.findAllByOrderByDescriptionAsc();
}


public List<MedicalType> getMedicalTypesNotDeleted() throws OHServiceException {
return repository.findByAllNotDeletedOrderByDescriptionAsc();
}

/**
* Updates the specified {@link MedicalType}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@

import org.isf.medtype.model.MedicalType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface MedicalTypeIoOperationRepository extends JpaRepository<MedicalType, String> {

List<MedicalType> findAllByOrderByDescriptionAsc();

@Query("SELECT m FROM MedicalType m WHERE m.deleted = 'N' ORDER BY m.description ASC")
List<MedicalType> findByAllNotDeletedOrderByDescriptionAsc();

}

0 comments on commit c5f4a76

Please sign in to comment.