From c08000ac30bfcc045bf26edeacfbe375e38c0217 Mon Sep 17 00:00:00 2001 From: materro Date: Tue, 5 Dec 2023 12:59:59 +0100 Subject: [PATCH] DataRepository: Fix forcing `clinicId` --- .../scala/com/lbs/server/repository/DataRepository.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/src/main/scala/com/lbs/server/repository/DataRepository.scala b/server/src/main/scala/com/lbs/server/repository/DataRepository.scala index 69dbffd..fab84e0 100644 --- a/server/src/main/scala/com/lbs/server/repository/DataRepository.scala +++ b/server/src/main/scala/com/lbs/server/repository/DataRepository.scala @@ -45,9 +45,8 @@ class DataRepository(@Autowired em: EntityManager) { .createQuery( s"""select service from ServiceHistory service where service.recordId in | (select max(s.recordId) from ServiceHistory s where s.accountId = :accountId and s.cityId = :cityId - | and s.clinicId ${clinicId - .map(_ => "= :clinicId") - .getOrElse("IS NULL")} group by s.name order by MAX(s.time) desc) + | ${clinicId.map(_ => "and s.clinicId = :clinicId").getOrElse("")} + | group by s.name order by MAX(s.time) desc) | order by service.time desc""".stripMargin, classOf[ServiceHistory] )