Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;


Expand All @@ -32,11 +33,15 @@ public WorkReportEntity getByStoreIdAndWorkReportId(Long storeId, Long workRepor

@Override
public List<WorkReportEntity> findByStoreIdAndDateOrderByCreatedAtDesc(final Long storeId, final LocalDate date) {
return workReportJpaRepository.findByStoreIdAndDateOrderByCreatedAtDesc(storeId, date);
LocalDateTime start = date.atStartOfDay();
LocalDateTime end = start.plusDays(1);
return workReportJpaRepository.findByStoreIdAndDateOrderByCreatedAtDesc(storeId, start, end);
}

@Override
public List<WorkReportEntity> findByStoreIdAndDateAndTargetTypeOrderByCreatedAtDesc(final Long storeId, final LocalDate date, final WorkReportTargetType targetType) {
return workReportJpaRepository.findByStoreIdAndDateAndTargetTypeOrderByCreatedAtDesc(storeId, date, targetType);
LocalDateTime start = date.atStartOfDay();
LocalDateTime end = start.plusDays(1);
return workReportJpaRepository.findByStoreIdAndDateAndTargetTypeOrderByCreatedAtDesc(storeId, start, end, targetType);
}
}
108 changes: 54 additions & 54 deletions app/src/main/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -75,33 +75,33 @@ VALUES
(6, 2, null, '2025-04-07', '2025-04-07 08:30:00', '2025-04-07 14:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(7, 2, null, '2025-05-01', '2025-05-01 13:00:00', '2025-05-01 18:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(8, 1, null, '2025-05-03', '2025-05-03 10:00:00', '2025-05-03 18:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(10, 1, null, '2025-05-05', '2025-05-05 09:00:00', '2025-05-05 14:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(11, 3, null, '2025-05-06', '2025-05-06 09:00:00', '2025-05-06 14:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(12, 2, null, '2025-05-07', '2025-05-07 10:30:00', '2025-05-07 15:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(13, 3, null, '2025-05-07', '2025-05-07 10:00:00', '2025-05-07 14:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(14, 1, null, '2025-05-08', '2025-05-08 09:00:00', '2025-05-08 14:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(15, 3, null, '2025-05-08', '2025-05-08 13:00:00', '2025-05-08 19:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(16, 1, null, '2025-05-09', '2025-05-09 12:00:00', '2025-05-09 18:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(17, 2, null, '2025-05-10', '2025-05-10 08:00:00', '2025-05-10 13:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(18, 1, null, '2025-05-10', '2025-05-10 10:00:00', '2025-05-10 14:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(19, 3, null, '2025-05-11', '2025-05-11 09:30:00', '2025-05-11 15:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(20, 1, null, '2025-05-12', '2025-05-12 08:30:00', '2025-05-12 14:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(21, 2, null, '2025-05-13', '2025-05-13 11:30:00', '2025-05-13 19:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(22, 2, null, '2025-05-14', '2025-05-14 09:30:00', '2025-05-14 17:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(23, 2, null, '2025-05-15', '2025-05-15 08:00:00', '2025-05-15 16:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(24, 2, null, '2025-05-16', '2025-05-16 10:00:00', '2025-05-16 15:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(25, 3, null, '2025-05-17', '2025-05-17 08:30:00', '2025-05-17 15:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(28, 3, null, '2025-05-20', '2025-05-20 08:30:00', '2025-05-20 15:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(29, 3, null, '2025-05-21', '2025-05-21 08:30:00', '2025-05-21 16:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(30, 1, null, '2025-05-22', '2025-05-22 09:30:00', '2025-05-22 17:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(31, 1, null, '2025-05-23', '2025-05-23 08:00:00', '2025-05-23 14:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(32, 3, null, '2025-05-24', '2025-05-24 08:00:00', '2025-05-24 15:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(33, 2, null, '2025-05-25', '2025-05-25 09:30:00', '2025-05-25 16:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(34, 1, null, '2025-05-26', '2025-05-26 08:00:00', '2025-05-26 15:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(35, 2, null, '2025-05-27', '2025-05-27 10:00:00', '2025-05-27 18:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(37, 2, null, '2025-05-29', '2025-05-29 10:00:00', '2025-05-29 15:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(38, 2, null, '2025-05-30', '2025-05-30 08:00:00', '2025-05-30 14:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(39, 3, null, '2025-05-31', '2025-05-31 09:00:00', '2025-05-31 17:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
(9, 1, null, '2025-05-05', '2025-05-05 09:00:00', '2025-05-05 14:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(10, 3, null, '2025-05-06', '2025-05-06 09:00:00', '2025-05-06 14:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(11, 2, null, '2025-05-07', '2025-05-07 10:30:00', '2025-05-07 15:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(12, 3, null, '2025-05-07', '2025-05-07 10:00:00', '2025-05-07 14:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(13, 1, null, '2025-05-08', '2025-05-08 09:00:00', '2025-05-08 14:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(14, 3, null, '2025-05-08', '2025-05-08 13:00:00', '2025-05-08 19:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(15, 1, null, '2025-05-09', '2025-05-09 12:00:00', '2025-05-09 18:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(16, 2, null, '2025-05-10', '2025-05-10 08:00:00', '2025-05-10 13:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(17, 1, null, '2025-05-10', '2025-05-10 10:00:00', '2025-05-10 14:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(18, 3, null, '2025-05-11', '2025-05-11 09:30:00', '2025-05-11 15:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(19, 1, null, '2025-05-12', '2025-05-12 08:30:00', '2025-05-12 14:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(20, 2, null, '2025-05-13', '2025-05-13 11:30:00', '2025-05-13 19:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(21, 2, null, '2025-05-14', '2025-05-14 09:30:00', '2025-05-14 17:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(22, 2, null, '2025-05-15', '2025-05-15 08:00:00', '2025-05-15 16:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(23, 2, null, '2025-05-16', '2025-05-16 10:00:00', '2025-05-16 15:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(24, 3, null, '2025-05-17', '2025-05-17 08:30:00', '2025-05-17 15:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(25, 3, null, '2025-05-20', '2025-05-20 08:30:00', '2025-05-20 15:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(26, 3, null, '2025-05-21', '2025-05-21 08:30:00', '2025-05-21 16:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(27, 1, null, '2025-05-22', '2025-05-22 09:30:00', '2025-05-22 17:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(28, 1, null, '2025-05-23', '2025-05-23 08:00:00', '2025-05-23 14:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(29, 3, null, '2025-05-24', '2025-05-24 08:00:00', '2025-05-24 15:30:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(30, 2, null, '2025-05-25', '2025-05-25 09:30:00', '2025-05-25 16:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(31, 1, null, '2025-05-26', '2025-05-26 08:00:00', '2025-05-26 15:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(32, 2, null, '2025-05-27', '2025-05-27 10:00:00', '2025-05-27 18:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(33, 2, null, '2025-05-29', '2025-05-29 10:00:00', '2025-05-29 15:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(34, 2, null, '2025-05-30', '2025-05-30 08:00:00', '2025-05-30 14:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(35, 3, null, '2025-05-31', '2025-05-31 09:00:00', '2025-05-31 17:00:00', 1, 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);

INSERT INTO attendance (attendance_id, schedule_id, clock_in_time, clock_out_time, clock_in_status, clock_out_status, attendance_state, created_at, modified_at)
VALUES
Expand All @@ -113,30 +113,30 @@ VALUES
(6, 6, '2025-04-07 08:30:00', '2025-04-07 14:30:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(7, 7, '2025-05-01 13:00:00', '2025-05-01 18:00:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(8, 8, '2025-05-03 10:05:00', '2025-05-03 18:00:00', 'LATE', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(9, 10, '2025-05-05 09:00:00', '2025-05-05 14:30:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(10, 11, '2025-05-06 09:05:00', '2025-05-06 14:25:00', 'LATE', 'EARLY_LEAVE', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(11, 12, '2025-05-07 10:30:00', '2025-05-07 15:30:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(12, 13, null, null, 'ABSENT', 'ABSENT', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(13, 14, '2025-05-08 09:00:00', '2025-05-08 14:10:00', 'NORMAL', 'OVERTIME', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(14, 15, '2025-05-08 13:00:00', '2025-05-08 19:00:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(15, 16, '2025-05-09 12:05:00', '2025-05-09 18:00:00', 'LATE', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(16, 17, '2025-05-10 08:00:00', '2025-05-10 13:00:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(17, 18, null, null, 'ABSENT', 'ABSENT', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(18, 19, '2025-05-11 09:30:00', '2025-05-11 15:30:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(19, 20, '2025-05-12 08:40:00', '2025-05-12 14:20:00', 'LATE', 'EARLY_LEAVE', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(20, 21, '2025-05-13 11:30:00', '2025-05-13 19:00:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(21, 22, null, null, 'ABSENT', 'ABSENT', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(22, 23, '2025-05-15 08:00:00', '2025-05-15 16:30:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(23, 24, '2025-05-16 10:00:00', '2025-05-16 15:20:00', 'NORMAL', 'EARLY_LEAVE', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(24, 25, '2025-05-17 08:35:00', '2025-05-17 15:00:00', 'LATE', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(25, 28, '2025-05-20 08:30:00', '2025-05-20 15:00:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(26, 29, null, null, 'ABSENT', 'ABSENT', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(27, 30, '2025-05-22 09:30:00', '2025-05-22 17:30:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(28, 31, '2025-05-23 08:10:00', '2025-05-23 14:30:00', 'LATE', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(29, 32, '2025-05-24 08:00:00', '2025-05-24 15:30:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(30, 33, '2025-05-25 09:35:00', '2025-05-25 16:00:00', 'LATE', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(31, 34, '2025-05-26 08:00:00', '2025-05-26 15:00:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(32, 35, null, null, 'ABSENT', 'ABSENT', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(33, 37, '2025-05-29 10:05:00', '2025-05-29 15:10:00', 'LATE', 'OVERTIME', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(34, 38, '2025-05-30 08:00:00', '2025-05-30 14:00:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(35, 39, '2025-05-31 09:00:00', '2025-05-31 17:00:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
(9, 9, '2025-05-05 09:00:00', '2025-05-05 14:30:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(10, 10, '2025-05-06 09:05:00', '2025-05-06 14:25:00', 'LATE', 'EARLY_LEAVE', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(11, 11, '2025-05-07 10:30:00', '2025-05-07 15:30:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(12, 12, null, null, 'ABSENT', 'ABSENT', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(13, 13, '2025-05-08 09:00:00', '2025-05-08 14:10:00', 'NORMAL', 'OVERTIME', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(14, 14, '2025-05-08 13:00:00', '2025-05-08 19:00:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(15, 15, '2025-05-09 12:05:00', '2025-05-09 18:00:00', 'LATE', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(16, 16, '2025-05-10 08:00:00', '2025-05-10 13:00:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(17, 17, null, null, 'ABSENT', 'ABSENT', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(18, 18, '2025-05-11 09:30:00', '2025-05-11 15:30:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(19, 19, '2025-05-12 08:40:00', '2025-05-12 14:20:00', 'LATE', 'EARLY_LEAVE', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(20, 20, '2025-05-13 11:30:00', '2025-05-13 19:00:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(21, 21, null, null, 'ABSENT', 'ABSENT', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(22, 22, '2025-05-15 08:00:00', '2025-05-15 16:30:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(23, 23, '2025-05-16 10:00:00', '2025-05-16 15:20:00', 'NORMAL', 'EARLY_LEAVE', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(24, 24, '2025-05-17 08:35:00', '2025-05-17 15:00:00', 'LATE', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(25, 25, '2025-05-20 08:30:00', '2025-05-20 15:00:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(26, 26, null, null, 'ABSENT', 'ABSENT', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(27, 27, '2025-05-22 09:30:00', '2025-05-22 17:30:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(28, 28, '2025-05-23 08:10:00', '2025-05-23 14:30:00', 'LATE', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(29, 29, '2025-05-24 08:00:00', '2025-05-24 15:30:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(30, 30, '2025-05-25 09:35:00', '2025-05-25 16:00:00', 'LATE', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(31, 31, '2025-05-26 08:00:00', '2025-05-26 15:00:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(32, 32, null, null, 'ABSENT', 'ABSENT', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(33, 33, '2025-05-29 10:05:00', '2025-05-29 15:10:00', 'LATE', 'OVERTIME', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(34, 34, '2025-05-30 08:00:00', '2025-05-30 14:00:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(35, 35, '2025-05-31 09:00:00', '2025-05-31 17:00:00', 'NORMAL', 'NORMAL', 'NONE', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
@Table(name = "attendance")
@Table(
name = "attendance",
indexes = {
@Index(name = "idx_attendance_schedule_id", columnList = "schedule_id"),
}
)
public class AttendanceEntity extends BaseTimeEntity {

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ ORDER BY DATE(s.workDate)
List<WorkDotProjection> findWorkDotProjections(Long storeId, LocalDate start, LocalDate end);

@Query("""
SELECT s AS staff,
SUM(CASE WHEN a.clockInStatus = 'NORMAL' THEN 1 ELSE 0 END) AS normalCount,
SUM(CASE WHEN a.clockInStatus = 'LATE' THEN 1 ELSE 0 END) AS lateCount,
SUM(CASE WHEN a.clockInStatus = 'ABSENT' THEN 1 ELSE 0 END) AS absentCount
FROM StaffEntity s
LEFT JOIN AttendanceEntity a
ON a.schedule.staff.id = s.id
AND a.schedule.workDate BETWEEN :start AND :end
WHERE s.store.id =:storeId
GROUP BY s.id
SELECT f AS staff,
SUM(CASE WHEN a.clockInStatus = 'NORMAL' THEN 1 ELSE 0 END) AS normalCount,
SUM(CASE WHEN a.clockInStatus = 'LATE' THEN 1 ELSE 0 END) AS lateCount,
SUM(CASE WHEN a.clockInStatus = 'ABSENT' THEN 1 ELSE 0 END) AS absentCount
FROM ScheduleEntity s
JOIN s.staff f
LEFT JOIN AttendanceEntity a ON a.schedule.id = s.id
WHERE f.store.id = :storeId
AND s.workDate BETWEEN :start AND :end
GROUP BY f.id
""")
List<StaffAttendanceCountProjection> findAttendanceCountsByStoreId(Long storeId, LocalDate start, LocalDate end);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@

@Getter
@Entity
@Table(name = "notification")
@Table(
name = "notification",
indexes = {
@Index(name = "idx_notification_type_meta", columnList = "type, meta_id"),
@Index(name = "idx_notification_sendstatus_retry", columnList = "send_status, retry_count"),
@Index(name = "idx_notification_user_store", columnList = "user_id, store_id")
}
)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class NotificationEntity extends BaseTimeEntity {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
@Table(name = "schedule")
@Table(
name = "schedule",
indexes = {
@Index(name = "idx_schedule_work_date", columnList = "store_id, work_date"),
@Index(name = "idx_end_time", columnList = "end_time"),
@Index(name = "idx_schedule_staff_workdate", columnList = "staff_id, work_date")
}
)
public class ScheduleEntity extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down Expand Up @@ -103,7 +110,7 @@ public void substituted(final StaffEntity staff) {
this.substitutionState = SubstitutionState.SUBSTITUTED;
}

public void rejected(){
public void rejected() {
this.substitutionState = SubstitutionState.NONE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,13 @@ public interface ScheduleJpaRepository extends JpaRepository<ScheduleEntity, Lon

List<ScheduleEntity> findAllByStaffIdAndWorkDate(Long staffId, LocalDate date);

@Query(
"""
SELECT s AS schedule, f.name AS staffName, st.boss.id AS bossId, st.id AS storeId
FROM ScheduleEntity s
JOIN StaffEntity f ON s.staff.id = f.id
JOIN StoreEntity st ON f.store.id = st.id
LEFT JOIN s.attendance a
WHERE s.endTime <= :standardTime
AND (a.clockOutStatus is NULL OR a is NULL)
"""
)
List<ScheduleForNotificationProjection> findAllSchedulesWithoutClockOut(LocalDateTime standardTime);
@Query("""
SELECT s FROM ScheduleEntity s
LEFT JOIN s.attendance a
WHERE s.endTime <= :standardTime
AND (a.clockOutStatus is NULL OR a is NULL)
""")
List<ScheduleEntity> findAllSchedulesWithoutClockOut(LocalDateTime standardTime);

Boolean existsByRegularGroupId(Long regularGroupId);

Expand Down
Loading
Loading