From 1563e9409a9805ed8f6521d2766786ed5c9a4c60 Mon Sep 17 00:00:00 2001 From: dyhj625 Date: Fri, 14 Feb 2025 16:23:33 +0900 Subject: [PATCH] =?UTF-8?q?=ED=9C=B4=EA=B0=80=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/api/VacationController.java | 13 ++++++++++++- .../company/localhost/mapper/localvacaMapper.java | 2 ++ .../company/localhost/service/localvacaService.java | 4 ++++ src/main/resources/mapper/localvacaMapper.xml | 4 ++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/company/localhost/controller/api/VacationController.java b/src/main/java/io/company/localhost/controller/api/VacationController.java index bd259fe..ef61e70 100644 --- a/src/main/java/io/company/localhost/controller/api/VacationController.java +++ b/src/main/java/io/company/localhost/controller/api/VacationController.java @@ -33,11 +33,12 @@ public class VacationController { @Member @ParameterCheck @PostMapping - public ApiResponse saveVacations(@RequestBody List map) { + public ApiResponse saveVacations(@RequestBody List map) { Long user = AuthUtil.getUser().getId(); for (MapDto request : map) { String date = request.getString("date"); String type = request.getString("type"); + Object receiverId = request.get("receiverId"); if ( date == null || type == null) { throw new IllegalArgumentException("요청 데이터에 누락된 값이 있습니다: " + request); @@ -92,5 +93,15 @@ public class VacationController { public ApiResponse> getVacationCodeNames() { return ApiResponse.ok(localVacaService.getCommonCodeList()); } + + @GetMapping("/sent") + public ApiResponse> getSentVacations(@ReqMap MapDto map) { + Long userId = AuthUtil.getUser().getId(); // 현재 로그인한 사용자 ID + map.put("userId", userId); + List sentCount = localVacaService.getSentVacationCount(map); + + + return ApiResponse.ok(sentCount); + } } diff --git a/src/main/java/io/company/localhost/mapper/localvacaMapper.java b/src/main/java/io/company/localhost/mapper/localvacaMapper.java index ee3d883..6b4779e 100644 --- a/src/main/java/io/company/localhost/mapper/localvacaMapper.java +++ b/src/main/java/io/company/localhost/mapper/localvacaMapper.java @@ -21,6 +21,8 @@ public interface localvacaMapper { List getEmployeeRemainingVacation(); List getCommonCodeNames(); + + List countSentVacations(MapDto map); } diff --git a/src/main/java/io/company/localhost/service/localvacaService.java b/src/main/java/io/company/localhost/service/localvacaService.java index b8c0dfc..39ebedd 100644 --- a/src/main/java/io/company/localhost/service/localvacaService.java +++ b/src/main/java/io/company/localhost/service/localvacaService.java @@ -238,4 +238,8 @@ public class localvacaService { // 데이터가 비어있으면 빈 리스트 반환 (null 방지) return (codeList != null) ? codeList : new ArrayList<>(); } + + public List getSentVacationCount(MapDto map) { + return localvacaMapper.countSentVacations(map); + } } diff --git a/src/main/resources/mapper/localvacaMapper.xml b/src/main/resources/mapper/localvacaMapper.xml index c75ba51..2aceeee 100644 --- a/src/main/resources/mapper/localvacaMapper.xml +++ b/src/main/resources/mapper/localvacaMapper.xml @@ -109,5 +109,9 @@ WHERE CMNCODVAL IN ('700101', '700102', '700103') + + \ No newline at end of file