From dffd839905ffda7d0d5cf86821b7c266abab9178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D0=BC=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=20=D0=9C?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D1=8F?= Date: Tue, 7 May 2019 20:26:49 +0400 Subject: [PATCH] #109 only uncompleted for grant --- src/main/java/ru/ulstu/grant/controller/GrantController.java | 2 +- src/main/java/ru/ulstu/grant/service/GrantService.java | 4 ++++ src/main/java/ru/ulstu/paper/repository/PaperRepository.java | 2 ++ src/main/java/ru/ulstu/paper/service/PaperService.java | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/ru/ulstu/grant/controller/GrantController.java b/src/main/java/ru/ulstu/grant/controller/GrantController.java index 85a0cd9..b28f8c0 100644 --- a/src/main/java/ru/ulstu/grant/controller/GrantController.java +++ b/src/main/java/ru/ulstu/grant/controller/GrantController.java @@ -132,7 +132,7 @@ public class GrantController { @ModelAttribute("allPapers") public List getAllPapers() { - return grantService.getAllPapers(); + return grantService.getAllUncompletedPapers(); } private void filterEmptyDeadlines(GrantDto grantDto) { diff --git a/src/main/java/ru/ulstu/grant/service/GrantService.java b/src/main/java/ru/ulstu/grant/service/GrantService.java index 9cff4b6..ae11850 100644 --- a/src/main/java/ru/ulstu/grant/service/GrantService.java +++ b/src/main/java/ru/ulstu/grant/service/GrantService.java @@ -196,6 +196,10 @@ public class GrantService { return paperService.findAll(); } + public List getAllUncompletedPapers() { + return paperService.findAllNotCompleted(); + } + public void attachPaper(GrantDto grantDto) { if (!grantDto.getPaperIds().isEmpty()) { grantDto.getPapers().clear(); diff --git a/src/main/java/ru/ulstu/paper/repository/PaperRepository.java b/src/main/java/ru/ulstu/paper/repository/PaperRepository.java index f935247..7eff73d 100644 --- a/src/main/java/ru/ulstu/paper/repository/PaperRepository.java +++ b/src/main/java/ru/ulstu/paper/repository/PaperRepository.java @@ -18,4 +18,6 @@ public interface PaperRepository extends JpaRepository { List findAllByIdIn(List paperIds); List findByTypeAndStatus(Paper.PaperType type, Paper.PaperStatus status); + + List findByStatusNot(Paper.PaperStatus status); } diff --git a/src/main/java/ru/ulstu/paper/service/PaperService.java b/src/main/java/ru/ulstu/paper/service/PaperService.java index f98997d..956b4b6 100644 --- a/src/main/java/ru/ulstu/paper/service/PaperService.java +++ b/src/main/java/ru/ulstu/paper/service/PaperService.java @@ -246,7 +246,10 @@ public class PaperService { } else { return sortPapers(paperRepository.findAll()); } + } + public List findAllNotCompleted() { + return paperRepository.findByStatusNot(COMPLETED); } public List findAllSelect(List paperIds) {