diff --git a/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCenterResourceCrossoverService.java b/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCenterResourceCrossoverService.java index b79ee9bddd2dd3608073bb870e8f8dc02da4cb70..45ddca38e7abba7cd6a61b4ccb03115339f3ab88 100644 --- a/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCenterResourceCrossoverService.java +++ b/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCenterResourceCrossoverService.java @@ -84,14 +84,6 @@ public interface IResourceCenterResourceCrossoverService extends ICrossoverServi List getAppResourceListByIdList(ResourceSearchVo searchVo); - Long getResourceIdByIpAndPortAndName(ResourceSearchVo searchVo); - - List getResourceIdListByIpAndPortAndName(ResourceSearchVo searchVo); - - List getResourceListByIpAndPortAndName(ResourceSearchVo searchVo); - - List getResourceListByIpAndPortAndNameWithFilter(ResourceSearchVo searchVo); - List getResourceByIdList(List idList); List getAuthResourceList(ResourceSearchVo searchVo); diff --git a/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCrossoverMapper.java b/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCrossoverMapper.java index 6209d80395a6ffa2c92d0377dd12f082784ce492..f193d8319c13affc0f8f816699514892f636ae50 100644 --- a/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCrossoverMapper.java +++ b/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCrossoverMapper.java @@ -39,18 +39,14 @@ public interface IResourceCrossoverMapper extends ICrossoverService { @Deprecated int getResourceCount(ResourceSearchVo searchVo); - int getResourceCountByDynamicCondition(@Param("searchVo") ResourceSearchVo searchVo, @Param("conditionSql") String conditionSql); @Deprecated List getResourceIdList(ResourceSearchVo searchVo); - List getResourceIdListByDynamicCondition(@Param("searchVo") ResourceSearchVo searchVo, @Param("conditionSql") String conditionSql); @Deprecated List getResourceListByIdList(List idList); List getAppInstanceResourceListByIdListSimple(List idList); - Long getResourceIdByIpAndPortAndName(ResourceSearchVo searchVo); - List getResourceByIdList(List idList); List getAuthResourceList(ResourceSearchVo searchVo); @@ -71,11 +67,6 @@ public interface IResourceCrossoverMapper extends ICrossoverService { List getAppModuleListByIdListSimple(@Param("idList") List idList, @Param("needOrder") boolean needOrder); - // 该SQL语句可以使用 getResourceListByIpAndPortAndName 代替 - List getResourceListByResourceVoList(@Param("resourceList") List resourceList,@Param("searchVo") ResourceSearchVo searchVo); - -// Set getResourceTypeIdListByAppSystemIdAndModuleIdAndEnvIdAndInspectStatusList(ResourceSearchVo searchVo); - List getResourceIdListByAppSystemIdAndModuleIdAndEnvId(ResourceVo resourceVo); /** * 根据类型和IP列表查询资源 @@ -115,6 +106,4 @@ public interface IResourceCrossoverMapper extends ICrossoverService { List searchAppSystemListByIdList(List idList); List getOsResourceListByResourceIdList(List resourceIdList); - - List getResourceListByIpAndPortAndNameWithFilter(ResourceSearchVo searchVo); } diff --git a/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/ResourceConditionConfigVo.java b/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/ResourceConditionConfigVo.java index 058d2c9f9e3a8e1eeef37c04e0742ffb8f4a639f..7b00420b018a15d6312080a4c8f1b4ef269461d7 100644 --- a/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/ResourceConditionConfigVo.java +++ b/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/ResourceConditionConfigVo.java @@ -202,10 +202,24 @@ public class ResourceConditionConfigVo extends ConditionConfigBaseVo vendorIdList = new ArrayList<>(); @@ -275,6 +289,24 @@ public class ResourceConditionConfigVo extends ConditionConfigBaseVo timeRange; @EntityField(name = "高级搜索条件", type = ApiParamType.JSONOBJECT) ResourceConditionConfigVo conditionConfig; + @EntityField(name = "前置高级搜索条件", type = ApiParamType.JSONOBJECT) + ResourceSearchVo preCondition; + @EntityField(name = "前置高级搜索条件生产的动态where sql", type = ApiParamType.STRING) + String conditionWhereSql; public ResourceSearchVo() { } @@ -482,4 +486,20 @@ public class ResourceSearchVo extends ConditionConfigVo { public void setConditionConfig(ResourceConditionConfigVo conditionConfig) { this.conditionConfig = conditionConfig; } + + public ResourceSearchVo getPreCondition() { + return preCondition; + } + + public void setPreCondition(ResourceSearchVo preCondition) { + this.preCondition = preCondition; + } + + public String getConditionWhereSql() { + return conditionWhereSql; + } + + public void setConditionWhereSql(String conditionWhereSql) { + this.conditionWhereSql = conditionWhereSql; + } } diff --git a/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/config/ResourceQueryCriteriaVo.java b/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/config/ResourceQueryCriteriaVo.java index b2d216c3e7fb960ee45cdd44dc195b25f64b4a4b..1280785a273fb42ca2786fe2a87e59b82374d464 100644 --- a/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/config/ResourceQueryCriteriaVo.java +++ b/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/config/ResourceQueryCriteriaVo.java @@ -18,11 +18,16 @@ package neatlogic.framework.cmdb.dto.resourcecenter.config; import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.cmdb.dto.resourcecenter.ResourceConditionConfigVo; import neatlogic.framework.cmdb.dto.resourcecenter.ResourceSearchVo; +import neatlogic.framework.cmdb.dto.resourcecenter.ResourceVo; import neatlogic.framework.common.constvalue.ApiParamType; import neatlogic.framework.dto.AuthenticationInfoVo; import neatlogic.framework.restful.annotation.EntityField; +import org.apache.commons.collections4.CollectionUtils; +import java.util.ArrayList; import java.util.List; public class ResourceQueryCriteriaVo { @@ -76,35 +81,79 @@ public class ResourceQueryCriteriaVo { private Integer isNameFieldSort; @EntityField(name = "作业ID", type = ApiParamType.LONG) private Long jobId; + @EntityField(name = "输入节点列表", type = ApiParamType.JSONARRAY) + private List inputNodeList; + @EntityField(name = "高级搜索条件", type = ApiParamType.JSONOBJECT) + ResourceConditionConfigVo conditionConfig; + public ResourceQueryCriteriaVo() { } public ResourceQueryCriteriaVo(ResourceSearchVo searchVo) { this.keyword = searchVo.getKeyword(); - this.keywordList = searchVo.getKeywordList(); - this.protocolIdList = searchVo.getProtocolIdList(); - this.tagIdList = searchVo.getTagIdList(); - this.inspectJobPhaseNodeStatusList = searchVo.getInspectJobPhaseNodeStatusList(); + if (CollectionUtils.isNotEmpty(searchVo.getKeywordList())) { + this.keywordList = new ArrayList<>(searchVo.getKeywordList()); + } + if (CollectionUtils.isNotEmpty(searchVo.getProtocolIdList())) { + this.protocolIdList = new ArrayList<>(searchVo.getProtocolIdList()); + } + if (CollectionUtils.isNotEmpty(searchVo.getTagIdList())) { + this.tagIdList = new ArrayList<>(searchVo.getTagIdList()); + } + if (CollectionUtils.isNotEmpty(searchVo.getInspectJobPhaseNodeStatusList())) { + this.inspectJobPhaseNodeStatusList = new ArrayList<>(searchVo.getInspectJobPhaseNodeStatusList()); + } this.isHasAuth = searchVo.getIsHasAuth(); this.cmdbGroupType = searchVo.getCmdbGroupType(); - this.batchSearchList = searchVo.getBatchSearchList(); + if (CollectionUtils.isNotEmpty(searchVo.getBatchSearchList())) { + this.batchSearchList = new ArrayList<>(searchVo.getBatchSearchList()); + } this.searchField = searchVo.getSearchField(); - this.typeIdList = searchVo.getTypeIdList(); - this.authedTypeIdList = searchVo.getAuthedTypeIdList(); - this.stateIdList = searchVo.getStateIdList(); - this.vendorIdList = searchVo.getVendorIdList(); - this.envIdList = searchVo.getEnvIdList(); + if (CollectionUtils.isNotEmpty(searchVo.getTypeIdList())) { + this.typeIdList = new ArrayList<>(searchVo.getTypeIdList()); + } + if (CollectionUtils.isNotEmpty(searchVo.getAuthedTypeIdList())) { + this.authedTypeIdList = new ArrayList<>(searchVo.getAuthedTypeIdList()); + } + if (CollectionUtils.isNotEmpty(searchVo.getStateIdList())) { + this.stateIdList = new ArrayList<>(searchVo.getStateIdList()); + } + if (CollectionUtils.isNotEmpty(searchVo.getVendorIdList())) { + this.vendorIdList = new ArrayList<>(searchVo.getVendorIdList()); + } + if (CollectionUtils.isNotEmpty(searchVo.getEnvIdList())) { + this.envIdList = new ArrayList<>(searchVo.getEnvIdList()); + } this.isExistNoEnv = searchVo.getExistNoEnv(); - this.appSystemIdList = searchVo.getAppSystemIdList(); - this.appModuleIdList = searchVo.getAppModuleIdList(); - this.defaultValue = searchVo.getDefaultValue(); - this.idList = searchVo.getIdList(); - this.inspectStatusList = searchVo.getInspectStatusList(); + if (CollectionUtils.isNotEmpty(searchVo.getAppSystemIdList())) { + this.appSystemIdList = new ArrayList<>(searchVo.getAppSystemIdList()); + } + if (CollectionUtils.isNotEmpty(searchVo.getAppModuleIdList())) { + this.appModuleIdList = new ArrayList<>(searchVo.getAppModuleIdList()); + } + if (CollectionUtils.isNotEmpty(searchVo.getDefaultValue())) { + this.defaultValue = new JSONArray(new ArrayList<>(searchVo.getDefaultValue())); + } + if (CollectionUtils.isNotEmpty(searchVo.getIdList())) { + this.idList = new ArrayList<>(searchVo.getIdList()); + } + if (CollectionUtils.isNotEmpty(searchVo.getInspectStatusList())) { + this.inspectStatusList = new ArrayList<>(searchVo.getInspectStatusList()); + } this.authenticationInfo = searchVo.getAuthenticationInfo(); this.ipFieldAttrId = searchVo.getIpFieldAttrId(); this.nameFieldAttrId = searchVo.getNameFieldAttrId(); this.isIpFieldSort = searchVo.getIsIpFieldSort(); this.isNameFieldSort = searchVo.getIsNameFieldSort(); + if (CollectionUtils.isNotEmpty(searchVo.getInputNodeList())) { + this.inputNodeList = new ArrayList<>(searchVo.getInputNodeList()); + } + if (CollectionUtils.isNotEmpty(searchVo.getConditionGroupList())) { + JSONObject conditionConfigObj = new JSONObject(); + conditionConfigObj.put("conditionGroupList", searchVo.getConditionGroupList()); + conditionConfigObj.put("conditionGroupRelList", searchVo.getConditionGroupRelList()); + this.conditionConfig = conditionConfigObj.toJavaObject(ResourceConditionConfigVo.class); + } } public String getKeyword() { @@ -314,4 +363,20 @@ public class ResourceQueryCriteriaVo { public void setJobId(Long jobId) { this.jobId = jobId; } + + public List getInputNodeList() { + return inputNodeList; + } + + public void setInputNodeList(List inputNodeList) { + this.inputNodeList = inputNodeList; + } + + public ResourceConditionConfigVo getConditionConfig() { + return conditionConfig; + } + + public void setConditionConfig(ResourceConditionConfigVo conditionConfig) { + this.conditionConfig = conditionConfig; + } } diff --git a/src/main/java/neatlogic/framework/cmdb/enums/CmdbTenantConfig.java b/src/main/java/neatlogic/framework/cmdb/enums/CmdbTenantConfig.java index fad6d2b9b2361acca56ef21ed5fad18c1e32edca..2b50563f208285173b12f0206fd909c4e4d85957 100644 --- a/src/main/java/neatlogic/framework/cmdb/enums/CmdbTenantConfig.java +++ b/src/main/java/neatlogic/framework/cmdb/enums/CmdbTenantConfig.java @@ -21,7 +21,7 @@ import neatlogic.framework.util.$; public enum CmdbTenantConfig implements ITenantConfig { IS_RESOURCECENTER_AUTH("is.resourcecenter.auth", "0", "nfce.cmdbtenantconfig.isresourcecenterauth"), RESOURCECENTER_DATA_COMPARISON_MODE_ENABLE("resourcecenter.data.comparison.mode.enable", "0", "是否开启资产清单新SQL和旧SQL查询结果对比模式,结果不一致会打印error日志"), - RESOURCECENTER_SQL_MODE("resourcecenter.sql.mode", "jsqlparser", "资产清单SQL模式,可选值为jsqlparser和mybatis,默认值是jsqlparser"), + RESOURCECENTER_SQL_MODE("resourcecenter.sql.mode", "mybatis", "资产清单SQL模式,可选值为jsqlparser和mybatis,默认值是jsqlparser"), ; String key; diff --git a/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/CmdbResourcecenterAccountTable.java b/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/CmdbResourcecenterAccountTable.java index f46656b26f567f22c15981707c22d6b0f74b614b..f44b64e38337a02c96652a0610c1848aa9b9c9c0 100644 --- a/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/CmdbResourcecenterAccountTable.java +++ b/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/CmdbResourcecenterAccountTable.java @@ -28,7 +28,7 @@ public class CmdbResourcecenterAccountTable implements ISqlTable { @Override public String getShortName() { - return "cra"; + return "c"; } public enum FieldEnum { diff --git a/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/CmdbResourcecenterResourceAccountTable.java b/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/CmdbResourcecenterResourceAccountTable.java index fa26f731ee921f88369e20fc3092b107838b13a9..6ce371b2160f122e10becbb11162ce35a2faca1c 100644 --- a/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/CmdbResourcecenterResourceAccountTable.java +++ b/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/CmdbResourcecenterResourceAccountTable.java @@ -28,7 +28,7 @@ public class CmdbResourcecenterResourceAccountTable implements ISqlTable { @Override public String getShortName() { - return "crra"; + return "b"; } public enum FieldEnum { diff --git a/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/CmdbResourcecenterResourceTagTable.java b/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/CmdbResourcecenterResourceTagTable.java index beffe76d080bf4e266fedfeb786c562c105e86b8..3fd594282b17cfabd8ff313fa9fe7696efd23be9 100644 --- a/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/CmdbResourcecenterResourceTagTable.java +++ b/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/CmdbResourcecenterResourceTagTable.java @@ -13,7 +13,7 @@ public class CmdbResourcecenterResourceTagTable implements ISqlTable { @Override public String getShortName() { - return "crrt"; + return "d"; } public enum FieldEnum { diff --git a/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/ScenceIpobjectDetailTable.java b/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/ScenceIpobjectDetailTable.java index 62462641c4f413e41a590fe61e0c83fdbc7616f4..2c4411f78fd1e12a3708e7355252ae46a385e077 100644 --- a/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/ScenceIpobjectDetailTable.java +++ b/src/main/java/neatlogic/framework/cmdb/resourcecenter/table/ScenceIpobjectDetailTable.java @@ -13,7 +13,7 @@ public class ScenceIpobjectDetailTable implements ISqlTable { @Override public String getShortName() { - return "sid"; + return "a"; } public enum FieldEnum {