add 根据数据中心查询虚拟机
parent
9208d0f8f7
commit
28696b3a6d
|
@ -84,9 +84,9 @@ public class CloudVendorRepository extends BasicGenericDao<CloudVendor, Long> {
|
|||
}
|
||||
return list.get(0);
|
||||
}
|
||||
public List<CloudVendor> getByDcName(String dcName) {
|
||||
String sql = "select * from cloud_vendor where dc_name = :dcName and is_deleted = 0";
|
||||
Map<String, Object> params = MapTools.simpleMap("dcName", dcName);
|
||||
public List<CloudVendor> getByDcId(Long dcId) {
|
||||
String sql = "select * from cloud_vendor where dc_id = :dcId and is_deleted = 0";
|
||||
Map<String, Object> params = MapTools.simpleMap("dcId", dcId);
|
||||
List<CloudVendor> list = this.list(CloudVendor.class, sql, params);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
|
|
|
@ -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<String, Object> 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<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(","));
|
||||
paramMap.put("vendorId", ids);
|
||||
param.setSign(Sign.IN);
|
||||
|
|
Loading…
Reference in New Issue