fix: ReportRepository method name mismatch (targetDate)
This commit is contained in:
@@ -17,7 +17,8 @@ public interface ReportRepository extends JpaRepository<Report, Long> {
|
||||
Page<Report> findByStatus(ReportStatus status, Pageable pageable);
|
||||
List<Report> findByUser_EmpIdAndTargetDateBetween(Long empId, LocalDate start, LocalDate end);
|
||||
List<Report> findByDispatch_DispatchId(Long dispatchId);
|
||||
Page<Report> findByUser_EmpIdAndStatusAndReportType(Long empId, ReportStatus status, ReportType reportType, LocalDate targetDate, Pageable pageable);
|
||||
Page<Report> findByUser_EmpIdAndStatusAndReportTypeAndTargetDate(Long empId, ReportStatus status, ReportType reportType, LocalDate targetDate, Pageable pageable);
|
||||
Page<Report> findByUser_EmpIdAndStatusAndReportType(Long empId, ReportStatus status, ReportType reportType, Pageable pageable);
|
||||
List<Report> findByTargetDateBetween(LocalDate start, LocalDate end);
|
||||
long countByStatus(ReportStatus status);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,12 @@ public class ReportService {
|
||||
|
||||
public Page<WorkReportResponse> findByUserId(Long userId, ReportStatus status, String type, LocalDate targetDate, Pageable pageable) {
|
||||
ReportType reportType = type != null ? ReportType.valueOf(type) : null;
|
||||
Page<Report> reports = reportRepository.findByUser_EmpIdAndStatusAndReportType(userId, status, reportType, targetDate, pageable);
|
||||
Page<Report> reports;
|
||||
if (targetDate != null) {
|
||||
reports = reportRepository.findByUser_EmpIdAndStatusAndReportTypeAndTargetDate(userId, status, reportType, targetDate, pageable);
|
||||
} else {
|
||||
reports = reportRepository.findByUser_EmpIdAndStatusAndReportType(userId, status, reportType, pageable);
|
||||
}
|
||||
return reports.map(this::toWorkReportResponse);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user