Forráskód Böngészése

add graph for entity

allen 2 éve
szülő
commit
ae5856dac4

+ 5 - 0
kgraph-graph/src/main/java/com/kgraph/graph/neo4j/controller/KgController.java

@@ -103,4 +103,9 @@ public class KgController extends BaseController {
         questionRecordService.insertQuestionRecord(questionRecord);
         return AjaxResult.success("success", result);
     }
+
+    @GetMapping("/getRelationByEntityId/{id}")
+    public AjaxResult getRelationByEntityId(@PathVariable("id") Long id) {
+        return AjaxResult.success(Neo4j2VOUtils.relation2GraphVO(kgService.getRelationByEntityId(id)));
+    }
 }

+ 3 - 0
kgraph-graph/src/main/java/com/kgraph/graph/neo4j/mapper/RelationRepository.java

@@ -44,4 +44,7 @@ public interface RelationRepository extends Neo4jRepository<Neo4jRelation, Long>
 
     @Query("match data=(e1:Entity)-[r:Relation]-(e2:Entity) where e1.name =~ $name return data")
     List<Neo4jRelation> getRelationByLikeName2(@Param("name") String name);
+
+    @Query("match data=(e1:Entity)-[r:Relation]-(e2:Entity) where id(e1) = $id return data")
+    List<Neo4jRelation> getRelationByEntityId(@Param("id") Long id);
 }

+ 2 - 0
kgraph-graph/src/main/java/com/kgraph/graph/neo4j/service/IKgService.java

@@ -27,4 +27,6 @@ public interface IKgService {
     void buildEntityByClass(List<BuildEntityRelationDTO> bu1ildEntityRelationDTOList);
 
     void addEntityRelation(BuildEntityRelation buildEntityRelation);
+
+    List<Neo4jRelation> getRelationByEntityId(Long id);
 }

+ 5 - 0
kgraph-graph/src/main/java/com/kgraph/graph/neo4j/service/impl/KgServiceImpl.java

@@ -321,4 +321,9 @@ public class KgServiceImpl implements IKgService {
         }
     }
 
+    @Override
+    public List<Neo4jRelation> getRelationByEntityId(Long id) {
+        return relationRepository.getRelationByEntityId(id);
+    }
+
 }

+ 23 - 11
sql/update20230529.sql

@@ -1,18 +1,30 @@
 use kgraph;
----- 按钮 SQL
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('构建流程查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'suport:flow:query',        '#', 'admin', sysdate(), '', null, '');
 
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('构建流程新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'suport:flow:add',          '#', 'admin', sysdate(), '', null, '');
+delete FROM `sys_menu` where menu_name like '%构建流程%';
+delete FROM `sys_menu` where menu_name like '%检查点管理%';
+delete FROM `sys_menu` where menu_name like '%排故流程%';
 
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('构建流程修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'suport:flow:edit',         '#', 'admin', sysdate(), '', null, '');
 
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('构建流程删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'suport:flow:remove',       '#', 'admin', sysdate(), '', null, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('检查点管理', 2066, 0, 'piont', 'suport/piont/index', NULL, 1, 0, 'C', '0', '0', 'suport:piont:list', '#', 'admin', '2023-05-28 03:15:20', 'admin', '2023-05-31 03:07:30', '检查点管理菜单');
 
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('构建流程导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'suport:flow:export',       '#', 'admin', sysdate(), '', null, '');
+-- 按钮父菜单ID
+SELECT @parentId := LAST_INSERT_ID();
+
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '检查点管理查询', @parentId, 1, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:piont:query', '#', 'admin', '2023-05-28 03:15:20', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '检查点管理新增', @parentId, 2, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:piont:add', '#', 'admin', '2023-05-28 03:15:20', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '检查点管理修改', @parentId, 3, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:piont:edit', '#', 'admin', '2023-05-28 03:15:20', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '检查点管理删除', @parentId, 4, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:piont:remove', '#', 'admin', '2023-05-28 03:15:20', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '检查点管理导出', @parentId, 5, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:piont:export', '#', 'admin', '2023-05-28 03:15:20', '', NULL, '');
+
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('排故流程', 2066, 1, 'flow', 'suport/flow/index', NULL, 1, 0, 'C', '0', '0', 'suport:flow:list', '#', 'admin', '2023-05-28 03:15:47', 'admin', '2023-05-29 08:29:50', '构建流程菜单');
+
+-- 按钮父菜单ID
+SELECT @parentId := LAST_INSERT_ID();
+
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '构建流程查询', @parentId, 1, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:flow:query', '#', 'admin', '2023-05-28 03:15:47', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '构建流程新增', @parentId, 2, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:flow:add', '#', 'admin', '2023-05-28 03:15:47', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '构建流程修改', @parentId, 3, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:flow:edit', '#', 'admin', '2023-05-28 03:15:47', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '构建流程删除', @parentId, 4, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:flow:remove', '#', 'admin', '2023-05-28 03:15:47', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '构建流程导出', @parentId, 5, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:flow:export', '#', 'admin', '2023-05-28 03:15:47', '', NULL, '');
 
 commit;