diff --git a/bocloud.ams.booter/src/main/java/com/bocloud/ams/booter/controller/module/RelationCategoryController.java b/bocloud.ams.booter/src/main/java/com/bocloud/ams/booter/controller/module/RelationCategoryController.java index e09820e..ab0647a 100644 --- a/bocloud.ams.booter/src/main/java/com/bocloud/ams/booter/controller/module/RelationCategoryController.java +++ b/bocloud.ams.booter/src/main/java/com/bocloud/ams/booter/controller/module/RelationCategoryController.java @@ -1,11 +1,18 @@ package com.bocloud.ams.booter.controller.module; -import java.util.List; - +import com.bocloud.ams.entity.module.ModuleRelation; +import com.bocloud.ams.entity.module.RelationCategory; +import com.bocloud.ams.service.module.RelationCategoryService; +import com.megatron.common.model.GeneralResult; +import com.megatron.common.model.GridBean; +import com.megatron.common.model.Pager; +import com.megatron.common.model.RequestContext; +import com.megatron.common.utils.Common; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -16,17 +23,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import com.bocloud.ams.entity.module.ModuleRelation; -import com.bocloud.ams.entity.module.RelationCategory; -import com.bocloud.ams.service.module.RelationCategoryService; -import com.megatron.common.model.GeneralResult; -import com.megatron.common.model.GridBean; -import com.megatron.common.model.Pager; -import com.megatron.common.model.RequestContext; -import com.megatron.common.utils.Common; - -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; +import java.util.List; @Tag(name = "关联类型分组管理") @RestController @@ -44,14 +41,16 @@ public class RelationCategoryController { */ @GetMapping @Operation(tags = {"CMC", "CSC"}, summary ="关联类型分组列表") - public GeneralResult> list(Pager pager) { - return relationCategoryService.list(pager); + public GeneralResult> list(Pager pager, + @RequestParam(value = "positionKey", required = false) String positionKey) { + return relationCategoryService.list(pager, positionKey); } @GetMapping("/all") @Operation(tags = {"CMC", "CSC"}, summary ="关联类型分组列表(所有)") - public GeneralResult> listAll(Pager pager) { - return relationCategoryService.listAll(pager.getParams(), pager.getSorter()); + public GeneralResult> listAll(Pager pager, + @RequestParam(value = "positionKey", required = false) String positionKey) { + return relationCategoryService.listAll(pager.getParams(), pager.getSorter(), positionKey); } /** @@ -125,8 +124,9 @@ public class RelationCategoryController { @GetMapping(value = "/{id}/module/relations") @Operation(tags = {"CMC"}, summary ="关联类型分组模型关系查询") public GeneralResult> moduleRelationList(@PathVariable(value = Common.ID) Long id, - @RequestParam(value = "moduleId") Long moduleId) { - return relationCategoryService.moduleRelationList(id, moduleId); + @RequestParam(value = "moduleId") Long moduleId, + @RequestParam(value = "positionKey", required = false) String positionKey) { + return relationCategoryService.moduleRelationList(id, moduleId, positionKey); } } diff --git a/bocloud.ams.booter/src/main/java/com/bocloud/ams/booter/controller/module/RelationController.java b/bocloud.ams.booter/src/main/java/com/bocloud/ams/booter/controller/module/RelationController.java index fc53460..3e01ce8 100644 --- a/bocloud.ams.booter/src/main/java/com/bocloud/ams/booter/controller/module/RelationController.java +++ b/bocloud.ams.booter/src/main/java/com/bocloud/ams/booter/controller/module/RelationController.java @@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.bocloud.ams.entity.module.Relation; @@ -40,8 +41,9 @@ public class RelationController { */ @GetMapping @Operation(tags = {"CMC", "CSC"}, summary ="关联类型列表") - public GeneralResult> list(Pager pager, @Value(Common.REQ_CONTEXT) RequestContext context) { - return relationService.list(pager); + public GeneralResult> list(Pager pager, @Value(Common.REQ_CONTEXT) RequestContext context, + @RequestParam(value = "positionKey", required = false) String positionKey) { + return relationService.list(pager, positionKey); } /** diff --git a/bocloud.ams.booter/src/main/java/com/bocloud/ams/booter/controller/module/TopologyConfigController.java b/bocloud.ams.booter/src/main/java/com/bocloud/ams/booter/controller/module/TopologyConfigController.java index 576ca3b..098c8c4 100644 --- a/bocloud.ams.booter/src/main/java/com/bocloud/ams/booter/controller/module/TopologyConfigController.java +++ b/bocloud.ams.booter/src/main/java/com/bocloud/ams/booter/controller/module/TopologyConfigController.java @@ -1,21 +1,5 @@ package com.bocloud.ams.booter.controller.module; -import java.util.List; -import java.util.Map; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - import com.bocloud.ams.entity.model.ColumnAndSearchItemModel; import com.bocloud.ams.entity.model.InstanceTopo; import com.bocloud.ams.entity.model.PathModel; @@ -27,10 +11,23 @@ import com.megatron.common.model.GridBean; import com.megatron.common.model.Pager; import com.megatron.common.model.RequestContext; import com.megatron.common.utils.Common; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Map; @Tag(name = "实例拓扑管理") @RestController @@ -50,8 +47,9 @@ public class TopologyConfigController { @GetMapping @Operation(tags = {"CMC", "CSC"}, summary ="实例拓扑列表") public GeneralResult> list(Pager pager, - @Value(Common.REQ_CONTEXT) RequestContext context) { - return topologyConfigService.list(pager); + @Value(Common.REQ_CONTEXT) RequestContext context, + @RequestParam(value = "positionKey", required = false) String positionKey) { + return topologyConfigService.list(pager, positionKey); } /** @@ -105,8 +103,9 @@ public class TopologyConfigController { */ @GetMapping(value = "/{id}") @Operation(summary = "实例拓扑详情") - public GeneralResult detail(@PathVariable(value = "id") Long id) { - return topologyConfigService.detail(id); + public GeneralResult detail(@PathVariable(value = "id") Long id, + @RequestParam(value = "positionKey", required = false) String positionKey) { + return topologyConfigService.detail(id, positionKey); } /** @@ -119,8 +118,9 @@ public class TopologyConfigController { @GetMapping(value = "/max/level") @Operation(summary = "根据起始模型查询最大拓扑层级") public GeneralResult maxLevel(@RequestParam("categoryId") Long categoryId, - @RequestParam("startModuleId") Long startModuleId) { - return topologyConfigService.maxLevel(categoryId, startModuleId); + @RequestParam("startModuleId") Long startModuleId, + @RequestParam(value = "positionKey", required = false) String positionKey) { + return topologyConfigService.maxLevel(categoryId, startModuleId, positionKey); } /** @@ -138,9 +138,10 @@ public class TopologyConfigController { public GeneralResult> topologyPath(@RequestParam("categoryId") Long categoryId, @RequestParam("startModuleId") Long startModuleId, @RequestParam("topologyLevel") Integer topologyLevel, @RequestParam(value = "ignoreModuleId", required = false) String ignoreModuleId, - @RequestParam(value = "wayModuleId", required = false) String wayModuleId) { + @RequestParam(value = "wayModuleId", required = false) String wayModuleId, + @RequestParam(value = "positionKey", required = false) String positionKey) { return topologyConfigService.topologyPath(categoryId, startModuleId, topologyLevel, ignoreModuleId, - wayModuleId); + wayModuleId, positionKey); } /** @@ -151,8 +152,9 @@ public class TopologyConfigController { */ @GetMapping(value = "/{id}/dynamic/item") @Operation(summary = "获取查询项以及列表项") - public GeneralResult searchItemList(@PathVariable(value = "id") Long id) { - return topologyConfigService.searchItemList(id); + public GeneralResult searchItemList(@PathVariable(value = "id") Long id, + @RequestParam(value = "positionKey", required = false) String positionKey) { + return topologyConfigService.searchItemList(id, positionKey); } /** @@ -163,8 +165,9 @@ public class TopologyConfigController { */ @GetMapping(value = "/resource") @Operation(summary = "查询资源列表") - public GeneralResult>> resourcelist(Pager pager) { - return topologyConfigService.resourcelist(pager); + public GeneralResult>> resourcelist(Pager pager, + @RequestParam(value = "positionKey", required = false) String positionKey) { + return topologyConfigService.resourcelist(pager, positionKey); } /** @@ -176,8 +179,9 @@ public class TopologyConfigController { @GetMapping(value = "/{id}/startmodule/instance") @Operation(summary = "根据实例拓扑id查询对应起始模型的实例集合") public GeneralResult> - startModuleInstanceList(@PathVariable(value = "id") Long id) { - return topologyConfigService.startModuleInstanceList(id); + startModuleInstanceList(@PathVariable(value = "id") Long id, + @RequestParam(value = "positionKey", required = false) String positionKey) { + return topologyConfigService.startModuleInstanceList(id, positionKey); } /** @@ -189,8 +193,9 @@ public class TopologyConfigController { */ @GetMapping("/{id}/export") @Operation(summary = "实例拓扑资源列表导出") - public GeneralResult download(@PathVariable Long id, HttpServletResponse response) { - return topologyConfigService.download(id, response); + public GeneralResult download(@PathVariable Long id, HttpServletResponse response, + @RequestParam(value = "positionKey", required = false) String positionKey) { + return topologyConfigService.download(id, response, positionKey); } /** @@ -203,8 +208,9 @@ public class TopologyConfigController { @GetMapping(value = "/topo") @Operation(summary = "全局拓扑") public GeneralResult topoList(@RequestParam(value = "id") Long id, - @RequestParam(value = "instanceId") Long instanceId) { - return topologyConfigService.topoList(id, instanceId); + @RequestParam(value = "instanceId") Long instanceId, + @RequestParam(value = "positionKey", required = false) String positionKey) { + return topologyConfigService.topoList(id, instanceId, positionKey); } /** @@ -217,8 +223,9 @@ public class TopologyConfigController { @GetMapping(value = "/topo/instances/{instanceId}") @Operation(summary = "实例资源拓扑") public GeneralResult topology(@RequestParam(value = "id") Long id, - @PathVariable Long instanceId) { - return topologyConfigService.topology(id, instanceId); + @PathVariable Long instanceId, + @RequestParam(value = "positionKey", required = false) String positionKey) { + return topologyConfigService.topology(id, instanceId, positionKey); } /** @@ -231,7 +238,8 @@ public class TopologyConfigController { @GetMapping(value = "/next/topo") @Operation(summary = "根据实例id查找下一层级实例拓扑") public GeneralResult nextTopoList(@RequestParam(value = "id") Long id, - @RequestParam(value = "moduleId") Long moduleId, @RequestParam(value = "instanceId") Long instanceId) { - return topologyConfigService.nextTopoList(id, moduleId, instanceId); + @RequestParam(value = "moduleId") Long moduleId, @RequestParam(value = "instanceId") Long instanceId, + @RequestParam(value = "positionKey", required = false) String positionKey) { + return topologyConfigService.nextTopoList(id, moduleId, instanceId, positionKey); } } diff --git a/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/instance/InstanceRelationRepository.java b/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/instance/InstanceRelationRepository.java index cde89ac..cc6f863 100644 --- a/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/instance/InstanceRelationRepository.java +++ b/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/instance/InstanceRelationRepository.java @@ -280,6 +280,19 @@ public class InstanceRelationRepository extends BasicGenericDao listReverse(final String instanceRelationTableName, Long categoryId, List sourceInstanceIds, List targetInstanceIds, String positionKey) throws Exception { + String sql; + if (StringUtils.isNotBlank(positionKey)) { + sql = " select a.*, b.relationName relation_name , '1' is_reversed from " + positionKey + "." + instanceRelationTableName + " a join ( select cmr.* , cr.reverse_name as relationName from "+positionKey+".ci_module_relation cmr join "+positionKey+".ci_relation cr on cmr.relation_id = cr.id where cmr.relation_category_id = :categoryId and cr.category_id = :categoryId ) b on a.module_relation_id=b.id where a.is_deleted = 0 and b.is_deleted=0 and a.relation_category_id = :categoryId " + " and ( a.source_instance_id in ( :sourceInstanceIds ) or a.target_instance_id in ( :targetInstanceIds ) ) "; + } else { + sql = " select a.*, b.relationName relation_name , '1' is_reversed from " + instanceRelationTableName + " a join ( select cmr.* , cr.reverse_name as relationName from ci_module_relation cmr join ci_relation cr on cmr.relation_id = cr.id where cmr.relation_category_id = :categoryId and cr.category_id = :categoryId ) b on a.module_relation_id=b.id where a.is_deleted = 0 and b.is_deleted=0 and a.relation_category_id = :categoryId " + " and ( a.source_instance_id in ( :sourceInstanceIds ) or a.target_instance_id in ( :targetInstanceIds ) ) "; + } + Map params = MapTools.simpleMap("categoryId", categoryId); + params.put("sourceInstanceIds", sourceInstanceIds); + params.put("targetInstanceIds", targetInstanceIds); + return this.list(InstanceRelation.class, sql, params); + } + public List listForward(final String instanceRelationTableName, Long categoryId, List sourceInstanceIds, List targetInstanceIds) throws Exception { String sql = "select a.*,b.relationName relation_name from " + instanceRelationTableName + " a join ( select cmr.* , cr.name as relationName from ci_module_relation cmr join ci_relation cr on cmr.relation_id = cr.id where cmr.relation_category_id = :categoryId and cr.category_id = :categoryId ) b on a.module_relation_id=b.id where a.is_deleted = 0 and b.is_deleted=0 and a.relation_category_id = :categoryId" + " and ( a.source_instance_id in ( :sourceInstanceIds ) or a.target_instance_id in ( :targetInstanceIds ) ) "; Map params = MapTools.simpleMap("categoryId", categoryId); @@ -288,6 +301,19 @@ public class InstanceRelationRepository extends BasicGenericDao listForward(final String instanceRelationTableName, Long categoryId, List sourceInstanceIds, List targetInstanceIds, String positionKey) throws Exception { + String sql; + if (StringUtils.isNotBlank(positionKey)) { + sql = "select a.*,b.relationName relation_name from " + positionKey + "." + instanceRelationTableName + " a join ( select cmr.* , cr.name as relationName from "+positionKey+".ci_module_relation cmr join "+positionKey+".ci_relation cr on cmr.relation_id = cr.id where cmr.relation_category_id = :categoryId and cr.category_id = :categoryId ) b on a.module_relation_id=b.id where a.is_deleted = 0 and b.is_deleted=0 and a.relation_category_id = :categoryId" + " and ( a.source_instance_id in ( :sourceInstanceIds ) or a.target_instance_id in ( :targetInstanceIds ) ) "; + } else { + sql = "select a.*,b.relationName relation_name from " + instanceRelationTableName + " a join ( select cmr.* , cr.name as relationName from ci_module_relation cmr join ci_relation cr on cmr.relation_id = cr.id where cmr.relation_category_id = :categoryId and cr.category_id = :categoryId ) b on a.module_relation_id=b.id where a.is_deleted = 0 and b.is_deleted=0 and a.relation_category_id = :categoryId" + " and ( a.source_instance_id in ( :sourceInstanceIds ) or a.target_instance_id in ( :targetInstanceIds ) ) "; + } + Map params = MapTools.simpleMap("categoryId", categoryId); + params.put("sourceInstanceIds", sourceInstanceIds); + params.put("targetInstanceIds", targetInstanceIds); + return this.list(InstanceRelation.class, sql, params); + } + public List listReverseByInstanceIds(final String instanceRelationTableName, Long categoryId, Long moduleId, Long instanceId) throws Exception { String sql = " select a.*,b.reverse_name relation_name , '1' is_reversed from " + instanceRelationTableName + " a join ( select cmr.* , cr.reverse_name from ci_module_relation cmr join ci_relation cr on cmr.relation_id = cr.id where cmr.relation_category_id = :categoryId and cr.category_id = :categoryId ) b on a.module_relation_id=b.id where a.is_deleted = 0 and b.is_deleted=0 and a.target_module_id = :moduleId " + " and a.target_instance_id = :instanceId "; Map params = MapTools.simpleMap("moduleId", moduleId); @@ -296,6 +322,19 @@ public class InstanceRelationRepository extends BasicGenericDao listReverseByInstanceIds(final String instanceRelationTableName, Long categoryId, Long moduleId, Long instanceId, String positionKey) throws Exception { + String sql; + if (StringUtils.isNotBlank(positionKey)) { + sql = " select a.*,b.reverse_name relation_name , '1' is_reversed from " + positionKey + "." + instanceRelationTableName + " a join ( select cmr.* , cr.reverse_name from "+positionKey+".ci_module_relation cmr join "+positionKey+".ci_relation cr on cmr.relation_id = cr.id where cmr.relation_category_id = :categoryId and cr.category_id = :categoryId ) b on a.module_relation_id=b.id where a.is_deleted = 0 and b.is_deleted=0 and a.target_module_id = :moduleId " + " and a.target_instance_id = :instanceId "; + } else { + sql = " select a.*,b.reverse_name relation_name , '1' is_reversed from " + instanceRelationTableName + " a join ( select cmr.* , cr.reverse_name from ci_module_relation cmr join ci_relation cr on cmr.relation_id = cr.id where cmr.relation_category_id = :categoryId and cr.category_id = :categoryId ) b on a.module_relation_id=b.id where a.is_deleted = 0 and b.is_deleted=0 and a.target_module_id = :moduleId " + " and a.target_instance_id = :instanceId "; + } + Map params = MapTools.simpleMap("moduleId", moduleId); + params.put("instanceId", instanceId); + params.put("categoryId", categoryId); + return this.list(InstanceRelation.class, sql, params); + } + public List listForwardByInstanceIds(final String instanceRelationTableName, Long categoryId, Long moduleId, Long instanceId) throws Exception { String sql = "select a.*,b.name relation_name from " + instanceRelationTableName + " a join ( select cmr.* , cr.reverse_name from ci_module_relation cmr join ci_relation cr on cmr.relation_id = cr.id where cmr.relation_category_id = :categoryId and cr.category_id = :categoryId ) b on a.module_relation_id=b.id where a.is_deleted = 0 and b.is_deleted=0 and a.source_module_id = :moduleId " + " and a.source_instance_id = :instanceId "; Map params = MapTools.simpleMap("moduleId", moduleId); @@ -304,6 +343,19 @@ public class InstanceRelationRepository extends BasicGenericDao listForwardByInstanceIds(final String instanceRelationTableName, Long categoryId, Long moduleId, Long instanceId, String positionKey) throws Exception { + String sql; + if (StringUtils.isNotBlank(positionKey)) { + sql = "select a.*,b.name relation_name from " + positionKey + "." + instanceRelationTableName + " a join ( select cmr.* , cr.reverse_name from "+positionKey+".ci_module_relation cmr join "+positionKey+".ci_relation cr on cmr.relation_id = cr.id where cmr.relation_category_id = :categoryId and cr.category_id = :categoryId ) b on a.module_relation_id=b.id where a.is_deleted = 0 and b.is_deleted=0 and a.source_module_id = :moduleId " + " and a.source_instance_id = :instanceId "; + } else { + sql = "select a.*,b.name relation_name from " + instanceRelationTableName + " a join ( select cmr.* , cr.reverse_name from ci_module_relation cmr join ci_relation cr on cmr.relation_id = cr.id where cmr.relation_category_id = :categoryId and cr.category_id = :categoryId ) b on a.module_relation_id=b.id where a.is_deleted = 0 and b.is_deleted=0 and a.source_module_id = :moduleId " + " and a.source_instance_id = :instanceId "; + } + Map params = MapTools.simpleMap("moduleId", moduleId); + params.put("instanceId", instanceId); + params.put("categoryId", categoryId); + return this.list(InstanceRelation.class, sql, params); + } + public List queryByInstanceIds(String instanceRelationTable, Long sourceModuleId, List sourceInstanceIds, Long targetModuleId, List targetInstanceIds) throws Exception { String sql = "select a.* from " + instanceRelationTable + " a where is_deleted=0 " + " and source_module_id = :sourceModuleId "; sql += " and target_module_id = :targetModuleId "; diff --git a/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/instance/InstanceValueRepository.java b/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/instance/InstanceValueRepository.java index b67c4e5..e2483bc 100644 --- a/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/instance/InstanceValueRepository.java +++ b/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/instance/InstanceValueRepository.java @@ -162,6 +162,16 @@ public class InstanceValueRepository extends BasicGenericDao queryByInstanceIdsAndPropertyIds(String instanceValueTable, List instanceIds, List propertyIds, String positionKey) throws Exception { + if (StringUtils.isNotEmpty(positionKey)) { + instanceValueTable = positionKey + "." + instanceValueTable; + } + final String sql = "select a.* from " + instanceValueTable + " a where a.instance_id in ( :instanceIds ) and a.property_id in ( :propertyIds ) and a.is_deleted = 0 "; + final Map params = MapTools.simpleMap("instanceIds", instanceIds); + params.put("propertyIds", propertyIds); + return this.list(InstanceValue.class, sql, params); + } + public List listByPropertyCode(String instanceValueTable, String propertyCode) throws Exception { String sql = "select a.* from " + instanceValueTable + " a where a.property_code = :propertyCode and a.is_deleted=0 "; Map params = MapTools.simpleMap("propertyCode", propertyCode); diff --git a/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/ModuleRelationRepository.java b/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/ModuleRelationRepository.java index b94e9de..0c49c40 100644 --- a/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/ModuleRelationRepository.java +++ b/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/ModuleRelationRepository.java @@ -152,6 +152,16 @@ public class ModuleRelationRepository extends BasicGenericDao queryModuleRealtionAndModuleImage(Long categoryId, String positionKey) throws Exception { + String sql; + if (StringUtils.isNotEmpty(positionKey)) { + sql = "SELECT cm.id as module_id,cm.icon_image, cmr.* FROM "+positionKey+".ci_module_relation cmr ,ci_module cm WHERE (cmr.source_id =cm.id or cmr .target_id =cm.id) and cmr.is_deleted =0 and cmr.relation_category_id = :categoryId "; + } else { + sql = "SELECT cm.id as module_id,cm.icon_image, cmr.* FROM ci_module_relation cmr ,ci_module cm WHERE (cmr.source_id =cm.id or cmr .target_id =cm.id) and cmr.is_deleted =0 and cmr.relation_category_id = :categoryId "; + } + return this.list(ModuleRelation.class, sql, MapTools.simpleMap("categoryId", categoryId)); + } + public List queryModuleList(Long categoryId) throws Exception { String sql = "select a.* from ci_module_relation a where a.is_deleted=0 and a.relation_category_id = :categoryId"; return this.list(ModuleRelation.class, sql, MapTools.simpleMap("categoryId", categoryId)); @@ -179,6 +189,18 @@ public class ModuleRelationRepository extends BasicGenericDao query(Long relationCategoryId, Long moduleId, String positionKey) throws Exception { + String sql; + if (StringUtils.isNotEmpty(positionKey)) { + sql = "select a.* ,r.name relation_name,r.reverse_name relation_reverse_name from " + positionKey + ".ci_module_relation a left join " + positionKey + ".ci_relation r on a.relation_id =r.id where a.is_deleted=0 and a.relation_category_id = :relationCategoryId and (a.source_id = :moduleId OR a.target_id = :moduleId) "; + } else { + sql = "select a.* ,r.name relation_name,r.reverse_name relation_reverse_name from ci_module_relation a left join ci_relation r on a.relation_id =r.id where a.is_deleted=0 and a.relation_category_id = :relationCategoryId and (a.source_id = :moduleId OR a.target_id = :moduleId) "; + } + Map params = MapTools.simpleMap("relationCategoryId", relationCategoryId); + params.put("moduleId", moduleId); + return this.list(ModuleRelation.class, sql, params); + } + public boolean deleteByModuleId(Long moduleId, Long userId) throws Exception { String sql = " update ci_module_relation set is_deleted = 1 , gmt_modify = :gmtModify , mender_id = :userId where source_id = :moduleId or target_id = :moduleId "; Map params = MapTools.simpleMap("moduleId", moduleId); diff --git a/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/PropertyRepository.java b/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/PropertyRepository.java index e837907..33dd16e 100644 --- a/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/PropertyRepository.java +++ b/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/PropertyRepository.java @@ -136,6 +136,17 @@ public class PropertyRepository extends BasicGenericDao { return this.list(Property.class, sql, MapTools.simpleMap("moduleId", moduleId)); } + public List listIsTitleByModuleId(Long moduleId, String positionKey) { + String sql; + if (StringUtils.isNotEmpty(positionKey)) { + sql = "select a.* from "+positionKey+".ci_property a where a.is_deleted = 0 and a.module_id = :moduleId and is_title = 1 order by a.order_num"; + } else { + sql = "select a.* from ci_property a where a.is_deleted = 0 and a.module_id = :moduleId and is_title = 1 order by a.order_num"; + } + // 模型界面显示未隐藏字段 + return this.list(Property.class, sql, MapTools.simpleMap("moduleId", moduleId)); + } + public List appointPropertylist(List ids) { // 模型界面显示未隐藏字段 String sql = "select a.* from ci_property a where a.is_deleted = 0 and a.id in (:ids) order by a.order_num"; diff --git a/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/RelationCategoryRepository.java b/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/RelationCategoryRepository.java index cb62179..a4e950c 100644 --- a/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/RelationCategoryRepository.java +++ b/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/RelationCategoryRepository.java @@ -41,6 +41,17 @@ public class RelationCategoryRepository extends BasicGenericDao list(List params, Map sorter, String positionKey) throws Exception { + String sql; + if (StringUtils.isNotBlank(positionKey)) { + sql = "select a.* from " + positionKey + ".ci_relation_category a where is_deleted=0 "; + } else { + sql = "select a.* from ci_relation_category a where is_deleted=0 "; + } + sql = getQueryBuilder().buildRaw(sql, new Pager(1, Integer.MAX_VALUE, params, sorter), "a"); + return this.list(RelationCategory.class, sql, getQueryBuilder().getParam(params)); + } + public RelationCategory queryByCode(String code) throws Exception { String sql = "select a.* from ci_relation_category a where a.code = :code and is_deleted=0 "; List list = this.list(RelationCategory.class, sql, MapTools.simpleMap("code", code)); @@ -70,12 +81,34 @@ public class RelationCategoryRepository extends BasicGenericDao list(Pager pager, String positionKey) throws Exception { + String sql; + if (StringUtils.isNotEmpty(positionKey)) { + sql = "select a.* from " + positionKey + ".ci_relation_category a where a.is_deleted=0 "; + } else { + sql = "select a.* from ci_relation_category a where a.is_deleted=0 "; + } + sql = getQueryBuilder().buildRaw(sql, pager, "a"); + return this.list(RelationCategory.class, sql, getQueryBuilder().getParam(pager.getParams())); + } + public int count(List params) throws Exception { String sql = "select count(1) from ci_relation_category a where a.is_deleted=0 "; sql = getQueryBuilder().buildRaw(sql, params, null, "a"); return this.countQuery(sql, getQueryBuilder().getParam(params)).intValue(); } + public int count(List params, String positionKey) throws Exception { + String sql; + if (StringUtils.isNotEmpty(positionKey)) { + sql = "select count(1) from " + positionKey + ".ci_relation_category a where a.is_deleted=0 "; + } else { + sql = "select count(1) from ci_relation_category a where a.is_deleted=0 "; + } + sql = getQueryBuilder().buildRaw(sql, params, null, "a"); + return this.countQuery(sql, getQueryBuilder().getParam(params)).intValue(); + } + public List listByModuleId(Long moduleId) throws Exception { String sql = "select a.* from ci_relation_category a where is_deleted = 0 and a.id in (select distinct relation_category_id from ci_module_relation where is_deleted=0 and (source_id = :moduleId OR target_id = :moduleId)) order by a.gmt_modify desc"; return this.list(RelationCategory.class, sql, MapTools.simpleMap("moduleId", moduleId)); diff --git a/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/RelationRepository.java b/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/RelationRepository.java index 4e9deac..a761f43 100644 --- a/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/RelationRepository.java +++ b/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/RelationRepository.java @@ -8,6 +8,7 @@ import com.megatron.common.utils.Common; import com.megatron.common.utils.MapTools; import com.megatron.database.core.intf.impl.BasicGenericDao; import com.megatron.framework.core.CurrentService; +import org.apache.commons.lang3.StringUtils; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.stereotype.Repository; @@ -43,12 +44,34 @@ public class RelationRepository extends BasicGenericDao { return this.list(Relation.class, sql, getQueryBuilder().getParam(pager.getParams())); } + public List list(Pager pager, String positionKey) throws Exception { + String sql; + if (StringUtils.isNotBlank(positionKey)) { + sql = "select a.*,b.name category_name from "+positionKey+".ci_relation a,ci_relation_category b where a.category_id =b.id and a.is_deleted=0 and b.is_deleted=0 "; + } else { + sql = "select a.*,b.name category_name from ci_relation a,ci_relation_category b where a.category_id =b.id and a.is_deleted=0 and b.is_deleted=0 "; + } + sql = getQueryBuilder().buildRaw(sql, pager, "a"); + return this.list(Relation.class, sql, getQueryBuilder().getParam(pager.getParams())); + } + public int count(List params) throws Exception { String sql = "select count(1) from ci_relation a,ci_relation_category b where a.category_id =b.id and a.is_deleted=0 and b.is_deleted=0 "; sql = getQueryBuilder().buildRaw(sql, params, null, "a"); return this.countQuery(sql, getQueryBuilder().getParam(params)).intValue(); } + public int count(List params, String positionKey) throws Exception { + String sql; + if (StringUtils.isNotEmpty(positionKey)) { + sql = "select count(1) from " + positionKey + ".ci_relation a,ci_relation_category b where a.category_id =b.id and a.is_deleted=0 and b.is_deleted=0 "; + } else { + sql = "select count(1) from ci_relation a,ci_relation_category b where a.category_id =b.id and a.is_deleted=0 and b.is_deleted=0 "; + } + sql = getQueryBuilder().buildRaw(sql, params, null, "a"); + return this.countQuery(sql, getQueryBuilder().getParam(params)).intValue(); + } + public List list(List params, Map sorter) throws Exception { String sql = "select a.* from ci_relation a where is_deleted=0"; sql = getQueryBuilder().buildRaw(sql, new Pager(1, Integer.MAX_VALUE, params, sorter), "a"); @@ -60,6 +83,22 @@ public class RelationRepository extends BasicGenericDao { return beans; } + public List list(List params, Map sorter, String positionKey) throws Exception { + String sql; + if (StringUtils.isNotEmpty(positionKey)) { + sql = "select a.* from " + positionKey + ".ci_relation a where is_deleted=0"; + } else { + sql = "select a.* from ci_relation a where is_deleted=0"; + } + sql = getQueryBuilder().buildRaw(sql, new Pager(1, Integer.MAX_VALUE, params, sorter), "a"); + List list = this.list(Relation.class, sql, getQueryBuilder().getParam(params)); + List beans = new ArrayList<>(); + for (Relation relation : list) { + beans.add(new SimpleBean(relation.getId(), relation.getName() + "(反向关系名称:" + relation.getReverseName() + ")")); + } + return beans; + } + public Relation queryByCode(String code, Long categoryId) throws Exception { String sql = "select a.* from ci_relation a where a.code = :code and is_deleted=0 and category_id = :categoryId"; Map params = MapTools.simpleMap("code", code); diff --git a/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/TopologyConfigRepository.java b/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/TopologyConfigRepository.java index e1076c4..6feab6f 100644 --- a/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/TopologyConfigRepository.java +++ b/bocloud.ams.repository/src/main/java/com/bocloud/ams/repository/module/TopologyConfigRepository.java @@ -35,18 +35,51 @@ public class TopologyConfigRepository extends BasicGenericDao params, String positionKey) throws Exception { + String sql; + if (StringUtils.isNotBlank(positionKey)) { + sql = " select count(1) from " + positionKey + ".ci_topology_config a where is_deleted=0 "; + } else { + sql = " select count(1) from ci_topology_config a where is_deleted=0 "; + } + sql = getQueryBuilder().buildRaw(sql, params, null, "a"); + return this.countQuery(sql, getQueryBuilder().getParam(params)).intValue(); + } + public List list(Pager pager) throws Exception { String sql = "select a.* from ci_topology_config a where is_deleted=0 "; sql = getQueryBuilder().buildRaw(sql, pager, "a"); return this.list(TopologyConfig.class, sql, getQueryBuilder().getParam(pager.getParams())); } + public List list(Pager pager, String positionKey) throws Exception { + String sql; + if (StringUtils.isNotBlank(positionKey)) { + sql = "select a.* from " + positionKey + ".ci_topology_config a where is_deleted=0 "; + } else { + sql = "select a.* from ci_topology_config a where is_deleted=0 "; + } + sql = getQueryBuilder().buildRaw(sql, pager, "a"); + return this.list(TopologyConfig.class, sql, getQueryBuilder().getParam(pager.getParams())); + } + public TopologyConfig query(Long id) throws Exception { String sql = "select * from ci_topology_config where is_deleted = 0 and id = :id "; List list = this.list(TopologyConfig.class, sql, MapTools.simpleMap(Common.ID, id)); return list.isEmpty() ? null : list.get(0); } + public TopologyConfig query(Long id, String positionKey) throws Exception { + String sql; + if (StringUtils.isNotBlank(positionKey)) { + sql = "select * from " + positionKey + ".ci_topology_config where is_deleted = 0 and id = :id "; + } else { + sql = "select * from ci_topology_config where is_deleted = 0 and id = :id "; + } + List list = this.list(TopologyConfig.class, sql, MapTools.simpleMap(Common.ID, id)); + return list.isEmpty() ? null : list.get(0); + } + public boolean delete(Long id, Long userId) throws Exception { String sql = " update ci_topology_config set is_deleted = 1 , gmt_modify = :gmtModify , mender_id = :userId where id = :id "; Map params = MapTools.simpleMap(Common.ID, id); diff --git a/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/RelationCategoryService.java b/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/RelationCategoryService.java index 92a0e52..ea1a230 100644 --- a/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/RelationCategoryService.java +++ b/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/RelationCategoryService.java @@ -40,7 +40,7 @@ public interface RelationCategoryService { * @param pager * @return */ - public GeneralResult list(Pager pager); + public GeneralResult list(Pager pager, String positionKey); /** * 列表分页查询 @@ -49,7 +49,7 @@ public interface RelationCategoryService { * @param sorter * @return */ - public GeneralResult listAll(List param, Map sorter); + public GeneralResult listAll(List param, Map sorter, String positionKey); /*** * 根据关系分组及模型获取模型关系 @@ -57,7 +57,7 @@ public interface RelationCategoryService { * @param moduleId * @return */ - GeneralResult> moduleRelationList(Long id, Long moduleId); + GeneralResult> moduleRelationList(Long id, Long moduleId, String positionKey); GeneralResult listByModuleId(Long moduleId, String positionKey); diff --git a/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/RelationService.java b/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/RelationService.java index 4fc07f6..e26ac07 100644 --- a/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/RelationService.java +++ b/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/RelationService.java @@ -36,5 +36,5 @@ public interface RelationService { * @param pager * @return */ - public GeneralResult list(Pager pager); + public GeneralResult list(Pager pager, String positionKey); } diff --git a/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/TopologyConfigService.java b/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/TopologyConfigService.java index 677cb75..d974713 100644 --- a/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/TopologyConfigService.java +++ b/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/TopologyConfigService.java @@ -1,8 +1,5 @@ package com.bocloud.ams.service.module; -import java.util.List; -import java.util.Map; - import com.bocloud.ams.entity.model.ColumnAndSearchItemModel; import com.bocloud.ams.entity.model.InstanceTopo; import com.bocloud.ams.entity.model.PathModel; @@ -11,9 +8,11 @@ import com.bocloud.ams.entity.module.TopologyConfig; import com.megatron.common.model.GeneralResult; import com.megatron.common.model.GridBean; import com.megatron.common.model.Pager; - import jakarta.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + /** * @author 胡立伟 * @program: bocloud.ams @@ -28,7 +27,7 @@ public interface TopologyConfigService { * @param pager * @return */ - GeneralResult> list(Pager pager); + GeneralResult> list(Pager pager, String positionKey); /** * 新增模型 @@ -63,7 +62,7 @@ public interface TopologyConfigService { * @param id * @return */ - GeneralResult detail(Long id); + GeneralResult detail(Long id, String positionKey); /** * 根据起始模型查询最大拓扑层级 @@ -72,7 +71,7 @@ public interface TopologyConfigService { * @param startModuleId * @return */ - GeneralResult maxLevel(Long categoryId, Long startModuleId); + GeneralResult maxLevel(Long categoryId, Long startModuleId, String positionKey); /** * 获取拓扑路径 @@ -85,7 +84,7 @@ public interface TopologyConfigService { * @return */ GeneralResult> topologyPath(Long categoryId, Long startModuleId, Integer topologyLevel, - String ignoreModuleId, String wayModuleId); + String ignoreModuleId, String wayModuleId, String positionKey); /** * 获取查询项以及列表项 @@ -93,7 +92,7 @@ public interface TopologyConfigService { * @param id * @return */ - GeneralResult searchItemList(Long id); + GeneralResult searchItemList(Long id, String positionKey); /** * 查询资源列表 @@ -101,7 +100,7 @@ public interface TopologyConfigService { * @param pager * @return */ - GeneralResult>> resourcelist(Pager pager); + GeneralResult>> resourcelist(Pager pager, String positionKey); /** * 根据实例拓扑id查询对应起始模型的实例集合 @@ -109,7 +108,7 @@ public interface TopologyConfigService { * @param id * @return */ - GeneralResult> startModuleInstanceList(Long id); + GeneralResult> startModuleInstanceList(Long id, String positionKey); /** * R @@ -117,7 +116,7 @@ public interface TopologyConfigService { * * @param response */ - GeneralResult download(Long id, HttpServletResponse response); + GeneralResult download(Long id, HttpServletResponse response, String positionKey); /** * 实例拓扑-全局拓扑 @@ -126,7 +125,7 @@ public interface TopologyConfigService { * @param instanceId * @return */ - GeneralResult topoList(Long id, Long instanceId); + GeneralResult topoList(Long id, Long instanceId, String positionKey); /** * 实例资源拓扑 @@ -135,7 +134,7 @@ public interface TopologyConfigService { * @param instanceId * @return */ - GeneralResult topology(Long id, Long instanceId); + GeneralResult topology(Long id, Long instanceId, String positionKey); /** * 实例拓扑-根据实例id查找下一层级实例拓扑 @@ -144,6 +143,6 @@ public interface TopologyConfigService { * @param instanceId * @return */ - GeneralResult nextTopoList(Long id, Long moduleId, Long instanceId); + GeneralResult nextTopoList(Long id, Long moduleId, Long instanceId, String positionKey); } diff --git a/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/impl/RelationCategoryServiceImpl.java b/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/impl/RelationCategoryServiceImpl.java index 3a6d20e..01d504f 100644 --- a/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/impl/RelationCategoryServiceImpl.java +++ b/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/impl/RelationCategoryServiceImpl.java @@ -170,7 +170,7 @@ public class RelationCategoryServiceImpl implements RelationCategoryService { } @Override - public GeneralResult list(Pager pager) { + public GeneralResult list(Pager pager, String positionKey) { try { GridBean gridBean; pager.setParams(Optional.ofNullable(pager.getParams()).orElse(new ArrayList<>())); @@ -180,12 +180,12 @@ public class RelationCategoryServiceImpl implements RelationCategoryService { if (null == simple) { simple = false; } - int total = relationCategoryRepository.count(pager.getParams()); + int total = relationCategoryRepository.count(pager.getParams(), positionKey); if (simple) { - List beans = relationCategoryRepository.list(pager.getParams(), pager.getSorter()); + List beans = relationCategoryRepository.list(pager.getParams(), pager.getSorter(), positionKey); gridBean = new GridBean<>(1, 1, total, beans); } else { - List list = this.relationCategoryRepository.list(pager); + List list = this.relationCategoryRepository.list(pager, positionKey); gridBean = new GridBean<>(pager.getPage(), pager.getRows(), total, list); } return new GeneralResult<>(true, gridBean, "查询成功"); @@ -196,12 +196,12 @@ public class RelationCategoryServiceImpl implements RelationCategoryService { } @Override - public GeneralResult listAll(List params, Map sorter) { + public GeneralResult listAll(List params, Map sorter, String positionKey) { try { params = Optional.ofNullable(params).orElse(new ArrayList<>()); sorter = Optional.ofNullable(sorter).orElse(new HashMap<>()); sorter.put(Common.ID, Common.ONE); - List beans = relationCategoryRepository.list(params, sorter); + List beans = relationCategoryRepository.list(params, sorter, positionKey); return new GeneralResult<>(true, beans, "查询成功"); } catch (Exception e) { log.error("CmdbRelationCategory list query fail:", e); @@ -210,13 +210,13 @@ public class RelationCategoryServiceImpl implements RelationCategoryService { } @Override - public GeneralResult> moduleRelationList(Long id, Long moduleId) { + public GeneralResult> moduleRelationList(Long id, Long moduleId, String positionKey) { try { - CiModule module = moduleRepository.query(moduleId); + CiModule module = moduleRepository.query(moduleId, positionKey); if (null == module) { return GeneralResult.FAILED("模型数据不存在"); } - RelationCategory category = relationCategoryRepository.query(id); + RelationCategory category = relationCategoryRepository.query(id, positionKey); if (null == category) { return GeneralResult.FAILED("关联类型分组数据不存在"); } diff --git a/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/impl/RelationServiceImpl.java b/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/impl/RelationServiceImpl.java index 1cc9f60..f2dbe44 100644 --- a/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/impl/RelationServiceImpl.java +++ b/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/impl/RelationServiceImpl.java @@ -1,18 +1,5 @@ package com.bocloud.ams.service.module.impl; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Optional; -import java.util.concurrent.TimeUnit; - -import org.apache.commons.beanutils.locale.LocaleBeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.Assert; -import org.springframework.util.CollectionUtils; - import com.bocloud.ams.entity.module.ModuleRelation; import com.bocloud.ams.entity.module.Relation; import com.bocloud.ams.entity.module.RelationCategory; @@ -27,8 +14,19 @@ import com.megatron.common.model.SimpleBean; import com.megatron.common.utils.Common; import com.megatron.framework.lock.AutoCloseLock; import com.megatron.framework.lock.LockFactory; - import lombok.extern.slf4j.Slf4j; +import org.apache.commons.beanutils.locale.LocaleBeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.TimeUnit; /** * @Description: 关联类型管理 @@ -120,19 +118,19 @@ public class RelationServiceImpl implements RelationService { } @Override - public GeneralResult list(Pager pager) { + public GeneralResult list(Pager pager, String positionKey) { try { GridBean gridBean; pager.setParams(Optional.ofNullable(pager.getParams()).orElse(new ArrayList<>())); pager.setSorter(Optional.ofNullable(pager.getSorter()).orElse(new HashMap<>())); pager.getSorter().put(Common.ID, Common.ONE); Boolean simple = null == pager.getSimple() ? false : pager.getSimple(); - int total = relationRepository.count(pager.getParams()); + int total = relationRepository.count(pager.getParams(), positionKey); if (simple) { - List beans = relationRepository.list(pager.getParams(), pager.getSorter()); + List beans = relationRepository.list(pager.getParams(), pager.getSorter(), positionKey); gridBean = new GridBean<>(1, 1, total, beans); } else { - List list = this.relationRepository.list(pager); + List list = this.relationRepository.list(pager, positionKey); gridBean = new GridBean<>(pager.getPage(), pager.getRows(), total, list); } return new GeneralResult<>(true, gridBean, "查询成功"); diff --git a/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/impl/TopologyConfigServiceImpl.java b/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/impl/TopologyConfigServiceImpl.java index 3cbfbae..68b7fad 100644 --- a/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/impl/TopologyConfigServiceImpl.java +++ b/bocloud.ams.service/src/main/java/com/bocloud/ams/service/module/impl/TopologyConfigServiceImpl.java @@ -109,19 +109,19 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { private InstanceRepository instanceRepository; @Override - public GeneralResult> list(Pager pager) { + public GeneralResult> list(Pager pager, String positionKey) { try { pager.setParams(Optional.ofNullable(pager.getParams()).orElse(new ArrayList<>())); pager.setSorter(Optional.ofNullable(pager.getSorter()).orElse(new HashMap<>())); pager.getSorter().put(Common.ID, Common.ONE); - int total = topologyConfigRepository.count(pager.getParams()); - List list = this.topologyConfigRepository.list(pager); + int total = topologyConfigRepository.count(pager.getParams(), positionKey); + List list = this.topologyConfigRepository.list(pager, positionKey); for (TopologyConfig config : list) { - RelationCategory relationCategory = relationCategoryRepository.query(config.getCategoryId()); + RelationCategory relationCategory = relationCategoryRepository.query(config.getCategoryId(), positionKey); if (null != relationCategory) { config.setCategoryName(relationCategory.getName()); } - CiModule startModule = moduleRepository.query(config.getStartModuleId()); + CiModule startModule = moduleRepository.query(config.getStartModuleId(), positionKey); if (null != startModule) { config.setStartModuleName(startModule.getName()); } @@ -133,7 +133,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { } if (StringUtils.isNotEmpty(config.getTopologyPath())) { List moduleIds = Arrays.stream(config.getTopologyPath().split(",")).map(Long::valueOf).collect(Collectors.toList()); - List modules = moduleRepository.queryModuleListByIds(moduleIds); + List modules = moduleRepository.queryModuleListByIds(moduleIds, positionKey); String topologyPathName = modules.stream().map(CiModule::getName).collect(Collectors.joining("-")); config.setTopologyPathName(topologyPathName); } @@ -221,20 +221,20 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { } @Override - public GeneralResult detail(Long id) { + public GeneralResult detail(Long id, String positionKey) { try { - TopologyConfig config = topologyConfigRepository.query(id); + TopologyConfig config = topologyConfigRepository.query(id, positionKey); if ("PATCH".equalsIgnoreCase(config.getConfigType())) { String message = this.escapeData(config); if (null != message) { return new GeneralResult<>(false, message); } } else { - RelationCategory relationCategory = relationCategoryRepository.query(config.getCategoryId()); + RelationCategory relationCategory = relationCategoryRepository.query(config.getCategoryId(), positionKey); if (null != relationCategory) { config.setCategoryName(relationCategory.getName()); } - CiModule startModule = moduleRepository.query(config.getStartModuleId()); + CiModule startModule = moduleRepository.query(config.getStartModuleId(), positionKey); if (null != startModule) { config.setStartModuleName(startModule.getName()); } @@ -260,13 +260,13 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { * @return */ @Override - public GeneralResult maxLevel(Long categoryId, Long startModuleId) { + public GeneralResult maxLevel(Long categoryId, Long startModuleId, String positionKey) { RequestInstanceTopologyModel topologyModel = new RequestInstanceTopologyModel(); topologyModel.setCategoryId(categoryId); topologyModel.setStartModuleId(startModuleId); try { //获取起始模型为源id,对应的路径集合。 - GeneralResult>>> checkData = this.checkData(topologyModel); + GeneralResult>>> checkData = this.checkData(topologyModel, positionKey); if (checkData.isFailed()) { return new GeneralResult<>(false, checkData.getMessage()); } @@ -303,7 +303,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { * @return */ @Override - public GeneralResult> topologyPath(Long categoryId, Long startModuleId, Integer topologyLevel, String ignoreModuleId, String wayModuleId) { + public GeneralResult> topologyPath(Long categoryId, Long startModuleId, Integer topologyLevel, String ignoreModuleId, String wayModuleId, String positionKey) { try { RequestInstanceTopologyModel topologyModel = new RequestInstanceTopologyModel(); topologyModel.setCategoryId(categoryId); @@ -319,12 +319,12 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { } List pathModels = new ArrayList<>(); //获取起始模型为源id,对应的路径集合 - GeneralResult>>> mapGeneralResult = this.checkData(topologyModel); + GeneralResult>>> mapGeneralResult = this.checkData(topologyModel, positionKey); if (mapGeneralResult.isFailed()) { return new GeneralResult<>(false, mapGeneralResult.getMessage()); } // 转化成返回的数据 - List moduleList = moduleRepository.all(); + List moduleList = moduleRepository.all(positionKey); Map>> data = mapGeneralResult.getData(); for (Boolean aBoolean : data.keySet()) { if (CollectionUtils.isNotEmpty(data.get(aBoolean))) { @@ -349,10 +349,10 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { * @return */ @Override - public GeneralResult searchItemList(Long id) { + public GeneralResult searchItemList(Long id, String positionKey) { try { ColumnAndSearchItemModel itemModel = new ColumnAndSearchItemModel(); - TopologyConfig config = topologyConfigRepository.query(id); + TopologyConfig config = topologyConfigRepository.query(id, positionKey); if (null == config) { return new GeneralResult<>(false, "没有对应的拓扑实例"); } @@ -361,7 +361,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { List moduleIds = Arrays.asList(config.getTopologyPath().split(",")).stream().map(moduleId -> Long.parseLong(moduleId)).collect(Collectors.toList()); List searchConfigs = new ArrayList<>(); // 根据模型id查询模型信息 - List modules = moduleRepository.queryModuleListByIds(moduleIds); + List modules = moduleRepository.queryModuleListByIds(moduleIds, positionKey); if (CollectionUtils.isEmpty(modules)) { return new GeneralResult<>(false, "没有对应的模型数据"); } @@ -401,7 +401,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { columns.add(columnModel); } // 3:处理列表集合 - List properties = propertyRepository.listIsTitleByModuleId(moduleIds.get(moduleIds.size() - 1)); + List properties = propertyRepository.listIsTitleByModuleId(moduleIds.get(moduleIds.size() - 1), positionKey); List finalProperties = properties.stream().filter(item -> !item.getCode().equals("name")).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(finalProperties)) { for (Property property : finalProperties) { @@ -423,7 +423,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { * @return */ @Override - public GeneralResult>> resourcelist(Pager pager) { + public GeneralResult>> resourcelist(Pager pager, String positionKey) { try { GridBean> gridBean = null; // 编辑返回数据格式 @@ -432,7 +432,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { return new GeneralResult<>(false, "id 不能为空"); } String id = pager.getParams().get(0).getParam().get("id").toString(); - TopologyConfig config = topologyConfigRepository.query(Long.valueOf(id)); + TopologyConfig config = topologyConfigRepository.query(Long.valueOf(id), positionKey); if (null == config) { return new GeneralResult<>(false, "没有对应的拓扑实例"); } @@ -470,7 +470,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { // 拓扑路径最后一个模型的实例表是 String lastInstanceTable = CmdbUtils.CMDB_INSTANCE_VALUE + lastModuleCode.toLowerCase(); // 根据lastInstanceIds以及模型属性为列表项的propertyIds 查询 lastInstanceTable表中的数据 - List properties = propertyRepository.listIsTitleByModuleId(moduleIds.get(moduleIds.size() - 1)); + List properties = propertyRepository.listIsTitleByModuleId(moduleIds.get(moduleIds.size() - 1), positionKey); //获取需要转义的属性数据 List propertyList = properties.stream().filter(item -> item.getType().equals(PropertyConstant.PropertyType.SINGLESELECT) || item.getType().equals(PropertyConstant.PropertyType.MULTISELECT) || item.getType().equals(PropertyConstant.PropertyType.RADIO) || item.getType().equals(PropertyConstant.PropertyType.CHECKBOX)).collect(Collectors.toList()); List propertyIds = properties.stream().filter(item -> !item.getCode().equals("name")).map(Property::getId).collect(Collectors.toList()); @@ -503,10 +503,10 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { List list = new ArrayList<>(); List propertyItems = new ArrayList<>(); if (null != property.getPropertyPoolId()) { - List propertyPoolItems = propertyPoolItemRepository.listByPropertyPoolId(property.getPropertyPoolId()); + List propertyPoolItems = propertyPoolItemRepository.listByPropertyPoolId(property.getPropertyPoolId(), positionKey); BeanUtils.copyProperties(propertyPoolItems, propertyItems); } else { - propertyItems = propertyItemRepository.queryByPropertyId(property.getId()); + propertyItems = propertyItemRepository.queryByPropertyId(property.getId(), positionKey); } if (CollectionUtils.isNotEmpty(propertyItems)) { for (String s : listString) { @@ -667,14 +667,14 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { * @return */ @Override - public GeneralResult> startModuleInstanceList(Long id) { + public GeneralResult> startModuleInstanceList(Long id, String positionKey) { try { List topologyModels = new ArrayList<>(); - TopologyConfig config = topologyConfigRepository.query(id); + TopologyConfig config = topologyConfigRepository.query(id, positionKey); if (null == config) { return new GeneralResult<>(false, "没有对应的拓扑实例"); } - CiModule module = moduleRepository.query(config.getStartModuleId()); + CiModule module = moduleRepository.query(config.getStartModuleId(), positionKey); if (null == module) { return new GeneralResult<>(false, "没有对应的起始模型!"); } @@ -715,7 +715,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { * 3. 直接写,这里注意,finish的时候会自动关闭OutputStream,当然你外面再关闭流问题不大 */ @Override - public GeneralResult download(Long id, HttpServletResponse response) { + public GeneralResult download(Long id, HttpServletResponse response, String positionKey) { try { TopologyConfig config = topologyConfigRepository.query(id); if (null == config) { @@ -726,7 +726,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 response.setCharacterEncoding("utf-8"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); - GeneralResult itemResult = this.searchItemList(id); + GeneralResult itemResult = this.searchItemList(id, positionKey); if (itemResult.isFailed()) { return new GeneralResult<>(false, "下载失败"); } @@ -745,7 +745,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { pager.setParams(params); pager.setPage(1); pager.setRows(100000); - GeneralResult>> resourceResult = this.resourcelist(pager); + GeneralResult>> resourceResult = this.resourcelist(pager, positionKey); if (resourceResult.isFailed()) { return new GeneralResult<>(false, "下载失败"); } @@ -768,22 +768,22 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { * @return */ @Override - public GeneralResult topoList(Long id, Long instanceId) { + public GeneralResult topoList(Long id, Long instanceId, String positionKey) { try { InstanceTopo topo = new InstanceTopo(); - TopologyConfig config = topologyConfigRepository.query(id); + TopologyConfig config = topologyConfigRepository.query(id, positionKey); if (null == config) { return new GeneralResult<>(false, "没有对应的拓扑实例"); } - CiModule startModule = moduleRepository.query(config.getStartModuleId()); + CiModule startModule = moduleRepository.query(config.getStartModuleId(), positionKey); if (null == startModule) { return new GeneralResult<>(false, "没有对应的起始模型数据"); } - RelationCategory relationCategory = relationCategoryRepository.query(config.getCategoryId()); + RelationCategory relationCategory = relationCategoryRepository.query(config.getCategoryId(), positionKey); if (null == relationCategory) { return new GeneralResult<>(false, "没有对应的关系分组数据"); } - List moduleRelations = moduleRelationRepository.queryModuleList(config.getCategoryId()); + List moduleRelations = moduleRelationRepository.queryModuleList(config.getCategoryId(), positionKey); if (CollectionUtils.isEmpty(moduleRelations)) { return new GeneralResult<>(false, "对应的拓扑图内没有模型关系数据"); } @@ -797,7 +797,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { params.add(param); Pager pager = new Pager(1, Integer.MAX_VALUE, params, null); // 获取到实例数据 - GeneralResult>> result = this.resourcelist(pager); + GeneralResult>> result = this.resourcelist(pager, positionKey); if (result.isFailed()) { return new GeneralResult<>(false, "查询失败"); } @@ -809,7 +809,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { // 将拓扑路径模型id类型转成Long类型 List moduleIds = Arrays.asList(config.getTopologyPath().split(",")).stream().map(moduleId -> Long.parseLong(moduleId)).collect(Collectors.toList()); // 根据模型id查询模型信息 - List modules = moduleRepository.queryModuleListByIds(moduleIds); + List modules = moduleRepository.queryModuleListByIds(moduleIds, positionKey); if (CollectionUtils.isEmpty(modules)) { return new GeneralResult<>(false, "没有对应的模型数据"); } @@ -840,9 +840,9 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { // 通过源实例id的集合和目的实例id的集合以及拓扑路径中模型id的集合 查询出大概范围的数据 List instanceRelations = new ArrayList<>(); if (config.getPathDirection()) { - instanceRelations = instanceRelationRepository.listReverse(relationTable, config.getCategoryId(), new ArrayList<>(targetInstanceIds), new ArrayList<>(sourceInstanceIds)); + instanceRelations = instanceRelationRepository.listReverse(relationTable, config.getCategoryId(), new ArrayList<>(targetInstanceIds), new ArrayList<>(sourceInstanceIds), positionKey); } else { - instanceRelations = instanceRelationRepository.listForward(relationTable, config.getCategoryId(), new ArrayList<>(sourceInstanceIds), new ArrayList<>(targetInstanceIds)); + instanceRelations = instanceRelationRepository.listForward(relationTable, config.getCategoryId(), new ArrayList<>(sourceInstanceIds), new ArrayList<>(targetInstanceIds), positionKey); } List links = new ArrayList<>(); List nodes = new ArrayList<>(); @@ -873,21 +873,21 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { } @Override - public GeneralResult topology(Long id, Long instanceId) { + public GeneralResult topology(Long id, Long instanceId, String positionKey) { try { - TopologyConfig config = topologyConfigRepository.query(id); + TopologyConfig config = topologyConfigRepository.query(id, positionKey); if (null == config) { return new GeneralResult<>(false, "没有对应的拓扑实例"); } - CiModule startModule = moduleRepository.query(config.getStartModuleId()); + CiModule startModule = moduleRepository.query(config.getStartModuleId(), positionKey); if (null == startModule) { return new GeneralResult<>(false, "没有对应的起始模型数据"); } - RelationCategory relationCategory = relationCategoryRepository.query(config.getCategoryId()); + RelationCategory relationCategory = relationCategoryRepository.query(config.getCategoryId(), positionKey); if (null == relationCategory) { return new GeneralResult<>(false, "没有对应的关系分组数据"); } - List moduleRelations = moduleRelationRepository.queryModuleRealtionAndModuleImage(config.getCategoryId()); + List moduleRelations = moduleRelationRepository.queryModuleRealtionAndModuleImage(config.getCategoryId(), positionKey); if (CollectionUtils.isEmpty(moduleRelations)) { return new GeneralResult<>(false, "对应的拓扑图内没有模型关系数据"); } @@ -896,7 +896,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { //整理模型图标 Map moduleRelationMap = moduleRelationList.stream().collect(Collectors.toMap(ModuleRelation::getModuleId, Function.identity())); //获取实例数据 - Instance instance = instanceRepository.query(CmdbUtils.CMDB_INSTANCE + startModule.getCode().toLowerCase(), instanceId); + Instance instance = instanceRepository.query(CmdbUtils.CMDB_INSTANCE + startModule.getCode().toLowerCase(), instanceId, positionKey); if (null == instance) { return new GeneralResult<>(false, "资源实例数据不存在"); } @@ -913,7 +913,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { nodes.add(instanceModel); routeNodes.add(instanceModel); List links = Lists.newArrayList(); - buildRelation(routeNodes, nodes, links, config, startModule.getId(), relationCategory, instance.getId(), 1, moduleRelationMap, config.getStartType()); + buildRelation(routeNodes, nodes, links, config, startModule.getId(), relationCategory, instance.getId(), 1, moduleRelationMap, config.getStartType(), positionKey); InstanceTopo topo = new InstanceTopo(); topo.setNodes(nodes); topo.setLinks(links); @@ -924,20 +924,20 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { } } - private void buildRelation(List routeNodes, List nodes, List links, TopologyConfig config, Long startModuleId, RelationCategory relationCategory, Long instanceId, int hierarchy, Map moduleRelationMap, String startType) throws Exception { + private void buildRelation(List routeNodes, List nodes, List links, TopologyConfig config, Long startModuleId, RelationCategory relationCategory, Long instanceId, int hierarchy, Map moduleRelationMap, String startType, String positionKey) throws Exception { //当前当前实例节点所有的关系数据 List instanceRelationsUp = Lists.newArrayList(); List instanceRelationsDown = Lists.newArrayList(); if ("UP".equalsIgnoreCase(startType)) { - List instanceRelations = instanceRelationRepository.queryTargets(CmdbUtils.CMDB_INSTANCE_RELATION + relationCategory.getCode().toLowerCase(), startModuleId, instanceId); + List instanceRelations = instanceRelationRepository.queryTargets(CmdbUtils.CMDB_INSTANCE_RELATION + relationCategory.getCode().toLowerCase(), startModuleId, instanceId, positionKey); instanceRelationsUp.addAll(instanceRelations); } else if ("DOWN".equalsIgnoreCase(startType)) { - List instanceRelations = instanceRelationRepository.querySources(CmdbUtils.CMDB_INSTANCE_RELATION + relationCategory.getCode().toLowerCase(), startModuleId, instanceId); + List instanceRelations = instanceRelationRepository.querySources(CmdbUtils.CMDB_INSTANCE_RELATION + relationCategory.getCode().toLowerCase(), startModuleId, instanceId, positionKey); instanceRelationsDown.addAll(instanceRelations); } else { log.info("表名:{},源模型id:{},源实例id:{}", relationCategory.getCode().toLowerCase(), startModuleId, instanceId); - List up = instanceRelationRepository.queryTargets(CmdbUtils.CMDB_INSTANCE_RELATION + relationCategory.getCode().toLowerCase(), startModuleId, instanceId); - List down = instanceRelationRepository.querySources(CmdbUtils.CMDB_INSTANCE_RELATION + relationCategory.getCode().toLowerCase(), startModuleId, instanceId); + List up = instanceRelationRepository.queryTargets(CmdbUtils.CMDB_INSTANCE_RELATION + relationCategory.getCode().toLowerCase(), startModuleId, instanceId, positionKey); + List down = instanceRelationRepository.querySources(CmdbUtils.CMDB_INSTANCE_RELATION + relationCategory.getCode().toLowerCase(), startModuleId, instanceId, positionKey); instanceRelationsUp.addAll(up); instanceRelationsDown.addAll(down); } @@ -977,7 +977,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { routeNodes.add(instanceModel); //向上查询 if (hierarchy < config.getTopologyLevelUp()) { - buildRelation(routeNodes, nodes, links, config, instanceRelation.getSourceModuleId(), relationCategory, instanceRelation.getSourceInstanceId(), hierarchy + 1, moduleRelationMap, "UP"); + buildRelation(routeNodes, nodes, links, config, instanceRelation.getSourceModuleId(), relationCategory, instanceRelation.getSourceInstanceId(), hierarchy + 1, moduleRelationMap, "UP", positionKey); } } for (InstanceRelation instanceRelation : instanceRelationsDown) { @@ -998,7 +998,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { routeNodes.add(instanceModel); //向下查询 if (hierarchy < config.getTopologyLevelDown()) { - buildRelation(routeNodes, nodes, links, config, instanceRelation.getTargetModuleId(), relationCategory, instanceRelation.getTargetInstanceId(), hierarchy + 1, moduleRelationMap, "DOWN"); + buildRelation(routeNodes, nodes, links, config, instanceRelation.getTargetModuleId(), relationCategory, instanceRelation.getTargetInstanceId(), hierarchy + 1, moduleRelationMap, "DOWN", positionKey); } } } @@ -1031,18 +1031,18 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { * @return */ @Override - public GeneralResult nextTopoList(Long id, Long moduleId, Long instanceId) { + public GeneralResult nextTopoList(Long id, Long moduleId, Long instanceId, String positionKey) { try { InstanceTopo topo = new InstanceTopo(); - TopologyConfig config = topologyConfigRepository.query(id); + TopologyConfig config = topologyConfigRepository.query(id, positionKey); if (null == config) { return new GeneralResult<>(false, "没有对应的拓扑实例"); } - List moduleRelations = moduleRelationRepository.queryModuleList(config.getCategoryId()); + List moduleRelations = moduleRelationRepository.queryModuleList(config.getCategoryId(), positionKey); if (CollectionUtils.isEmpty(moduleRelations)) { return new GeneralResult<>(false, "对应的拓扑图内没有模型关系数据"); } - RelationCategory category = relationCategoryRepository.query(config.getCategoryId()); + RelationCategory category = relationCategoryRepository.query(config.getCategoryId(), positionKey); if (null == category) { return new GeneralResult<>(false, "没有对应的关系分组数据"); } @@ -1052,10 +1052,10 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { List moduleIds = new ArrayList<>(); if (null != config.getPathDirection()) { if (config.getPathDirection()) { - instanceRelations = instanceRelationRepository.listReverseByInstanceIds(relationTable, config.getCategoryId(), moduleId, instanceId); + instanceRelations = instanceRelationRepository.listReverseByInstanceIds(relationTable, config.getCategoryId(), moduleId, instanceId, positionKey); moduleIds = instanceRelations.stream().map(InstanceRelation::getSourceModuleId).collect(Collectors.toList()); } else { - instanceRelations = instanceRelationRepository.listForwardByInstanceIds(relationTable, config.getCategoryId(), moduleId, instanceId); + instanceRelations = instanceRelationRepository.listForwardByInstanceIds(relationTable, config.getCategoryId(), moduleId, instanceId, positionKey); moduleIds = instanceRelations.stream().map(InstanceRelation::getTargetModuleId).collect(Collectors.toList()); } } @@ -1064,7 +1064,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { } moduleIds.add(moduleId); // 根据模型id查询模型信息 - List modules = moduleRepository.queryModuleListByIds(moduleIds); + List modules = moduleRepository.queryModuleListByIds(moduleIds, positionKey); if (CollectionUtils.isEmpty(modules)) { return new GeneralResult<>(false, "没有对应的模型数据"); } @@ -1143,7 +1143,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { * @param topologyModel * @return */ - private GeneralResult>>> checkData(RequestInstanceTopologyModel topologyModel) { + private GeneralResult>>> checkData(RequestInstanceTopologyModel topologyModel, String positionKey) { try { if (null == topologyModel.getCategoryId()) { return new GeneralResult<>(false, "categoryId参数不能为空"); @@ -1152,7 +1152,7 @@ public class TopologyConfigServiceImpl implements TopologyConfigService { return new GeneralResult<>(false, "startModuleId参数不能为空"); } // 根据拓扑图分组id查询分组内模型数据 - List relations = moduleRelationRepository.queryModuleList(topologyModel.getCategoryId()); + List relations = moduleRelationRepository.queryModuleList(topologyModel.getCategoryId(), positionKey); if (CollectionUtils.isEmpty(relations)) { return new GeneralResult<>(false, "拓扑图内无拓扑模型!"); }