diff --git a/src/main/java/neatlogic/framework/cmdb/crossover/IResourceBuildSqlCrossoverService.java b/src/main/java/neatlogic/framework/cmdb/crossover/IResourceBuildSqlCrossoverService.java new file mode 100644 index 0000000000000000000000000000000000000000..2a47684a57ba93dd57997217a2b4eb7bc43e0a2c --- /dev/null +++ b/src/main/java/neatlogic/framework/cmdb/crossover/IResourceBuildSqlCrossoverService.java @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package neatlogic.framework.cmdb.crossover; + +import neatlogic.framework.cmdb.dto.resourcecenter.AccountComponentVo; +import neatlogic.framework.cmdb.dto.resourcecenter.ResourceSearchVo; +import neatlogic.framework.cmdb.dto.resourcecenter.ResourceVo; +import neatlogic.framework.crossover.ICrossoverService; + +import java.util.List; + +public interface IResourceBuildSqlCrossoverService extends ICrossoverService { + + String buildGetResourceIdListSql(ResourceSearchVo searchVo); + + String buildGetResourceCountSql(ResourceSearchVo searchVo); + + String buildGetResourceListSql(List idList, List selectFieldNameList); + + String buildGetResourceListSql(List idList); + + String buildGetResourceCountByNameKeywordSql(ResourceSearchVo searchVo); + + String buildGetResourceCountByIpKeywordSql(ResourceSearchVo searchVo); + + String buildGetAuthResourceListSql(ResourceSearchVo searchVo); + + String buildGetResourceListByIpAndPortAndNameWithFilterSql(ResourceSearchVo searchVo); + + String buildGetResourceTypeIdListByAuthSql(ResourceSearchVo searchVo); + + String buildGetResourceIdByIpAndPortAndNameSql(ResourceSearchVo searchVo); + + String buildGetResourceIdListByIpAndPortAndNameSql(ResourceSearchVo searchVo); + + String buildGetResourceListByIpAndPortAndNameSql(ResourceSearchVo searchVo); + + String buildGetResourceByIdListSql(List idList); + + String buildGetResourceByIdSql(Long id, List selectFieldNameList); + + String buildGetResourceByIdSql(Long id); + + String buildGetResourceIdByResourceIdSql(Long id); + + String buildCheckResourceIdListIsExistsSql(List idList); + + String buildGetResourceIdListByAppSystemIdAndModuleIdAndEnvIdSql(ResourceVo resourceVo); + + String buildGetResourceListByTypeIdListAndIpListSql(List typeIdList, List ipList); + + String buildGetResourceByIpAndPortAndNameAndTypeNameSql(String ip, Integer port, String name, String typeName); + + String buildGetResourceByIpAndPortSql(String ip, Integer port); + + String buildSearchAccountComponentSql(AccountComponentVo accountComponentVo); + + String buildSearchAccountComponentCountSql(AccountComponentVo accountComponentVo); + + String buildGetAppEnvListByAppSystemIdAndAppModuleIdSql(Long appSystemId, Long appModuleId); + + String buildGetAppEnvCountMapByAppSystemIdGroupByAppModuleIdSql(Long appSystemId); + +// String buildGetResourceCountByDynamicConditionSql(); +// String buildGetResourceIdListByDynamicConditionSql(); + + // InspectMapper + String buildGetInspectResourceListByIdListSql(List idList, List selectFieldNameList); + + String buildGetInspectResourceListByIdListSql(List idList); + + String buildGetInspectResourceCountSql(ResourceSearchVo searchVo); + + String buildGetInspectResourceCountByIpKeywordSql(ResourceSearchVo searchVo); + + String buildGetInspectResourceCountByNameKeywordSql(ResourceSearchVo searchVo); + + String buildGetInspectResourceIdListSql(ResourceSearchVo searchVo); + + String buildGetInspectAutoexecJobNodeResourceCountSql(ResourceSearchVo searchVo, Long jobId); + + String buildGetInspectAutoexecJobNodeResourceCountByIpKeywordSql(ResourceSearchVo searchVo, Long jobId); + + String buildGetInspectAutoexecJobNodeResourceCountByNameKeywordSql(ResourceSearchVo searchVo, Long jobId); + + String buildGetInspectAutoexecJobNodeResourceIdListSql(ResourceSearchVo searchVo, Long jobId); + + String buildGetInspectResourceListByIdListAndJobIdSql(List IdList, Long jobId); + + String buildGetInspectResourceListByIdListAndJobIdSql(List IdList, Long jobId, List selectFieldNameList); + + // InspectConfigFileMapper + String buildGetInspectConfigFileResourceIdListSql(ResourceSearchVo searchVo); + + String buildGetInspectConfigFilePathCountSql(ResourceSearchVo searchVo); + + String buildGetInspectConfigFilePathIdListSql(ResourceSearchVo searchVo); + + String buildGetInspectConfigFilePathListSql(List idList); + + String buildGetInspectConfigFilePathListByJobIdSql(Long jobId); +} diff --git a/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCenterResourceCrossoverService.java b/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCenterResourceCrossoverService.java index e360558ca221a7f94d6f3f0f549abb845fc98aa8..65881124b4c1ee80d816380ee9a7fe3443cad676 100644 --- a/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCenterResourceCrossoverService.java +++ b/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCenterResourceCrossoverService.java @@ -67,34 +67,5 @@ public interface IResourceCenterResourceCrossoverService extends ICrossoverServi */ Map> getResourceTagByResourceIdList(List idList); - /** - * 生成SQL等效于{@link neatlogic.module.cmdb.dao.mapper.resourcecenter.ResourceMapper#getResourceIdList(neatlogic.framework.cmdb.dto.resourcecenter.ResourceSearchVo)} - * @param searchVo - * @return - */ - String buildGetResourceIdListSql(ResourceSearchVo searchVo); - - /** - * 生成SQL等效于{@link neatlogic.module.cmdb.dao.mapper.resourcecenter.ResourceMapper#getResourceCount(neatlogic.framework.cmdb.dto.resourcecenter.ResourceSearchVo)} - * @param searchVo - * @return - */ - String buildGetResourceCountSql(ResourceSearchVo searchVo); - - /** - * 生成SQL等效于{@link neatlogic.module.cmdb.dao.mapper.resourcecenter.ResourceMapper#getResourceListByIdList(java.util.List)} - * @param idList - * @param selectFieldNameList - * @return - */ - String buildGetResourceListSql(List idList, List selectFieldNameList); - - /** - * 生成SQL等效于{@link neatlogic.module.cmdb.dao.mapper.resourcecenter.ResourceMapper#getResourceListByIdList(java.util.List)} - * @param idList - * @return - */ - String buildGetResourceListSql(List idList); - } diff --git a/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCrossoverMapper.java b/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCrossoverMapper.java index 5b8e9138ff8a263b4d8be98835f5ee8a7668c678..6209d80395a6ffa2c92d0377dd12f082784ce492 100644 --- a/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCrossoverMapper.java +++ b/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCrossoverMapper.java @@ -27,26 +27,26 @@ import neatlogic.framework.crossover.ICrossoverService; import org.apache.ibatis.annotations.Param; import java.util.List; -import java.util.Set; public interface IResourceCrossoverMapper extends ICrossoverService { + + int getCountBySql(String sql); + + List getIdListBySql(String sql); + + List getResourceListBySql(String sql); + @Deprecated int getResourceCount(ResourceSearchVo searchVo); - int getResourceCountBySql(String sql); - int getResourceCountByDynamicCondition(@Param("searchVo") ResourceSearchVo searchVo, @Param("conditionSql") String conditionSql); @Deprecated List getResourceIdList(ResourceSearchVo searchVo); - List getResourceIdListBySql(String sql); - List getResourceIdListByDynamicCondition(@Param("searchVo") ResourceSearchVo searchVo, @Param("conditionSql") String conditionSql); @Deprecated List getResourceListByIdList(List idList); - List getResourceListBySql(String sql); - List getAppInstanceResourceListByIdListSimple(List idList); Long getResourceIdByIpAndPortAndName(ResourceSearchVo searchVo); @@ -71,9 +71,10 @@ 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); +// Set getResourceTypeIdListByAppSystemIdAndModuleIdAndEnvIdAndInspectStatusList(ResourceSearchVo searchVo); List getResourceIdListByAppSystemIdAndModuleIdAndEnvId(ResourceVo resourceVo); /** diff --git a/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/ResourceSearchVo.java b/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/ResourceSearchVo.java index 14db2233e066e7587d86052418b2f438b39e3184..9f19e5e8577c7ff96691bc2d32d0ed6a801d574c 100644 --- a/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/ResourceSearchVo.java +++ b/src/main/java/neatlogic/framework/cmdb/dto/resourcecenter/ResourceSearchVo.java @@ -111,7 +111,8 @@ public class ResourceSearchVo extends ConditionConfigVo { private String viewName; @EntityField(name = "输入节点列表", type = ApiParamType.JSONARRAY) private List inputNodeList; - + @EntityField(name = "时间范围", type = ApiParamType.JSONARRAY) + private List timeRange; public ResourceSearchVo() { } @@ -462,4 +463,12 @@ public class ResourceSearchVo extends ConditionConfigVo { public void setInputNodeList(List inputNodeList) { this.inputNodeList = inputNodeList; } + + public List getTimeRange() { + return timeRange; + } + + public void setTimeRange(List timeRange) { + this.timeRange = timeRange; + } } 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 2412d89ce711a8be85a588061d8587a29d6e891a..b2d216c3e7fb960ee45cdd44dc195b25f64b4a4b 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 @@ -26,6 +26,7 @@ import neatlogic.framework.restful.annotation.EntityField; import java.util.List; public class ResourceQueryCriteriaVo { + private String keyword; private List keywordList; @EntityField(name = "协议id列表", type = ApiParamType.JSONARRAY) private List protocolIdList; @@ -69,11 +70,17 @@ public class ResourceQueryCriteriaVo { private Long ipFieldAttrId; @EntityField(name = "name字段映射的属性ID", type = ApiParamType.LONG) private Long nameFieldAttrId; - + @EntityField(name = "以IP字段排序", type = ApiParamType.INTEGER) + private Integer isIpFieldSort; + @EntityField(name = "以name字段排序", type = ApiParamType.INTEGER) + private Integer isNameFieldSort; + @EntityField(name = "作业ID", type = ApiParamType.LONG) + private Long jobId; public ResourceQueryCriteriaVo() { } public ResourceQueryCriteriaVo(ResourceSearchVo searchVo) { + this.keyword = searchVo.getKeyword(); this.keywordList = searchVo.getKeywordList(); this.protocolIdList = searchVo.getProtocolIdList(); this.tagIdList = searchVo.getTagIdList(); @@ -96,6 +103,16 @@ public class ResourceQueryCriteriaVo { this.authenticationInfo = searchVo.getAuthenticationInfo(); this.ipFieldAttrId = searchVo.getIpFieldAttrId(); this.nameFieldAttrId = searchVo.getNameFieldAttrId(); + this.isIpFieldSort = searchVo.getIsIpFieldSort(); + this.isNameFieldSort = searchVo.getIsNameFieldSort(); + } + + public String getKeyword() { + return keyword; + } + + public void setKeyword(String keyword) { + this.keyword = keyword; } public List getKeywordList() { @@ -273,4 +290,28 @@ public class ResourceQueryCriteriaVo { public void setNameFieldAttrId(Long nameFieldAttrId) { this.nameFieldAttrId = nameFieldAttrId; } + + public Integer getIsIpFieldSort() { + return isIpFieldSort; + } + + public void setIsIpFieldSort(Integer isIpFieldSort) { + this.isIpFieldSort = isIpFieldSort; + } + + public Integer getIsNameFieldSort() { + return isNameFieldSort; + } + + public void setIsNameFieldSort(Integer isNameFieldSort) { + this.isNameFieldSort = isNameFieldSort; + } + + public Long getJobId() { + return jobId; + } + + public void setJobId(Long jobId) { + this.jobId = jobId; + } }