From 95bd6ba24973db19b16bf9d505b626e556e15e3a Mon Sep 17 00:00:00 2001 From: saokiritoni Date: Wed, 20 Aug 2025 23:39:50 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[hotfix]=20#noissue=20=EC=84=9C=EB=B2=84?= =?UTF-8?q?=EB=84=A4=EC=9E=84=20=EB=B0=98=ED=99=98=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin_be/domain/gpus/repository/GpuRepository.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/DGU_AI_LAB/admin_be/domain/gpus/repository/GpuRepository.java b/src/main/java/DGU_AI_LAB/admin_be/domain/gpus/repository/GpuRepository.java index 7dc0ce06..c2bdf6ef 100644 --- a/src/main/java/DGU_AI_LAB/admin_be/domain/gpus/repository/GpuRepository.java +++ b/src/main/java/DGU_AI_LAB/admin_be/domain/gpus/repository/GpuRepository.java @@ -17,7 +17,8 @@ interface GpuSummary { String getDescription(); Long getNodeCount(); Integer getRsgroupId(); - String getNodeId(); // 이 부분을 추가해야 합니다! 🚀 + String getNodeId(); + String getServerName(); } @Query(""" @@ -26,11 +27,12 @@ interface GpuSummary { rg.description AS description, COUNT(DISTINCT n.nodeId) AS nodeCount, rg.rsgroupId AS rsgroupId, - n.nodeId AS nodeId + n.nodeId AS nodeId, + rg.serverName AS serverName FROM Gpu g JOIN g.node n JOIN n.resourceGroup rg - GROUP BY g.gpuModel, g.ramGb, rg.description, rg.rsgroupId, n.nodeId + GROUP BY g.gpuModel, g.ramGb, rg.description, rg.rsgroupId, n.nodeId, rg.serverName """) List findGpuSummary(); @@ -48,4 +50,4 @@ interface NodeSpec { WHERE g.gpuModel = :gpuModel """) List findNodeSpecsByGpuModel(String gpuModel); -} \ No newline at end of file +} From 2a844f83429b7d6e473d572a052267d108bcb248 Mon Sep 17 00:00:00 2001 From: saokiritoni Date: Wed, 20 Aug 2025 23:40:35 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[hotfix]=20#noissue=20=EC=84=9C=EB=B2=84?= =?UTF-8?q?=EB=84=A4=EC=9E=84=20=EB=B0=98=ED=99=98=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20DTO=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gpus/dto/response/GpuTypeResponseDTO.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/DGU_AI_LAB/admin_be/domain/gpus/dto/response/GpuTypeResponseDTO.java b/src/main/java/DGU_AI_LAB/admin_be/domain/gpus/dto/response/GpuTypeResponseDTO.java index f122ec45..b3d8e0ff 100644 --- a/src/main/java/DGU_AI_LAB/admin_be/domain/gpus/dto/response/GpuTypeResponseDTO.java +++ b/src/main/java/DGU_AI_LAB/admin_be/domain/gpus/dto/response/GpuTypeResponseDTO.java @@ -25,6 +25,9 @@ public record GpuTypeResponseDTO( @Schema(description = "노드 ID", example = "LAB1") String nodeId, + @Schema(description = "서버명", example = "서버01") // serverName 필드 추가 + String serverName, + @Schema(description = "사용 가능한 노드(서버) 개수", example = "5") Long availableNodes, @@ -41,14 +44,15 @@ public record GpuTypeResponseDTO( * [3] availableNodes * [4] rsgroupId * [5] nodeId + * [6] serverName *

* * @param queryResult 쿼리 결과 객체 배열 * @return 변환된 GpuTypeResponseDTO */ public static GpuTypeResponseDTO fromQueryResult(Object[] queryResult) { - if (queryResult == null || queryResult.length < 6) { - throw new IllegalArgumentException("Invalid query result format for GpuTypeResponseDTO. Expected at least 6 elements."); + if (queryResult == null || queryResult.length < 7) { + throw new IllegalArgumentException("Invalid query result format for GpuTypeResponseDTO. Expected at least 7 elements."); } String gpuModel = (String) queryResult[0]; Integer ramGb = (Integer) queryResult[1]; @@ -56,6 +60,7 @@ public static GpuTypeResponseDTO fromQueryResult(Object[] queryResult) { Long availableNodes = ((Number) queryResult[3]).longValue(); Integer rsgroupId = (Integer) queryResult[4]; String nodeId = (String) queryResult[5]; + String serverName = (String) queryResult[6]; return GpuTypeResponseDTO.builder() .gpuModel(gpuModel) @@ -63,7 +68,8 @@ public static GpuTypeResponseDTO fromQueryResult(Object[] queryResult) { .resourceGroupName(resourceGroupName) .availableNodes(availableNodes) .rsgroupId(rsgroupId) - .nodeId(nodeId) // nodeId를 빌더에 추가 + .nodeId(nodeId) + .serverName(serverName) .isAvailable(true) // 현재는 항상 true로 가정 .build(); } @@ -71,7 +77,7 @@ public static GpuTypeResponseDTO fromQueryResult(Object[] queryResult) { /** * GpuSummary 객체를 DTO로 변환하는 팩토리 메서드입니다. *

- * GpuSummary 인터페이스에 nodeId를 가져오는 메서드가 있다고 가정합니다. + * GpuSummary 인터페이스에 serverName을 가져오는 메서드가 있다고 가정합니다. *

* * @param s GpuSummary 객체 @@ -85,6 +91,7 @@ public static GpuTypeResponseDTO fromSummary(GpuRepository.GpuSummary s) { .availableNodes(s.getNodeCount()) .rsgroupId(s.getRsgroupId()) .nodeId(s.getNodeId()) + .serverName(s.getServerName()) .build(); } }