From c07632169bd89b24ed600a1c7f43c103ab4b014e Mon Sep 17 00:00:00 2001 From: ZhouYixun <291028775@qq.com> Date: Wed, 8 Jun 2022 01:53:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A7=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/impl/DevicesServiceImpl.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/impl/DevicesServiceImpl.java b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/impl/DevicesServiceImpl.java index 4c338e29..4f3a6ddb 100644 --- a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/impl/DevicesServiceImpl.java +++ b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/impl/DevicesServiceImpl.java @@ -141,12 +141,22 @@ public List findByIdIn(List ids) { @Override public Devices findByAgentIdAndUdId(int agentId, String udId) { - return lambdaQuery().eq(Devices::getAgentId, agentId).eq(Devices::getUdId, udId).one(); + List devicesList = lambdaQuery().eq(Devices::getAgentId, agentId).eq(Devices::getUdId, udId).list(); + if (devicesList.size() > 0) { + return devicesList.get(0); + } else { + return null; + } } @Override public Devices findByUdId(String udId) { - return lambdaQuery().eq(Devices::getUdId, udId).one(); + List devicesList = lambdaQuery().eq(Devices::getUdId, udId).list(); + if (devicesList.size() > 0) { + return devicesList.get(0); + } else { + return null; + } } @Override