Tree structure data merging processing method and device, equipment and storage medium

By exporting the tree structure data into primary rendering table data and merging cells of the same parent node, the inefficiency problem caused by repeated parent nodes in tree structure data processing is solved, and the data volume and processing efficiency are reduced.

CN119025528AActive Publication Date: 2024-11-26HANGZHOU NEWGRAND TECHNOLOGY CO LTD

Patent Information

Application Number
CN202411515549.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2024-11-26
Estimated Expiration
2044-10-29

AI Technical Summary

Technical Problem

When processing tree structure data, a single parent node may have multiple child nodes, resulting in an increase in the amount of data, complex calculation process and low processing efficiency.

Method used

By exporting the tree structure data into primary rendering table data and merging cells of the same parent node, duplicate parent node data are integrated to generate target rendering table data, reducing the amount of data, and improving processing efficiency.

Benefits of technology

It effectively reduces the amount of data in the tree structure data, simplifies the processing process, and improves the processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025528A_ABST
    Figure CN119025528A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, in particular to a tree structure data merging processing method and device, equipment and a storage medium, and the method comprises the following steps: processing node data in tree structure data to obtain memory objects in one-to-one correspondence with the node data; determining a header root of the tree structure data and downward data corresponding to the header root based on the memory object; determining a left-right arrangement sequence of the header root and the downward data based on the memory object, and processing the header root and the downward data based on the left-right arrangement sequence to obtain target table data; and creating primary rendering table data based on the target table data, and merging cells in the primary rendering table data based on the memory object to obtain the target rendering table data. According to the method, the processing efficiency of processing the tree structure data is conveniently improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method, device, equipment and storage medium for merging and processing tree-structured data. Background Art

[0002] When performing structured statistics on data in an information system, tree-structured data is often generated. Tree-structured data consists of several levels of data. The data of adjacent levels have a parent-child relationship. The data of the higher level in the adjacent levels are parent nodes, and the data of the lower level are child nodes.

[0003] Since a single parent node may have multiple child nodes, and in tree-structured data, a corresponding parent node needs to be set for each child node, when the amount of tree-structured data is large, there will be many duplicate parent nodes, which makes the calculation process when processing tree-structured data very complicated, resulting in low processing efficiency for processing tree-structured data. Summary of the invention

[0004] In order to improve the processing efficiency of tree-structured data, the present application provides a tree-structured data merging processing method, device, equipment and storage medium.

[0005] In a first aspect, the present application provides a tree structure data merging processing method, comprising:

[0006] Processing each node data in the tree structure data to obtain a memory object corresponding to each node data;

[0007] Determine a header root of the tree structure data and downstream data corresponding to the header root based on the memory object;

[0008] Determine the left-right arrangement order of the table header root and the downward data based on the memory object, and process the table header root and the downward data based on the left-right arrangement order to obtain target table data;

[0009] Primary rendering table data is created based on the target table data, and cells in the primary rendering table data are merged based on the memory object to obtain target rendering table data.

[0010] In a second aspect, the present application provides a tree structure data merging processing device, comprising:

[0011] A memory object generation module, used for processing each node data in the tree structure data to obtain a memory object corresponding to each node data;

[0012] A root and data determination module, used to determine the header root of the tree structure data and the downstream data corresponding to the header root based on the memory object;

[0013] A target table data generating module, used for determining a left-right arrangement order of the table header root and the downward data based on the memory object, and processing the table header root and the downward data based on the left-right arrangement order to obtain target table data;

[0014] The target rendering table data generating module is used to create primary rendering table data based on the target table data, and to merge cells in the primary rendering table data based on the memory object to obtain the target rendering table data.

[0015] In a third aspect, the present application provides a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the steps in the above method when executing the computer program.

[0016] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps in the above method when executed by a processor.

[0017] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0018] The above-mentioned tree structure data merging and processing method, device, equipment and storage medium obtain memory objects corresponding to each node data by processing each node data in the tree structure data; determine the header root of the tree structure data and the downstream data corresponding to the header root based on the memory object; determine the left-right arrangement order of the header root and the downstream data based on the memory object, and process the header root and the downstream data based on the left-right arrangement order to obtain the target table data; create primary rendering table data based on the target table data, and merge the cells in the primary rendering table data based on the memory object to obtain the target rendering table data. Through the above implementation, the tree structure data can be first exported as primary rendering table data, and then the cells corresponding to the same parent node in the primary rendering table data can be merged, so that the repeated parent node data in the tree structure data can be integrated into one parent node data, thereby reducing the amount of data in the tree structure data structure, and then improving the processing efficiency of processing the tree structure data.

