diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryImpl.java index 5818fe5a..5e655440 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryImpl.java @@ -22,7 +22,6 @@ import com.querydsl.core.types.dsl.StringExpression; import com.querydsl.jpa.impl.JPAQueryFactory; import io.micrometer.common.util.StringUtils; import java.time.LocalDate; -import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.List; @@ -417,12 +416,13 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport if (Objects.isNull(startDate) || Objects.isNull(endDate)) { return null; } - LocalDateTime startDateTime = startDate.atStartOfDay(); - LocalDateTime endDateTime = endDate.plusDays(1).atStartOfDay(); + ZoneId zoneId = ZoneId.of("Asia/Seoul"); + ZonedDateTime startDateTime = startDate.atStartOfDay(zoneId); + ZonedDateTime endDateTime = endDate.plusDays(1).atStartOfDay(zoneId); return auditLogEntity .createdDate - .goe(ZonedDateTime.from(startDateTime)) - .and(auditLogEntity.createdDate.lt(ZonedDateTime.from(endDateTime))); + .goe(startDateTime) + .and(auditLogEntity.createdDate.lt(endDateTime)); } private BooleanExpression createdDateBetween(LocalDate startDate, LocalDate endDate) { @@ -471,11 +471,11 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport } private BooleanExpression eventEndedAtEqDate(LocalDate logDate) { - StringExpression eventEndedDate = - Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", auditLogEntity.createdDate); - LocalDateTime comparisonDate = logDate.atStartOfDay(); + ZoneId zoneId = ZoneId.of("Asia/Seoul"); + ZonedDateTime start = logDate.atStartOfDay(zoneId); + ZonedDateTime end = logDate.plusDays(1).atStartOfDay(zoneId); - return eventEndedDate.eq(comparisonDate.toString()); + return auditLogEntity.createdDate.goe(start).and(auditLogEntity.createdDate.lt(end)); } private BooleanExpression menuUidEq(String menuUid) {