From 2adaf7740a47f2cf58e8c5367e5bb93042afd825 Mon Sep 17 00:00:00 2001 From: "Artem.Arefev" Date: Wed, 5 Jun 2019 10:55:12 +0400 Subject: [PATCH] #93 removed comment --- .../user/repository/ActivityRepository.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/ru/ulstu/user/repository/ActivityRepository.java b/src/main/java/ru/ulstu/user/repository/ActivityRepository.java index 89b6093..cc0ec4e 100644 --- a/src/main/java/ru/ulstu/user/repository/ActivityRepository.java +++ b/src/main/java/ru/ulstu/user/repository/ActivityRepository.java @@ -3,17 +3,17 @@ package ru.ulstu.user.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; -//import ru.ulstu.user.model.Activity; -// -//import java.util.Date; -//import java.util.List; -// -//public interface ActivityRepository extends JpaRepository { -// -// @Query("SELECT a FROM Activity a WHERE (:userId IS NULL OR a.user.id = :userId) " + -// "AND (CAST(:dateFrom AS date) IS NULL OR :dateFrom < a.date) " + -// "AND (CAST(:dateTo AS date) IS NULL OR :dateTo > a.date)") -// List getByUserAndDateInterval(@Param("userId") Integer userId, -// @Param("dateFrom") Date dateFrom, -// @Param("dateTo") Date dateTo); -//} +import ru.ulstu.user.model.Activity; + +import java.util.Date; +import java.util.List; + +public interface ActivityRepository extends JpaRepository { + + @Query("SELECT a FROM Activity a WHERE (:userId IS NULL OR a.user.id = :userId) " + + "AND (CAST(:dateFrom AS date) IS NULL OR :dateFrom < a.date) " + + "AND (CAST(:dateTo AS date) IS NULL OR :dateTo > a.date)") + List getByUserAndDateInterval(@Param("userId") Integer userId, + @Param("dateFrom") Date dateFrom, + @Param("dateTo") Date dateTo); +}