[0019] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 A flowchart of a tree structure data merging processing method provided in an embodiment of the present application;

[0022] Figure 2 A schematic diagram for reflecting the positional relationship between a four-way reference slot and node data provided in an embodiment of the present application;

[0023] Figure 3 A schematic diagram of the composition of a memory object provided in an embodiment of the present application;

[0024] Figure 4 A schematic diagram of the structure of a tree structure data merging and processing device provided in an embodiment of the present application;

[0025] Figure 5 A schematic diagram of the structure of a computer device provided in an embodiment of the present application;

[0026] Figure 6 This is a diagram of the internal structure of a computer-readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the present disclosure more clear, the present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present disclosure and are not used to limit the present disclosure.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of this article and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of this article described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0029] In this article, the term "and / or" is only a description of the association relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the related objects before and after are in an "or" relationship.

[0030] Embodiment 1

[0031] Figure 1 This is a flowchart of a tree structure data merging processing method provided in Example 1 of the present application, refer to Figure 1 The method may be performed by a device for performing the method, and the device may be implemented by software and / or hardware. The method includes:

[0032] S110, processing each node data in the tree structure data to obtain a memory object corresponding to each node data.

[0033] Among them, the corresponding tree structure data can be obtained through the data source of the information system, and the information system can be various types of information systems for enterprises, such as enterprise data statistics systems, etc.; the data source can be the data interface of the information system or the database set up in the information system, etc.; the tree structure data is composed of several levels of node data, and the node data of the previous level in the adjacent levels is the parent node data of the node data of the next level, and the node data of the next level is the child node data of the node data of the next level, and there is a corresponding parent-child relationship between the parent node data and the child node data; each node data has a corresponding display title, and the display title is used to represent the field corresponding to the node data, that is, to represent the type corresponding to the node data. For example, the display title corresponding to a node data is "Group".

[0034] Each node data in the tree structure data is stored in the form of a table. Each node data corresponds to a cell in the table. Each cell has four directions in the table, including: the upward direction, referred to as the upward direction; the downward direction, referred to as the downward direction; the left direction, referred to as the left direction; the right direction, referred to as the right direction; the adjacent cells in the four directions of each cell may correspond to other node data, that is, the node data corresponding to each cell may correspond to other node data information in the four directions (referred to as four directions), and the information of other node data corresponding to each node data in the four directions is recorded as four-way data information; taking one of the node data as an example, the node data and the display title and four-way data information corresponding to the node data are encapsulated to obtain the memory object corresponding to the node data.

[0035] It should be noted that, in order to store the tree structure data obtained from the data source, a raw data container for storing the tree structure data is preset; in order to store the memory object corresponding to each generated node data, a to-be-associated data container for storing the memory object is preset; the data container is formally embodied as a memory.

[0036] Specifically, tree structure data is obtained from a data source of an information system, the tree structure data including a plurality of node data, and then the tree structure data is stored in a preset original data container; then, the display title and four-way data information corresponding to each node data in the original data container are traversed, and then each node data and the display title and four-way data information corresponding to the node data are encapsulated, so as to obtain memory objects corresponding to each node data one by one, and further, each memory object is stored in a preset data container to be associated.

[0037] S120. Determine a header root of the tree structure data and downstream data corresponding to the header root based on the memory object.

[0038] Among them, the tree structure data is stored in the original data container in the form of a table, and there is no upward data in the four-way data information of the node data in the first row of the table, that is, the node data in the first row of the table has no other node data in its upper direction, and the node data without upward data in the table is recorded as a header root, and each header root generally has at least one column of data in its lower direction, that is, the downward data of the header root; the four-way data information of each node data can display the existence of data in the four directions of the node data. For example, assuming that a node data has no upward data in the table, but has left data, right data and downward data, then the memory object corresponding to the node data The four-way data will display the left data, right data and downward data corresponding to the node data, and display the upward data of the node data as empty; therefore, the memory object corresponding to a node data can be used to determine whether the node data is a table header root. For example, if the memory object corresponding to a node data determines that the node data has left data, right data and downward data, but no upward data, then the node data is used as the table header root; because the memory object corresponding to the table header root also indicates its adjacent downward data, and the adjacent downward data can also indicate its adjacent downward data through its memory object, and so on, until all the downward data under the table header root are indicated.

