From 8af78b0fdcd3f0b6532d23a66d291e4e4b4adb72 Mon Sep 17 00:00:00 2001 From: ckkim817 Date: Thu, 18 Jul 2024 03:33:10 +0900 Subject: [PATCH] =?UTF-8?q?[FEAT/#113]=20=EC=A4=91=EB=B3=B5=EB=90=9C=20?= =?UTF-8?q?=ED=95=99=EA=B3=BC=20=EC=9D=B4=EB=A6=84=20=ED=95=99=EA=B3=BC=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=EC=97=90=20=EC=A0=80=EC=9E=A5?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../seonyakServer/domain/university/service/UnivService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/sopt/seonyakServer/domain/university/service/UnivService.java b/src/main/java/org/sopt/seonyakServer/domain/university/service/UnivService.java index 03f4833..fa5722f 100644 --- a/src/main/java/org/sopt/seonyakServer/domain/university/service/UnivService.java +++ b/src/main/java/org/sopt/seonyakServer/domain/university/service/UnivService.java @@ -1,6 +1,8 @@ package org.sopt.seonyakServer.domain.university.service; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import org.sopt.seonyakServer.domain.university.dto.SearchDeptResponse; @@ -36,8 +38,10 @@ public List searchDept( } List departments = deptRepository.findByUnivIdAndDeptNameContaining(univName, deptName); + Set uniqueDeptNames = new HashSet<>(); return departments.stream() + .filter(department -> uniqueDeptNames.add(department.getDeptName())) .map(department -> SearchDeptResponse.of( department.getDeptName(), department.isClosed())