From 6e2b59d2e83a53d685c2ae4a24bd7f5fdaa18b5d Mon Sep 17 00:00:00 2001 From: mijin0721 Date: Tue, 28 Mar 2023 15:53:27 +0900 Subject: [PATCH] =?UTF-8?q?docs=20:=20notice=20=EB=AA=A9=EB=A1=9D=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=EC=99=80=20=EA=B2=80=EC=83=89=ED=95=A0=20=EB=95=8C=20?= =?UTF-8?q?=EC=B5=9C=EC=8B=A0=EC=97=90=20=EC=9E=91=EC=84=B1=EB=90=9C=20?= =?UTF-8?q?=EA=B2=83=EC=9D=B4=20=EB=82=98=EC=98=AC=20=EC=88=98=20=EC=9E=88?= =?UTF-8?q?=EB=8F=84=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../festival/domain/notice/repository/NoticeRepository.java | 4 ++-- .../hallym/festival/domain/notice/service/NoticeService.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/hallym/festival/domain/notice/repository/NoticeRepository.java b/src/main/java/com/hallym/festival/domain/notice/repository/NoticeRepository.java index a3d7d9f..7ce27b2 100644 --- a/src/main/java/com/hallym/festival/domain/notice/repository/NoticeRepository.java +++ b/src/main/java/com/hallym/festival/domain/notice/repository/NoticeRepository.java @@ -7,8 +7,8 @@ import java.util.List; public interface NoticeRepository extends JpaRepository { - List findAllByActive(Boolean active); - List findByTitleContainingAndActive(String keyword, Boolean active); + List findAllByActiveOrderByRegDateDesc(Boolean active); + List findByTitleContainingAndActiveOrderByRegDateDesc(String keyword, Boolean active); } diff --git a/src/main/java/com/hallym/festival/domain/notice/service/NoticeService.java b/src/main/java/com/hallym/festival/domain/notice/service/NoticeService.java index ef6da33..f04e322 100644 --- a/src/main/java/com/hallym/festival/domain/notice/service/NoticeService.java +++ b/src/main/java/com/hallym/festival/domain/notice/service/NoticeService.java @@ -29,7 +29,7 @@ public NoticeDto create(NoticeDto noticeDto) { } public List getNoticeList() { - List noticeList = noticeRepository.findAllByActive(Boolean.TRUE); + List noticeList = noticeRepository.findAllByActiveOrderByRegDateDesc(Boolean.TRUE); return noticeList.stream() .map(notice -> notice.toDto()) .collect(Collectors.toList()); @@ -59,7 +59,7 @@ public NoticeDto update(Long id, NoticeDto noticeDto) { @Transactional public List search(String keyword) { - List noticeList = noticeRepository.findByTitleContainingAndActive(keyword, Boolean.TRUE); + List noticeList = noticeRepository.findByTitleContainingAndActiveOrderByRegDateDesc(keyword, Boolean.TRUE); List noticeDtoList = new ArrayList<>(); if(noticeList.isEmpty()) return noticeDtoList; for (Notice notice : noticeList) {