[0039] It should be noted that, in order to facilitate the storage of the generated header root and all its downstream data, a target data container for storing the header root and all its downstream data is also preset.

[0040] Specifically, taking a node data as an example, determine whether the node data is a header root through the memory object corresponding to the node data. If so, use the node data as the header root and store the header root in the preset target data container; further, determine all downstream data under the header root through the memory object of the header root, and also store the downstream data corresponding to the header root in the preset target data container.

[0041] S130, determining a left-right arrangement order of the table header root and the downward data based on the memory object, and processing the table header root and the downward data based on the left-right arrangement order to obtain target table data.

[0042] Among them, the header root and the downward data of at least one column stored in the target data container have an upward and downward arrangement order in the upward and downward directions, but the header roots and the downward data in the columns do not have a left-right arrangement order in the target data container. Subsequently, it is necessary to generate target table data based on the header roots and the downward data of the header roots, and the target table data requires that the header roots and the downward data in the columns have a left-right arrangement order in the target data container. For this purpose, it is necessary to determine the left-right arrangement order between the header roots and the left-right arrangement order between the downward data in the columns. Since the four-way data information in the memory object can also indicate the left-way data and the right-way data of the corresponding node data; for the header root, the other header roots located on its left and right can be determined through the four-way data information in the memory object corresponding to each header root, thereby determining the left-right arrangement order between the header roots; for the downward data corresponding to the header root, in the case that the header root corresponds to multiple columns of downward data, the left-right arrangement order between each layer (each row) of the downward data in the multiple columns of downward data can also be determined through the memory object corresponding to each downward data; the header roots can be arranged left and right according to the left and right arrangement order corresponding to the header roots, and the downward data can also be arranged left and right according to the left and right arrangement order between each layer of downward data, so that the target table data can be obtained.

[0043] Specifically, the left-right arrangement order between the header roots is determined through the memory objects corresponding to the header roots, and the left-right arrangement order between each layer of downward data corresponding to the header roots is determined through the memory objects of the downward data corresponding to the header roots; further, the header roots are arranged left-right according to the left-right arrangement order corresponding to the header roots, and the downward data are arranged left-right according to the left-right arrangement order between each layer of downward data, so as to obtain the target table data.

[0044] S140: Create primary rendering table data based on the target table data, and merge cells in the primary rendering table data based on the memory object to obtain target rendering table data.

[0045] Among them, the primary rendering table data is created based on the target table data. The primary rendering table data and the target table data have the same number of table rows and table columns, but the primary rendering table data has some cells with empty values. The reason for the generation of cells with empty values ​​is: in the process of creating the primary rendering table data, the repeated parent node data corresponding to multiple child node data will be merged into one parent node and displayed at the root of the table header; the cells where the parent node is located in the primary rendering table data and the empty value cells corresponding to the parent node are merged to obtain the target rendering table data.

[0046] Specifically, primary rendering table data is created according to the number of table rows and table columns of the wooden pen table data, and then all cells corresponding to the same parent node in the primary rendering table data are merged to obtain the target rendering table data.

[0047] It should be noted that this embodiment processes each node data in the tree structure data to obtain a memory object corresponding to each node data one by one; determines the header root of the tree structure data and the downstream data corresponding to the header root based on the memory object; determines the left-right arrangement order of the header root and the downstream data based on the memory object, and processes the header root and the downstream data based on the left-right arrangement order to obtain the target table data; creates primary rendering table data based on the target table data, and merges the cells in the primary rendering table data based on the memory object to obtain the target rendering table data. Through the above implementation, the tree structure data can be first exported as primary rendering table data, and then the cells corresponding to the same parent node in the primary rendering table data can be merged, so that the repeated parent node data in the tree structure data can be integrated into one parent node data, thereby reducing the amount of data in the tree structure data structure, and thus improving the processing efficiency of processing the tree structure data.

[0048] Embodiment 2

[0049] A method for merging and processing tree structured data provided in the second embodiment of the present application optimizes the method of "processing each node data in the tree structured data to obtain a memory object corresponding to each node data" in the first embodiment; it should be noted that for the part not described in detail in the present embodiment, reference may be made to the description of other embodiments, and the method includes:

[0050] S211 , setting a four-way reference slot corresponding to the node data according to the existence of the four-way data of each node data in the tree structure data.

