From 28696b3a6d87ca40fcf6180bda7b02c1ca5717e7 Mon Sep 17 00:00:00 2001 From: bayuzhen Date: Wed, 6 Nov 2024 16:13:41 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E6=A0=B9=E6=8D=AE=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E6=9F=A5=E8=AF=A2=E8=99=9A=E6=8B=9F=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bocloud/cmp/repository/CloudVendorRepository.java | 6 +++--- .../cmp/service/impl/CloudServerServiceImpl.java | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/bocloud/cmp/repository/CloudVendorRepository.java b/src/main/java/com/bocloud/cmp/repository/CloudVendorRepository.java index 95abbfc..5c24805 100644 --- a/src/main/java/com/bocloud/cmp/repository/CloudVendorRepository.java +++ b/src/main/java/com/bocloud/cmp/repository/CloudVendorRepository.java @@ -84,9 +84,9 @@ public class CloudVendorRepository extends BasicGenericDao { } return list.get(0); } - public List getByDcName(String dcName) { - String sql = "select * from cloud_vendor where dc_name = :dcName and is_deleted = 0"; - Map params = MapTools.simpleMap("dcName", dcName); + public List getByDcId(Long dcId) { + String sql = "select * from cloud_vendor where dc_id = :dcId and is_deleted = 0"; + Map params = MapTools.simpleMap("dcId", dcId); List list = this.list(CloudVendor.class, sql, params); if (list.isEmpty()) { return null; diff --git a/src/main/java/com/bocloud/cmp/service/impl/CloudServerServiceImpl.java b/src/main/java/com/bocloud/cmp/service/impl/CloudServerServiceImpl.java index 55b6694..5de2eb9 100644 --- a/src/main/java/com/bocloud/cmp/service/impl/CloudServerServiceImpl.java +++ b/src/main/java/com/bocloud/cmp/service/impl/CloudServerServiceImpl.java @@ -299,7 +299,7 @@ public class CloudServerServiceImpl implements CloudServerService { Integer rows = Optional.ofNullable(pager.getRows()).orElse(10); Long clusterId = null; String labelContent = null; - String dcName = null; + Long dcId = null; for (Param param : params) { Map paramMap = param.getParam(); if (paramMap.containsKey("clusterId")) { @@ -310,11 +310,11 @@ public class CloudServerServiceImpl implements CloudServerService { labelContent = paramMap.get("labelContent").toString(); paramMap.remove("labelContent"); } - if (paramMap.containsKey("dcName")) { - dcName = paramMap.get("dcName").toString(); - paramMap.remove("dcName"); + if (paramMap.containsKey("dcId")) { + dcId = Long.valueOf(paramMap.get("dcId").toString()); + paramMap.remove("dcId"); // 查询相应云平台 - List cloudVendors = cloudVendorRepository.getByDcName(dcName); + List cloudVendors = cloudVendorRepository.getByDcId(dcId); String ids = cloudVendors.stream().map(CloudVendor::getId).map(item -> String.valueOf(item)).collect(Collectors.joining(",")); paramMap.put("vendorId", ids); param.setSign(Sign.IN);