Skip to content

Commit

Permalink
Merge pull request #5 from mijin0721/devepole2
Browse files Browse the repository at this point in the history
Devepole2
  • Loading branch information
mijin0721 authored Mar 28, 2023
2 parents 6ec534f + a551372 commit e7f044f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import java.util.List;

public interface NoticeRepository extends JpaRepository<Notice, Long> {
List<Notice> findAllByActive(Boolean active);
List<Notice> findByTitleContainingAndActive(String keyword, Boolean active);
List<Notice> findAllByActiveOrderByRegDateDesc(Boolean active);
List<Notice> findByTitleContainingAndActiveOrderByRegDateDesc(String keyword, Boolean active);


}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public NoticeDto create(NoticeDto noticeDto) {
}

public List<NoticeDto> getNoticeList() {
List<Notice> noticeList = noticeRepository.findAllByActive(Boolean.TRUE);
List<Notice> noticeList = noticeRepository.findAllByActiveOrderByRegDateDesc(Boolean.TRUE);
return noticeList.stream()
.map(notice -> notice.toDto())
.collect(Collectors.toList());
Expand Down Expand Up @@ -59,7 +59,7 @@ public NoticeDto update(Long id, NoticeDto noticeDto) {

@Transactional
public List<NoticeDto> search(String keyword) {
List<Notice> noticeList = noticeRepository.findByTitleContainingAndActive(keyword, Boolean.TRUE);
List<Notice> noticeList = noticeRepository.findByTitleContainingAndActiveOrderByRegDateDesc(keyword, Boolean.TRUE);
List<NoticeDto> noticeDtoList = new ArrayList<>();
if(noticeList.isEmpty()) return noticeDtoList;
for (Notice notice : noticeList) {
Expand Down

0 comments on commit e7f044f

Please sign in to comment.