[0051] Among them, the tree structure data is stored in the form of a table in the original data container. Taking a node data in the table as an example, the node data is in a cell in the table. The cell has four directions in the table. The four directions are: upward, downward, left and right. The adjacent data in the upward direction of the node data is its upward data, the adjacent data in the downward direction of the node data is its downward data, the adjacent data in the left direction of the node data is its left data, and the adjacent data in the right direction of the node data is its right data. The four-directional data is the upward data, downward data, left data and right data of the node data. It should be noted that the node data does not necessarily have complete four-directional data. For example, taking a node data in the first row of the table as an example, the node data may only have downward data, left data and right data, that is, the existence of four-directional data is the existence of the four-directional data corresponding to the corresponding node data. The four-directional reference slot is set according to the existence of the four-directional data, combined with Figure 2 The four-way reference slots include four reference slots arranged along the four directions of the node data, including an upward reference slot 21, a downward reference slot 22, a left reference slot 23, and a right reference slot 24; the four reference slots correspond one-to-one to the node data in the four directions where the node data may exist. If a node data corresponding to a reference slot exists, the information stored in the reference slot corresponds to the node data. If a node data corresponding to a reference slot does not exist, the reference slot is empty.

[0052] Specifically, taking a node data in the tree structure data as an example, first determine the existence of the four-way data of the node data, and then set the four-way reference slot of the node data according to the existence of the four-way data; set the four-way reference slot of each node data in the tree structure data in the above manner.

[0053] S212: Encapsulate based on the node data and the four-way reference slot to obtain a memory object corresponding to the node data.

[0054] The node data has corresponding metadata, which is recorded as node data metadata. The node data metadata is used to describe the corresponding node data. The node data also has a corresponding display title. In this embodiment, refer to Figure 3 , by encapsulating the display title, node data metadata and four-way reference slot corresponding to a node data, the memory object corresponding to the node data can be obtained.

[0055] Specifically, taking a node data of the tree structure data as an example, encapsulate the display title, node data metadata and four-way reference slot corresponding to the node data to obtain the memory object corresponding to the node data; obtain the memory object corresponding to each node data in the tree structure data through the above steps.

[0056] S220. Determine a header root of the tree structure data and downstream data corresponding to the header root based on the memory object.

[0057] S230: Determine a left-right arrangement order of the table header root and the downward data based on the memory object, and process the table header root and the downward data based on the left-right arrangement order to obtain target table data.

[0058] S240: Create primary rendering table data based on the target table data, and merge cells in the primary rendering table data based on the memory object to obtain target rendering table data.

[0059] Embodiment 3

[0060] A method for merging and processing tree structured data provided in the third embodiment of the present application optimizes the "determining the header root of the tree structured data and the downstream data corresponding to the header root based on the memory object" in the first embodiment; it should be noted that for the parts not described in detail in this embodiment, reference may be made to the descriptions of other embodiments, and the method includes:

[0061] S310, processing each node data in the tree structure data to obtain a memory object corresponding to each node data.

[0062] S321. Based on the memory object, determine the node data whose upward reference slot is empty among the four-way reference slots to obtain the header root.

[0063] Among them, the memory object includes a four-way reference slot for the corresponding node data. If the upward reference slot in the four-way reference slot is empty, the corresponding node data is the table header root, which is generally the first node data from top to bottom in each column of node data in the table where the node data is located.

[0064] Specifically, taking a node data in the tree structure data as an example, obtain the memory object of the node data, and then determine whether the upward reference slot in the four-way reference slot of the memory object is empty. If so, use the node data as the header root; determine all the header roots in the tree structure data in the above manner.

[0065] S322. Determine the downstream data corresponding to the header root based on the memory object corresponding to the header root.

[0066] Among them, when there are adjacent node data downstream of a header root, the downward reference slot in the four-way reference slot of the memory object corresponding to the header root will have data information of the adjacent node data, and the downward data of the header root can be determined through the data information. Furthermore, if there are adjacent node data downstream of the downward data, and the downward reference slot of the four-way reference slot of the memory object corresponding to the downward data will have data information of the adjacent node data, the downstream data of the downward data can be determined through the data information, and so on, until all the node data downstream of the header root are determined, and all the node data downstream of the header root are also the downward data corresponding to the node data.

[0067] Specifically, determine whether there is data information of node data in the downward reference slot of the four-way reference slot in the memory object corresponding to the header root. If so, determine the corresponding node data through the data information, and use the node data as the downward data of the header root; further, obtain the memory object corresponding to the downward data, and determine whether there is data information of node data in the downward reference slot of the four-way reference slot in the memory object. If so, determine the corresponding node data through the data information, and use the node data as the downward data of the above-mentioned downward data, and so on, until the last node data downward from the header root is determined; all the node data downward from the header root determined in the above steps are used as the downward data corresponding to the header root.

