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);