add 根据数据中心查询虚拟机
parent
9208d0f8f7
commit
28696b3a6d
|
@ -84,9 +84,9 @@ public class CloudVendorRepository extends BasicGenericDao<CloudVendor, Long> {
|
||||||
}
|
}
|
||||||
return list.get(0);
|
return list.get(0);
|
||||||
}
|
}
|
||||||
public List<CloudVendor> getByDcName(String dcName) {
|
public List<CloudVendor> getByDcId(Long dcId) {
|
||||||
String sql = "select * from cloud_vendor where dc_name = :dcName and is_deleted = 0";
|
String sql = "select * from cloud_vendor where dc_id = :dcId and is_deleted = 0";
|
||||||
Map<String, Object> params = MapTools.simpleMap("dcName", dcName);
|
Map<String, Object> params = MapTools.simpleMap("dcId", dcId);
|
||||||
List<CloudVendor> list = this.list(CloudVendor.class, sql, params);
|
List<CloudVendor> list = this.list(CloudVendor.class, sql, params);
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -299,7 +299,7 @@ public class CloudServerServiceImpl implements CloudServerService {
|
||||||
Integer rows = Optional.ofNullable(pager.getRows()).orElse(10);
|
Integer rows = Optional.ofNullable(pager.getRows()).orElse(10);
|
||||||
Long clusterId = null;
|
Long clusterId = null;
|
||||||
String labelContent = null;
|
String labelContent = null;
|
||||||
String dcName = null;
|
Long dcId = null;
|
||||||
for (Param param : params) {
|
for (Param param : params) {
|
||||||
Map<String, Object> paramMap = param.getParam();
|
Map<String, Object> paramMap = param.getParam();
|
||||||
if (paramMap.containsKey("clusterId")) {
|
if (paramMap.containsKey("clusterId")) {
|
||||||
|
@ -310,11 +310,11 @@ public class CloudServerServiceImpl implements CloudServerService {
|
||||||
labelContent = paramMap.get("labelContent").toString();
|
labelContent = paramMap.get("labelContent").toString();
|
||||||
paramMap.remove("labelContent");
|
paramMap.remove("labelContent");
|
||||||
}
|
}
|
||||||
if (paramMap.containsKey("dcName")) {
|
if (paramMap.containsKey("dcId")) {
|
||||||
dcName = paramMap.get("dcName").toString();
|
dcId = Long.valueOf(paramMap.get("dcId").toString());
|
||||||
paramMap.remove("dcName");
|
paramMap.remove("dcId");
|
||||||
// 查询相应云平台
|
// 查询相应云平台
|
||||||
List<CloudVendor> cloudVendors = cloudVendorRepository.getByDcName(dcName);
|
List<CloudVendor> cloudVendors = cloudVendorRepository.getByDcId(dcId);
|
||||||
String ids = cloudVendors.stream().map(CloudVendor::getId).map(item -> String.valueOf(item)).collect(Collectors.joining(","));
|
String ids = cloudVendors.stream().map(CloudVendor::getId).map(item -> String.valueOf(item)).collect(Collectors.joining(","));
|
||||||
paramMap.put("vendorId", ids);
|
paramMap.put("vendorId", ids);
|
||||||
param.setSign(Sign.IN);
|
param.setSign(Sign.IN);
|
||||||
|
|
Loading…
Reference in New Issue