[0068] S330: Determine a left-right arrangement order of the table header root and the downward data based on the memory object, and process the table header root and the downward data based on the left-right arrangement order to obtain target table data.

[0069] S340: Create primary rendering table data based on the target table data, and merge cells in the primary rendering table data based on the memory object to obtain target rendering table data.

[0070] Embodiment 4

[0071] A method for merging and processing tree structured data is provided in a fourth embodiment of the present application. The method optimizes the "determining the left-right arrangement order of the table header root and the downward data based on the memory object" in the first embodiment. It should be noted that for the parts not described in detail in this embodiment, reference may be made to the descriptions of other embodiments. The method includes:

[0072] S410, processing each node data in the tree structure data to obtain a memory object corresponding to each node data.

[0073] It should be noted that the memory object includes the hierarchical internal number corresponding to the node data.

[0074] Among them, the node data metadata in the memory object includes the hierarchical internal number of the corresponding node data. The node data is stored in the initial data container in the form of a table. Each row of node data in the table corresponds to the node data of a level. Each row of node data has a corresponding number in the corresponding level, that is, the internal number of the level. The node data with the smallest number in the level is the first node data from left to right in the corresponding level.

[0075] S420: Determine a header root of the tree structure data and downstream data corresponding to the header root based on the memory object.

[0076] S431. Determine the left-right arrangement order of the header roots based on the hierarchical internal numbers in the memory objects corresponding to the header roots.

[0077] Among them, each header root is at the same level, and the node data metadata in the memory object of the header root includes the hierarchical internal number of the header root. The left-right arrangement order of each header root can be determined by the order of the hierarchical internal numbers of each header root from small to large.

[0078] Specifically, the memory object of each header root is obtained, and then the hierarchical internal number corresponding to each header root is obtained from the memory object, and the order of the hierarchical internal numbers from small to large is further used as the left-right arrangement order of each header root.

[0079] S432: Determine whether there are multiple columns of downward data in the table header root.

[0080] It should be noted that, under normal circumstances, one table header root corresponds to one column of downstream data. In some special cases, one table header root may correspond to multiple columns of downstream data. When there are multiple columns of downstream data in the table header root, the multiple columns of downstream data at each level need to be arranged in the left-right direction.

[0081] Specifically, the memory object corresponding to the table header root is obtained, and then it is determined whether the downward reference slot in the memory object includes data information of multiple downward data, so as to determine whether the table header root has multiple columns of downward data.

[0082] S433: If yes, determine the left-right arrangement order of the downward data in the same level based on the level internal number in the memory object corresponding to the downward data.

[0083] If it is determined that the downward reference slot in the memory object corresponding to the table header root includes data information of multiple downward data, it means that the table header root has multiple columns of downward data.

[0084] Specifically, if it is determined that there are multiple columns of downward data at the root of the table header, taking the multiple downward data corresponding to one level in the multiple columns of downward data as an example, the memory object of each downward data in the multiple downward data is obtained, and then the level internal number of each downward data is obtained from the memory object, and then the level internal numbers of each downward data are arranged in ascending order as the left-right arrangement order of the multiple downward data at the level.

[0085] S434, processing the table header root and the downward data based on the left-right arrangement order to obtain target table data.

[0086] S440: Create primary rendering table data based on the target table data, and merge cells in the primary rendering table data based on the memory object to obtain target rendering table data.

[0087] Embodiment 5

[0088] A method for merging and processing tree structure data provided in the fifth embodiment of the present application optimizes the "creating primary rendering table data based on the target table data" in the first embodiment; it should be noted that for the parts not described in detail in this embodiment, reference can be made to the descriptions of other embodiments, and the method includes:

[0089] S510, processing each node data in the tree structure data to obtain a memory object corresponding to each node data.

[0090] S520: Determine a header root of the tree structure data and downstream data corresponding to the header root based on the memory object.

[0091] S530: Determine a left-right arrangement order of the table header root and the downward data based on the memory object, and process the table header root and the downward data based on the left-right arrangement order to obtain target table data.

[0092] S541. Determine the corner root in the target table data based on the memory object.

[0093] Among them, the target table data is a table storing node data, and the table has four corners, and the four corners specifically include the upper left cell, the upper right cell, the lower left cell and the lower right cell, and the corner roots are the node data corresponding to the four corners; the memory object of the node data in the target table data can determine the corner root; for example, obtain a memory object of a node data in the target table data, and then determine whether the upward reference slot and the left reference slot in the memory object are empty. If so, use the corresponding node data as a corner root, which is specifically the corner root located at the upper left cell of the target table data; similarly, the corner roots located at the upper right cell, the lower left cell and the lower right cell of the target table data can also be determined.

