From 52287af9cd1d4ba1e468c8292811e4d87f668ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EB=AC=B8=EC=98=81?= Date: Mon, 29 Jan 2024 23:59:06 +0900 Subject: [PATCH] feat: changed tagList to int type (#26) --- .../java/com/bestoctopus/dearme/controller/MemoController.java | 2 +- .../java/com/bestoctopus/dearme/repository/MemoRepository.java | 2 +- src/main/java/com/bestoctopus/dearme/service/MemoService.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/bestoctopus/dearme/controller/MemoController.java b/src/main/java/com/bestoctopus/dearme/controller/MemoController.java index b07ffbd..254f527 100644 --- a/src/main/java/com/bestoctopus/dearme/controller/MemoController.java +++ b/src/main/java/com/bestoctopus/dearme/controller/MemoController.java @@ -56,7 +56,7 @@ public ResponseEntity getMemo(@PathVariable("memo_id") Long memo_id) { public ResponseEntity getMemoTagList(@RequestParam("tags") String tags, @RequestParam(required = false, defaultValue = "0", value = "page") Integer page) { - long[] tagList = Arrays.stream(tags.split(",")).mapToLong(Long::parseLong).toArray(); + int[] tagList = Arrays.stream(tags.split(",")).mapToInt(Integer::parseInt).toArray(); Slice memoList = memoService.getMemoTagList(tagList, page); diff --git a/src/main/java/com/bestoctopus/dearme/repository/MemoRepository.java b/src/main/java/com/bestoctopus/dearme/repository/MemoRepository.java index dd98d05..1b22a30 100644 --- a/src/main/java/com/bestoctopus/dearme/repository/MemoRepository.java +++ b/src/main/java/com/bestoctopus/dearme/repository/MemoRepository.java @@ -22,5 +22,5 @@ public interface MemoRepository extends JpaRepository { "left join fetch m.tags r " + "join m.tags t " + "where t.id in :tags") - Slice findSliceByTag(@Param("tags") long[] tags, Pageable pageable); + Slice findSliceByTag(@Param("tags") int[] tags, Pageable pageable); } \ No newline at end of file diff --git a/src/main/java/com/bestoctopus/dearme/service/MemoService.java b/src/main/java/com/bestoctopus/dearme/service/MemoService.java index 96a113e..819b221 100644 --- a/src/main/java/com/bestoctopus/dearme/service/MemoService.java +++ b/src/main/java/com/bestoctopus/dearme/service/MemoService.java @@ -38,7 +38,7 @@ public Optional getMemo(Long memo_id) { return memoRepository.findById(memo_id); } - public Slice getMemoTagList(long[] tags, Integer page) { + public Slice getMemoTagList(int[] tags, Integer page) { Pageable pageable = PageRequest.of(page, 10); Slice memo = memoRepository.findSliceByTag(tags, pageable);