From e86bae13462447911444069f648ae766edc3999c Mon Sep 17 00:00:00 2001 From: 2oo1s Date: Wed, 13 Nov 2024 15:04:13 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[chore]=20#77=20-=20=EC=A7=80=ED=98=9C=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=EB=B3=B4=EA=B8=B0=20=EB=82=B4=20=EB=B0=98?= =?UTF-8?q?=ED=99=98=EB=90=98=EB=8A=94=20=EC=A0=95=EB=B3=B4=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AdminKnowhowController.java | 3 +- .../wooribound/domain/knowhow/Knowhow.java | 35 +++++++++---------- .../domain/knowhow/KnowhowRepository.java | 4 +-- .../knowhow/dto/AdminKnowhowDetailDTO.java | 1 + .../dto/AdminKnowhowDetailProjection.java | 2 ++ .../service/AdminKnowhowServiceImpl.java | 1 + 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java b/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java index d0fbb82..fc6cb70 100644 --- a/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java +++ b/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java @@ -11,7 +11,7 @@ @RequiredArgsConstructor @RestController -@RequestMapping("/admin/knowhow/") +@RequestMapping("/admin/knowhow") public class AdminKnowhowController { private final AdminKnowhowFacade adminKnowhowFacade; @@ -22,6 +22,7 @@ public List getAllKnowhows(@ModelAttribute AdminKnowhowReqDTO a @GetMapping("/detail") public AdminKnowhowDetailDTO getKnowhowDetail(@RequestParam Long knowhowId) { + System.out.println("=========" + knowhowId+"========="); return adminKnowhowFacade.getKnowhowDetail(knowhowId); } diff --git a/src/main/java/com/wooribound/domain/knowhow/Knowhow.java b/src/main/java/com/wooribound/domain/knowhow/Knowhow.java index 27d175a..ab39844 100644 --- a/src/main/java/com/wooribound/domain/knowhow/Knowhow.java +++ b/src/main/java/com/wooribound/domain/knowhow/Knowhow.java @@ -23,28 +23,27 @@ ) public class Knowhow { - @Id - @Column(name = "knowhow_id") - private Long knowhowId; + @Id + @Column(name = "knowhow_id") + private Long knowhowId; - @Column(name = "knowhow_job", length = 30, nullable = false) - private String knowhowJob; + @Column(name = "knowhow_job", length = 30, nullable = false) + private String knowhowJob; - @Column(name = "knowhow_title", length = 100, nullable = false) - private String knowhowTitle; + @Column(name = "knowhow_title", length = 100, nullable = false) + private String knowhowTitle; - @Lob - @Column(name = "knowhow_content", nullable = false) - private String knowhowContent; + @Column(name = "knowhow_content", length = 4000, nullable = false) + private String knowhowContent; - @Column(name = "upload_date", nullable = false) - private Date uploadDate; + @Column(name = "upload_date", nullable = false) + private Date uploadDate; - @ManyToOne - @JoinColumn(name = "user_id", nullable = false) - private WbUser wbUser; - - @OneToMany(mappedBy = "knowhow", fetch = FetchType.LAZY, cascade = CascadeType.ALL) // cascade 추가 - private List knowhowReportedList; + @ManyToOne + @JoinColumn(name = "user_id", nullable = false) + private WbUser wbUser; + + @OneToMany(mappedBy = "knowhow", fetch = FetchType.LAZY, cascade = CascadeType.ALL) // cascade 추가 + private List knowhowReportedList; } diff --git a/src/main/java/com/wooribound/domain/knowhow/KnowhowRepository.java b/src/main/java/com/wooribound/domain/knowhow/KnowhowRepository.java index a015499..1bd2508 100644 --- a/src/main/java/com/wooribound/domain/knowhow/KnowhowRepository.java +++ b/src/main/java/com/wooribound/domain/knowhow/KnowhowRepository.java @@ -53,10 +53,10 @@ List findAllWithUploadDateDesc(@Param("knowhowTitle") St @Query("SELECT k.knowhowId AS knowhowId, k.knowhowJob AS knowhowJob, " + "k.knowhowTitle AS knowhowTitle, k.uploadDate AS uploadDate, " + "k.knowhowContent AS knowhowContent, COUNT(k_report) AS reportedCnt, " + - "k.wbUser.userId AS userId FROM Knowhow k " + + "k.wbUser.userId AS userId, k.wbUser.name AS userName FROM Knowhow k " + "LEFT JOIN KnowhowReported k_report ON k_report.knowhow = k " + "WHERE k.knowhowId = :knowhowId " + - "GROUP BY k.knowhowId, k.knowhowJob, k.knowhowTitle, k.uploadDate, k.knowhowContent, k.wbUser.userId") + "GROUP BY k.knowhowId, k.knowhowJob, k.knowhowTitle, k.uploadDate, k.knowhowContent, k.wbUser.userId, k.wbUser.name") Optional findByKnowhowId(@Param("knowhowId") Long knowhowId); @Modifying diff --git a/src/main/java/com/wooribound/domain/knowhow/dto/AdminKnowhowDetailDTO.java b/src/main/java/com/wooribound/domain/knowhow/dto/AdminKnowhowDetailDTO.java index 8054613..a3585c4 100644 --- a/src/main/java/com/wooribound/domain/knowhow/dto/AdminKnowhowDetailDTO.java +++ b/src/main/java/com/wooribound/domain/knowhow/dto/AdminKnowhowDetailDTO.java @@ -12,6 +12,7 @@ public class AdminKnowhowDetailDTO { private Long knowhowId; private String userId; + private String userName; private String knowhowJob; private String knowhowTitle; private String knowhowContent; diff --git a/src/main/java/com/wooribound/domain/knowhow/dto/AdminKnowhowDetailProjection.java b/src/main/java/com/wooribound/domain/knowhow/dto/AdminKnowhowDetailProjection.java index 0319c24..7bfff0a 100644 --- a/src/main/java/com/wooribound/domain/knowhow/dto/AdminKnowhowDetailProjection.java +++ b/src/main/java/com/wooribound/domain/knowhow/dto/AdminKnowhowDetailProjection.java @@ -9,6 +9,8 @@ public interface AdminKnowhowDetailProjection { String getUserId(); + String getUserName(); + String getKnowhowTitle(); String getKnowhowContent(); diff --git a/src/main/java/com/wooribound/domain/knowhow/service/AdminKnowhowServiceImpl.java b/src/main/java/com/wooribound/domain/knowhow/service/AdminKnowhowServiceImpl.java index 8878d8c..e70dee7 100644 --- a/src/main/java/com/wooribound/domain/knowhow/service/AdminKnowhowServiceImpl.java +++ b/src/main/java/com/wooribound/domain/knowhow/service/AdminKnowhowServiceImpl.java @@ -54,6 +54,7 @@ public AdminKnowhowDetailDTO getKnowhowDetail(Long knowhowId) { return AdminKnowhowDetailDTO.builder() .knowhowId(knowhow.getKnowhowId()) .userId(knowhow.getUserId()) + .userName(knowhow.getUserName()) .knowhowJob(knowhow.getKnowhowJob()) .knowhowTitle(knowhow.getKnowhowTitle()) .knowhowContent(knowhow.getKnowhowContent()) From 88385fe1b65e5e30f53887b39559cf19dd4f73a6 Mon Sep 17 00:00:00 2001 From: 2oo1s Date: Wed, 13 Nov 2024 16:47:32 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[chore]=20#77=20-=20AdminKnowhowController?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=B6=9C=EB=A0=A5=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wooribound/api/admin/controller/AdminKnowhowController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java b/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java index fc6cb70..937832e 100644 --- a/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java +++ b/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java @@ -22,12 +22,12 @@ public List getAllKnowhows(@ModelAttribute AdminKnowhowReqDTO a @GetMapping("/detail") public AdminKnowhowDetailDTO getKnowhowDetail(@RequestParam Long knowhowId) { - System.out.println("=========" + knowhowId+"========="); return adminKnowhowFacade.getKnowhowDetail(knowhowId); } @PostMapping("/delete") public String deleteKnowhow(@RequestParam Long knowhowId) { + System.out.println("==========" + knowhowId +"=========="); return adminKnowhowFacade.deleteKnowhow(knowhowId); } } From 4e84df5c2b50f6ddf6db5a30575e06733b48a12d Mon Sep 17 00:00:00 2001 From: 2oo1s Date: Wed, 13 Nov 2024 16:49:35 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[chore]=20#77=20-=20AdminKnowhowController?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=B6=9C=EB=A0=A5=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wooribound/api/admin/controller/AdminKnowhowController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java b/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java index 937832e..2e13755 100644 --- a/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java +++ b/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java @@ -27,7 +27,6 @@ public AdminKnowhowDetailDTO getKnowhowDetail(@RequestParam Long knowhowId) { @PostMapping("/delete") public String deleteKnowhow(@RequestParam Long knowhowId) { - System.out.println("==========" + knowhowId +"=========="); return adminKnowhowFacade.deleteKnowhow(knowhowId); } } From fd63cf3c8b41d23e4d1a8ca92db444c0960eb5aa Mon Sep 17 00:00:00 2001 From: 2oo1s Date: Wed, 13 Nov 2024 16:54:11 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[chore]=20#77=20-=20AdminKnowhowController?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=B6=9C=EB=A0=A5=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wooribound/api/admin/controller/AdminKnowhowController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java b/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java index fc6cb70..2e13755 100644 --- a/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java +++ b/src/main/java/com/wooribound/api/admin/controller/AdminKnowhowController.java @@ -22,7 +22,6 @@ public List getAllKnowhows(@ModelAttribute AdminKnowhowReqDTO a @GetMapping("/detail") public AdminKnowhowDetailDTO getKnowhowDetail(@RequestParam Long knowhowId) { - System.out.println("=========" + knowhowId+"========="); return adminKnowhowFacade.getKnowhowDetail(knowhowId); }