[0094] Specifically, obtain the memory object corresponding to each node data in the target table data, take one of the node data as an example, determine whether the upward reference slot and the left reference slot in the memory object of the node data are empty, or determine whether the upward reference slot and the right reference slot in the memory object of the node data are empty, or determine whether the left reference slot and the downward reference slot in the memory object of the node data are empty, or determine whether the right reference slot and the downward reference slot in the memory object of the node data are empty. If so, use the node data as a corner root. In this embodiment, it is sufficient to obtain one corner root.

[0095] S542: Determine the size of the target table data based on the corner root and the memory objects of each node data corresponding to the corner root in the target table data.

[0096] Among them, taking the corner root located at the upper left corner cell of the target table data as an example, each node data corresponding to the corner root includes all node data at the level to the right of it, and all node data at the column below it; the size of the target table data includes the number of table columns and the number of table rows.

[0097] Specifically, taking the corner root located at the upper left corner cell of the target table data as an example, the memory object of the corner root is obtained, and then it is determined whether the right reference slot in the memory object contains data information of the node data. If so, the number of table columns is calculated to be 2; further, based on the node data corresponding to the right reference slot, the memory object of the node data corresponding to the right reference slot is obtained, and it is determined whether the right reference slot in the memory object contains data information of the node data. If so, the number of table columns is calculated to be 3; and so on, until it is determined that the right reference slot does not contain data information of the node data, thereby calculating the final number of table columns X.

[0098] Then, it is also determined whether the downward reference slot in the memory object of the above-mentioned corner root contains data information of the node data. If so, the number of table rows calculated at this time is 2; further, based on the node data corresponding to the downward reference slot, the memory object of the node data corresponding to the downward reference slot is obtained, and then it is determined whether the downward reference slot in the memory object contains data information of the node data. If so, the number of table rows calculated at this time is 3; and so on, until it is determined that the downward reference slot does not contain data information of the node data, thereby calculating the final number of table rows Y.

[0099] The final table column number X and table row number Y are calculated through the above steps, and the table column number X and table row number Y are used as the size of the target table data.

[0100] S543: Create a primary rendering table based on the size, and import each node data in the target table data into the primary rendering table based on the index relationship between the primary rendering table and the target table data to obtain primary rendering table data.

[0101] Among them, the number of table columns of the primary rendering table is X and the number of table rows is Y. The created primary rendering table has the same size as the target table data, and each cell in the primary rendering table has a corresponding cell in the position of the target table data. Exemplarily, the cell located in the upper left corner of the primary rendering table has a corresponding relationship with the cell in the upper left corner of the target table data, and the corresponding relationship is recorded as an index relationship; it should be noted that there may be several consecutive identical node data in the node data of a column of the target table data, and such node data may be the parent node data of multiple child node data. When the parent node data is imported into the primary rendering table, only one parent node data is imported, and the parent node data is located in the topmost cell among the several cells corresponding to the column where the primary rendering table is located.

[0102] Specifically, according to the calculated size of the target table data, a blank table with the same size as the target table data is created, which is recorded as a primary rendering table; further, according to the index relationship between the cells of the primary rendering table and the target table data, the node data in each cell of the target table data is imported into the corresponding cell of the primary rendering table; it should be noted that the node data metadata in the memory object also includes the parent-child relationship of the node data, and the parent-child relationship specifically includes the parent node ID and the child node ID of the node data; in the import process, taking a node data in the target table data as an example, based on the parent-child relationship of the node data, it is determined whether the node data corresponds to multiple child node data, and if so, the multiple cells in the column direction corresponding to the data node in the primary rendering table are further determined, and then only the data node is imported into the topmost cell among the multiple cells, and the remaining cells are no longer imported with node data; through the above steps, the node data in the target table data is imported into the corresponding cells in the primary rendering table, thereby obtaining the primary rendering table data.

[0103] S544: Merge cells in the primary rendering table data based on the memory object to obtain target rendering table data.

[0104] Embodiment 6

[0105] A tree structure data merging processing method provided in Embodiment 6 of the present application optimizes the "merging cells in the primary rendering table data based on the memory object to obtain target rendering table data" in Embodiment 1; it should be noted that for the parts not described in detail in this embodiment, reference may be made to the descriptions of other embodiments, and the method includes:

[0106] S610: Process each node data in the tree structure data to obtain a memory object corresponding to each node data.

[0107] S620: Determine a header root of the tree structure data and downstream data corresponding to the header root based on the memory object.

[0108] S630: Determine a left-right arrangement order of the table header root and the downward data based on the memory object, and process the table header root and the downward data based on the left-right arrangement order to obtain target table data.

[0109] S641: Create primary rendering table data based on the target table data.

[0110] S642: Determine a hierarchical root in the primary rendering table data based on the memory object.

[0111] Among them, the primary rendering table data is composed of several levels of node data. Taking the node data of one level as an example, there are generally multiple node data at this level, and the first node data from left to right in the node data of this level is the level root of the node data of this level; it should be noted that the left reference slot in the four-way reference slot corresponding to the level root is empty.

[0112] Specifically, taking the node data of a level of primary rendering table data as an example, the memory object of each node data in the node data of the level is obtained, and then the node data whose left reference slot in the four-way reference slot of the memory object is empty is determined, and the node is recorded as the level root.

[0113] S643, determining whether the hierarchical root has adjacent missing value cells in four directions in the primary rendering table data, and if so, merging the hierarchical root and the missing value cells to obtain a merged cell; the four directions include upward, downward, leftward, and rightward.

[0114] Among them, the reason for the generation of missing value cells is: in the process of importing the target table data into the primary rendering table, taking a node data in the target table data as an example, based on the parent-child relationship of the node data, it is determined whether the node data corresponds to multiple child node data. If so, the multiple cells in the column direction corresponding to the data node in the primary rendering table are further determined, and then only the data node is imported into the topmost cell among the multiple cells, and the node data is no longer imported into the remaining cells. The cells in the primary rendering table that have not imported the node data will form missing value cells.

[0115] Specifically, based on the hierarchy root, determine whether there is a missing value cell in the four directions. If so, merge the cell where the hierarchy root is located and the missing value cell into a merged cell, and display the node data corresponding to the hierarchy root in the merged cell.

[0116] S644, taking the merged cell as a new hierarchical root, and re-executing the step of obtaining the merged cell, until it is determined that the new hierarchical root has no adjacent missing value cells in four directions in the primary rendering table data.

[0117] Specifically, each time a merged cell is generated, the merged cell is used as a new hierarchy root, and then it is determined whether there are adjacent missing value cells in the four directions of the hierarchy root. If so, the cells of the new hierarchy root and the missing value cells are merged to obtain a new merged cell, and so on, until it is determined that the new hierarchy root has no adjacent missing value cells in the four directions of the primary rendering table data.

[0118] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0119] Embodiment 7

[0120] Based on the same inventive concept, this embodiment also provides a tree structure data merging processing device for implementing the tree structure data merging processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more tree structure data merging processing device embodiments provided below can refer to the limitations of the tree structure data merging processing method above, and will not be repeated here.

[0121] In this embodiment, Figure 4 As shown, a tree structure data merging processing device is provided, comprising:

[0122] A memory object generation module, used for processing each node data in the tree structure data to obtain a memory object corresponding to each node data;

[0123] A root and data determination module, used to determine the header root of the tree structure data and the downstream data corresponding to the header root based on the memory object;

[0124] A target table data generating module, used for determining a left-right arrangement order of the table header root and the downward data based on the memory object, and processing the table header root and the downward data based on the left-right arrangement order to obtain target table data;

[0125] The target rendering table data generating module is used to create primary rendering table data based on the target table data, and to merge cells in the primary rendering table data based on the memory object to obtain the target rendering table data.

[0126] Each module in the tree structure data merging and processing device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0127] It should be noted that this embodiment processes each node data in the tree structure data to obtain a memory object corresponding to each node data one by one; determines the header root of the tree structure data and the downstream data corresponding to the header root based on the memory object; determines the left-right arrangement order of the header root and the downstream data based on the memory object, and processes the header root and the downstream data based on the left-right arrangement order to obtain the target table data; creates primary rendering table data based on the target table data, and merges the cells in the primary rendering table data based on the memory object to obtain the target rendering table data. Through the above implementation, the tree structure data can be first exported as primary rendering table data, and then the cells corresponding to the same parent node in the primary rendering table data can be merged, so that the repeated parent node data in the tree structure data can be integrated into one parent node data, thereby reducing the amount of data in the tree structure data structure, and thus improving the processing efficiency of processing the tree structure data.

[0128] Embodiment 8

[0129] In this embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a tree structure data merging processing method is implemented.

[0130] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present disclosure, and does not constitute a limitation on the computer device to which the scheme of the present disclosure is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0131] Embodiment 9

[0132] In this embodiment, a computer readable storage medium is provided. Figure 6 As shown, a computer program is stored thereon, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0133] Embodiment 10

[0134] In this embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0135] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0136] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided by the present disclosure can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided by the present disclosure may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided by the present disclosure may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, etc., but are not limited to this.

[0137] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0138] The above-described embodiments only express several implementation methods of the present disclosure, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present disclosure, and these all belong to the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the attached claims.

Claims

1. A method for merging and processing tree structure data, characterized in that: include: Processing each node data in the tree structure data to obtain a memory object corresponding to each node data; Determine a header root of the tree structure data and downstream data corresponding to the header root based on the memory object; Determine the left-right arrangement order of the table header root and the downward data based on the memory object, and process the table header root and the downward data based on the left-right arrangement order to obtain target table data; Primary rendering table data is created based on the target table data, and cells in the primary rendering table data are merged based on the memory object to obtain target rendering table data.

2. The method according to claim 1, characterized in that The processing of each node data in the tree structure data to obtain a memory object corresponding to each node data includes: According to the existence of four-way data of each node data in the tree structure data, a four-way reference slot corresponding to the node data is set; The memory object corresponding to the node data is obtained by encapsulating the node data and the four-way reference slot.

3. The method according to claim 1, characterized in that The determining, based on the memory object, a table header root of the tree structure data and downstream data corresponding to the table header root includes: Determine the node data whose upward reference slot is empty in the four-way reference slot based on the memory object to obtain the header root; The downstream data corresponding to the header root is determined based on the memory object corresponding to the header root.

4. The method according to claim 1, characterized in that: The memory object includes the hierarchical internal number corresponding to the node data, and determining the left-right arrangement order of the header root and the downward data based on the memory object includes: Determine the left-right arrangement order of the header roots based on the hierarchical internal numbers in the memory objects corresponding to the header roots; Determine whether there are multiple columns of the downward data in the table header root; If so, the left-right arrangement order of the downward data in the same level is determined based on the level internal number in the memory object corresponding to the downward data.

5. The method according to claim 1, characterized in that The creating primary rendering table data based on the target table data includes: Determining corner roots in the target table data based on the memory object; Determine the size of the target table data based on the corner root and the memory object of each node data corresponding to the corner root in the target table data; A primary rendering table is created based on the size, and each node data in the target table data is imported into the primary rendering table based on the index relationship between the primary rendering table and the target table data to obtain primary rendering table data.

6. The method according to claim 1, characterized in that The merging of cells in the primary rendering table data based on the memory object to obtain target rendering table data includes: Determining a hierarchical root in the primary rendering table data based on the memory object; Determine whether there are adjacent missing value cells in four directions of the hierarchical root in the primary rendering table data, and if so, merge the hierarchical root and the missing value cells to obtain a merged cell; the four directions include upward, downward, leftward, and rightward; The merged cell is used as a new hierarchical root, and the step of obtaining the merged cell is re-executed until it is determined that the new hierarchical root has no adjacent missing value cells in four directions in the primary rendering table data.

7. A tree structure data merging and processing device, characterized in that: The device comprises: A memory object generation module, used for processing each node data in the tree structure data to obtain a memory object corresponding to each node data; A root and data determination module, used to determine the header root of the tree structure data and the downstream data corresponding to the header root based on the memory object; A target table data generating module, used for determining a left-right arrangement order of the table header root and the downward data based on the memory object, and processing the table header root and the downward data based on the left-right arrangement order to obtain target table data; The target rendering table data generating module is used to create primary rendering table data based on the target table data, and to merge cells in the primary rendering table data based on the memory object to obtain the target rendering table data.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Tree-shaped data loading method and device based on CIM object classification and storage medium

    CN112650892A

  • Tree form control generation method and device, equipment and storage medium

    CN113504901A

  • Table generation method and device, electronic equipment and storage medium

    CN114861618A

  • Cross-file data synchronization method and device based on online excel and medium

    CN115185949A

  • Tree control big data display method and device, equipment and storage medium

    CN115630207A

Cited By

  • Universal table data importing method and system, storage medium and electronic equipment

    CN121071017A

  • A method, system, storage medium and program product for dynamic consolidation of cells in a multi-dimensional data table grouped view

    CN122884971A