A dynamic table merging method, device, equipment and storage medium
By obtaining the original list and merging conditions, identifying labeled and unlabeled data, performing merge sorting, and generating the target list, the problem of high computational complexity in dynamic table merging is solved, achieving efficient merging.
Patent Information
- Application Number
- CN202111355653.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-16
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2041-11-16
AI Technical Summary
In front-end UI frameworks, the calculation of the number of cells spanned by dynamic tables is highly complex, especially in complex business scenarios where it is difficult to merge them correctly, resulting in high difficulty in merging calculations and a high risk of errors.
By obtaining the original list and merging conditions, identifying labeled and unlabeled data, performing merge sorting, generating merged data, and generating the target list based on this data, the difficulty of calculating the number of cells spanned is reduced.
This reduces the complexity of the merged computation from O(n^2) to O(n), improving the efficiency and accuracy of the merged computation.
Smart Images

Figure CN114065711B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, device, and storage medium for merging dynamic tables. Background Technology
[0002] Table merging is a common business requirement in front-end development, especially in systems with many reports, where different merging methods are often needed depending on the business scenario. Currently, in front-end UI (User Interface) frameworks, tables are generally used as list data types. Table merging typically uses row and column attributes to indicate the number of cells spanned. For static merging, the implementation is relatively simple; the data processing method generally involves iterating and calculating the identifier data during initialization, usually with at least two nested iterations, so the complexity is generally greater than or equal to O(n^2). For dynamic merging, the implementation method varies depending on the scenario, and the complexity is generally related to the complexity of the data type.
[0003] Currently, front-end UI data frameworks typically provide two identifiers, row and column, to mark the number of cells spanned, thereby merging tables. This is easy to implement for simple data types, but in complex scenarios, merging is often prone to errors and it is difficult to correctly calculate the identifier data. For example, in customized approval chain scenarios, approval data generally contains a lot of information, such as approval nodes, approval types, whether multiple approvers can be filled in under parallel and collaborative approval, etc., and list data may contain nested lists or objects, etc., making the types complex. Business requirements need to perform dynamic merging based on the approval node type. In dynamic tables, approval nodes can be added and deleted dynamically, so it is difficult to merge based on the original data. It is necessary to simplify complex data to reduce the difficulty of calculating identifiers. Summary of the Invention
[0004] In view of this, this application is made to provide a method, apparatus, device, and storage medium for merging dynamic tables that overcomes or at least partially solves the problem of calculating the number of cells spanned in dynamic table merging, including:
[0005] A method for merging dynamic tables, the method being used to merge dynamic tables based on data nodes, comprising:
[0006] Obtain the original list and merging conditions, and determine the labeled and unlabeled data in the original list based on the merging conditions; wherein, the original list includes at least two rows of original data groups, and each original data group contains a number of original data; the data nodes corresponding to the original data in the same column in each row of the original data group are the same;
[0007] Based on the labeled data and the unlabeled data, determine the data to be merged corresponding to the labeled data and the data not to be merged corresponding to the unlabeled data in the original list;
[0008] Merge and sort the data to be merged corresponding to the label data of the same type to generate merged data;
[0009] Based on the labeled data, the unlabeled data, the merged data, the unmerged data, and the original list, a target list corresponding to the merging conditions is generated.
[0010] Preferably, the merging conditions include merging attributes and merging quantity, wherein the merging attributes are specified data attributes under a specified data node; determining the labeled data and non-labeled data in the original list based on the merging conditions includes:
[0011] Determine the number of target data corresponding to the merged attribute in the original list;
[0012] When the quantity of the target data meets the required quantity to be merged, the labeled data and the unlabeled data are determined based on the target data.
[0013] Preferably, the merging conditions include merging nodes, where the merging node is a specified data node; determining the labeled and non-labeled data in the original list based on the merging conditions includes:
[0014] Based on the target data under the specified data node, the labeled data and the unlabeled data are determined.
[0015] Preferably, determining the data to be merged corresponding to the tag data and the data not to be merged corresponding to the non-tag data in the original list based on the tag data and the non-tag data includes:
[0016] Based on other data in the same original data group as the tag data, determine the data to be merged corresponding to the tag data;
[0017] Based on other data in the same original data group as the unlabeled data, determine the non-merged data corresponding to the unlabeled data.
[0018] Preferably, generating a target list corresponding to the merging conditions based on the labeled data, the unlabeled data, the merged data, the unmerged data, and the original list includes:
[0019] Based on the labeled data, the unlabeled data, the merged data, and the unmerged data, a key-value pair mapping set is generated;
[0020] The target list is generated based on the original list and the key-value pair mapping set.
[0021] Preferably, generating a key-value pair mapping set based on the labeled data, the unlabeled data, the merged data, and the unmerged data includes:
[0022] Generate a key based on the tagged data and the untagged data;
[0023] A value is generated based on the merged data and the non-merged data;
[0024] The key-value pair mapping set is generated based on the key and the value.
[0025] Preferably, generating the target list based on the original list and the key-value pair mapping set includes:
[0026] Based on the original list, determine the number of data nodes corresponding to the original data;
[0027] For each key in the key-value pair mapping set, the number of cells spanned by the key is determined based on the number of values corresponding to the key;
[0028] Generate a key data frame based on the number of cells the key spans;
[0029] Generate a value data frame based on the number of cells spanned by the key and the number of data nodes;
[0030] The key is inserted into the key data frame, and the value corresponding to the key is sequentially inserted into the value data frame to generate the target list.
[0031] A dynamic table merging device, comprising:
[0032] The first data determination module is used to obtain the original list and merging conditions, and determine the labeled data and non-labeled data in the original list according to the merging conditions; wherein, the original list includes at least two rows of original data groups, and the original data groups contain a number of original data; the data nodes corresponding to the original data in the same column in each row of the original data group are the same;
[0033] The second data determination module is used to determine, based on the labeled data and the unlabeled data, the data to be merged corresponding to the labeled data and the data not to be merged corresponding to the unlabeled data in the original list;
[0034] The merge sorting module is used to merge and sort the data to be merged corresponding to the label data of the same type, and generate merged data;
[0035] The list generation module is used to generate a target list corresponding to the merging conditions based on the labeled data, the unlabeled data, the merged data, the unmerged data, and the original list.
[0036] A computer device includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the dynamic table merging method as described above.
[0037] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the dynamic table merging method described above.
[0038] This application has the following advantages:
[0039] In the embodiments of this application, by obtaining the original list and merging conditions, and based on the merging conditions, the labeled data and non-labeled data in the original list are determined; wherein, the original list includes at least two rows of original data groups, and the original data groups contain a number of original data; the data nodes corresponding to the original data in the same column in each row of the original data group are the same; based on the labeled data and the non-labeled data, the data to be merged corresponding to the labeled data and the non-merged data corresponding to the non-labeled data in the original list are determined; the data to be merged corresponding to the labeled data of the same type are merged and sorted to generate merged data; based on the labeled data, the non-labeled data, the merged data, the non-merged data, and the original list, a target list corresponding to the merging conditions is generated. Based on the merging conditions, the complex list data is merged, reducing the calculation difficulty of the number of cells across, thereby greatly reducing the difficulty of merging calculation. The general data processing method involves traversing and calculating the identifier data during initialization, which typically involves at least two nested traversals, resulting in a complexity of O(n^2). However, the method in this embodiment only performs two non-nested traversals on the data throughout the entire process, achieving a time complexity of only O(n), thereby significantly reducing the program's time complexity. Attached Figure Description
[0040] To more clearly illustrate the technical solution of this application, the drawings used in the description of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0041] Figure 1This is a flowchart illustrating the steps of a dynamic table merging method according to an embodiment of this application;
[0042] Figure 2 This is a structural data block diagram of a dynamic table merging device provided in one embodiment of this application;
[0043] Figure 3 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application.
[0044] The reference numerals in the accompanying drawings are as follows:
[0045] 12. Computer equipment; 14. External devices; 16. Processing unit; 18. Bus; 20. Network adapter; 22. I / O interface; 24. Display; 28. Memory; 30. Random access memory; 32. Cache memory; 34. Storage system; 40. Program / utility; 42. Program module. Detailed Implementation
[0046] To make the objectives, features, and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0047] It should be noted that, in any embodiment of this application, the merging method is used to merge dynamic tables based on data nodes.
[0048] Reference Figure 1 This illustrates a method for merging dynamic tables according to an embodiment of this application;
[0049] The method includes:
[0050] S110. Obtain the original list and merging conditions, and determine the labeled data and non-labeled data in the original list according to the merging conditions; wherein, the original list includes at least two rows of original data groups, and the original data groups contain a number of original data; the data nodes corresponding to the original data in the same column in each row of the original data group are the same.
[0051] S120. Based on the labeled data and the unlabeled data, determine the data to be merged corresponding to the labeled data and the data not to be merged corresponding to the unlabeled data in the original list;
[0052] S130. Merge and sort the data to be merged corresponding to the label data of the same type to generate merged data;
[0053] S140. Based on the labeled data, the unlabeled data, the merged data, the unmerged data, and the original list, generate a target list corresponding to the merging conditions.
[0054] In the embodiments of this application, by obtaining the original list and merging conditions, and based on the merging conditions, the labeled data and non-labeled data in the original list are determined; wherein, the original list includes at least two rows of original data groups, and the original data groups contain a number of original data; the data nodes corresponding to the original data in the same column in each row of the original data group are the same; based on the labeled data and the non-labeled data, the data to be merged corresponding to the labeled data and the non-merged data corresponding to the non-labeled data in the original list are determined; the data to be merged corresponding to the labeled data of the same type are merged and sorted to generate merged data; based on the labeled data, the non-labeled data, the merged data, the non-merged data, and the original list, a target list corresponding to the merging conditions is generated. Based on the merging conditions, the complex list data is merged, reducing the calculation difficulty of the number of cells across, thereby greatly reducing the difficulty of merging calculation. The general data processing method involves traversing and calculating the identifier data during initialization, which typically involves at least two nested traversals, resulting in a complexity of O(n^2). However, the method in this embodiment only performs two non-nested traversals on the data throughout the entire process, achieving a time complexity of only O(n), thereby significantly reducing the program's time complexity.
[0055] The following will further explain a method for merging dynamic tables in this exemplary embodiment.
[0056] As described in step S110, the original list and merging conditions are obtained, and the labeled data and non-labeled data in the original list are determined according to the merging conditions; wherein, the original list includes at least two rows of original data groups, and the original data groups contain a number of original data; the data nodes corresponding to the original data in the same column in each row of the original data group are the same.
[0057] Extract the original list from the specified table component. The original list can be obtained through... The HTML table defined by the tag, the original list includes at least two rows via The original data group defined by the label, each row of the original data group includes several data points... The original data defined by the tag can be text, image, list, paragraph, form, horizontal line, etc.; the data nodes corresponding to the original data in the same column in each row of the original data group are the same.
[0058] In one specific implementation, the original list is presented in the table component in the following form:
[0059] A Andy 10,000 yuan 1 year C Martin 20,000 yuan 0.5 years B Betty 10,000 yuan 1 year D James 15,500 yuan 1 year D Henry 5000 yuan 0.5 years C Joan 40,000 yuan 3 years B Karl 35,000 yuan 1.5 years A Helen 80,000 yuan 3 years E John 25,000 yuan 1.5 years C Paul 8000 yuan 1 year
[0060] Table 1
[0061] As shown in Table 1, the original list contains 10 rows of original data groups, namely: "A, Andy, 10,000 yuan, 1 year", "C, Martin, 20,000 yuan, 0.5 years", ... "C, Paul, 8,000 yuan, 1 year". Each row of the original data group contains 4 original data items. For example, the original data group in the first row contains the original data items: "A", "Andy", "10,000 yuan", and "1 year". The original data items in the same column in each row of the original data group correspond to the same data node. For example, the original data items in the first column correspond to the "Business Type" node, the original data items in the second column correspond to the "Customer Name" node, the original data items in the third column correspond to the "Application Amount" node, and the original data items in the fourth column correspond to the "Term" node.
[0062] The merging conditions are user-defined rules for merging list data. Users can set the required merging conditions according to the actual situation; for example, in an approval chain scenario, a specified approval node can be set as the merging condition.
[0063] As an example, the merging conditions include a merging attribute and a merging quantity. The merging attribute is a specified data attribute under a specified data node, and the merging quantity is the required quantity of target data corresponding to the merging attribute. That is, when the quantity of the target data (data corresponding to the specified data attribute under a specified data node) meets the merging quantity, the target data is merged. It should be noted that the merging quantity can be an integer, such as 2, 3, or 4, or a range value, such as ≥2, ≥3, or ≥4.
[0064] Based on the merging attribute and the merging quantity, the labeled data and the non-labeled data in the original list are determined. Specifically, the quantity of target data corresponding to the specified data attribute under the specified data node is determined; when the quantity of target data meets the merging quantity, the target data is used as the labeled data, and the other data under the specified data node besides the labeled data is used as the non-labeled data.
[0065] In one specific implementation, the merged attributes include three: "A", "B", and "C" under the "Business Type" node, and the merge quantity for each is ≥3. As shown in Table 1, the number of "A" under the "Business Type" node is 2, which does not meet the merge quantity requirement; the number of "B" is also 2, which does not meet the merge quantity requirement; while the number of "C" is 3, which meets the merge quantity requirement. Therefore, "C" in rows 2, 6, and 10 of Table 1 is used as the tag data, and all other data under the "Business Type" node except "C" is used as the non-tag data.
[0066] As another example, the merging condition includes a merging node, which is a specified data node, that is, the target data (all data under the specified data node) under the specified data node is merged according to data attributes.
[0067] Based on the merge node, the labeled data and the unlabeled data in the original list are determined. Specifically, all target data under the specified data node are used as labeled data, and the unlabeled data is set to an empty set. It should be noted that since all data under the specified data node is set as labeled data, the unlabeled data is an empty set.
[0068] In one specific implementation, the merging condition is the "Business Type" node. Therefore, "A" in rows 1 and 8 of Table 1 is used as the first type of label data, "B" in rows 3 and 7 is used as the second type of label data, "C" in rows 2, 6, and 10 is used as the third type of label data, "D" in rows 4 and 5 is used as the fourth type of label data, "E" in row 9 is used as the fifth type of label data, and the non-label data is set to an empty set.
[0069] As described in step S120, based on the labeled data and the unlabeled data, the data to be merged corresponding to the labeled data and the data not to be merged corresponding to the unlabeled data in the original list are determined.
[0070] Based on the labeled data, the data to be merged is determined; based on the unlabeled data, the data not to be merged is determined. Specifically, other data in the same original data group as the labeled data are designated as the data to be merged; other data in the same original data group as the unlabeled data are designated as the data not to be merged.
[0071] In one specific implementation, the "C" in rows 2, 6, and 10 of Table 1 is the labeled data, and the other data under the "Business Type" node other than "C" is the non-labeled data. Therefore, the other data in the same row as "C" in rows 2, 6, and 10 is the data to be merged, and the other data in the same row as the non-labeled data is the non-merged data.
[0072] In another specific implementation, in Table 1, rows 1 and 8, "A" represents the first type of label data; rows 3 and 7, "B" represents the second type of label data; rows 2, 6, and 10, "C" represents the third type of label data; rows 4 and 5, "D" represents the fourth type of label data; and row 9, "E" represents the fifth type of label data. Therefore, the other data in the same row as "A" in rows 1 and 8 are considered the first type of data to be merged; the other data in the same row as "B" in rows 3 and 7 are considered the second type of data to be merged; the other data in the same row as "C" in rows 2, 6, and 10 are considered the third type of data to be merged; the other data in the same row as "D" in rows 4 and 5 are considered the fourth type of data to be merged; and the other data in the same row as "E" in row 9 are considered the fifth type of data to be merged. It should be noted that since the non-label data is an empty set, the non-merge data is also an empty set.
[0073] As described in step S130, the data to be merged corresponding to the label data of the same type are merged and sorted to generate merged data.
[0074] Merge-Sort is a sorting algorithm that utilizes the idea of merging. This algorithm employs the classic divide-and-conquer strategy (divide and conquer by breaking the problem down into smaller subproblems and solving them recursively, then "conquering" the solutions obtained in the divide phase). Specifically, the data to be merged is first decomposed into several data points of length 1. These data points are then merged pairwise to obtain several ordered sequences of length 2. These ordered sequences are then merged pairwise to obtain several ordered sequences of length 4. This process continues until a single ordered sequence of length matching the total length of the data to be merged is obtained.
[0075] In one specific implementation, the label data is "C", and the data to be merged is "Martin, 20,000 yuan, 0.5 years", "Joan, 40,000 yuan, 3 years", and "Paul, 8,000 yuan, 1 year". Two merge sorts are required. The first merge sort yields: {"Joan, 40,000 yuan, 3 years", "Martin, 20,000 yuan, 0.5 years"} and {"Paul, 8,000 yuan, 1 year"}. The second merge sort yields: {"Joan, 40,000 yuan, 3 years", "Martin, 20,000 yuan, 0.5 years", and "Paul, 8,000 yuan, 1 year"}, which is the data to be merged.
[0076] As described in step S140, a target list corresponding to the merging conditions is generated based on the labeled data, the unlabeled data, the merged data, the unmerged data, and the original list.
[0077] Based on the labeled data, the unlabeled data, the merged data, and the unmerged data, a key-value pair mapping set is generated. Based on the labeled data and the unlabeled data, keys are generated; based on the merged data and the unmerged data, values are generated; and based on the keys and values, the key-value pair mapping set is generated. The key-value pair mapping set is a data structure containing the order of key-value pair mappings, such as a map structure. It can generally be understood as an associative array, where a value is retrieved using the key as an index, just like the built-in array type. The essence of association lies in the fact that the value of an element is associated with a specific key, rather than being retrieved through the element's position in the array.
[0078] In one specific implementation, the tag data includes five categories: "A", "B", "C", "D", and "E". The five categories of tag data are set as the keys, and the merged data corresponding to the five categories of tag data is set as the values corresponding to the keys, generating the key-value pair mapping set as shown below:
[0079] A: {"Andy, 10,000 yuan, 1 year", "Helen, 80,000 yuan, 3 years"};
[0080] B: {"Betty, 10,000 yuan, 1 year", "Karl, 35,000 yuan, 1.5 years"};
[0081] C: {"Joan, 40,000 yuan, 3 years", "Martin, 20,000 yuan, 0.5 years", "Paul, 8,000 yuan, 1 year"};
[0082] D: {"Henry, 5000 yuan, 0.5 years", "James, 15500 yuan, 1 year"};
[0083] E: {"John, $25,000, 1.5 years"}.
[0084] The target list is generated based on the original list and the key-value pair mapping set. Key data frames and value data frames are constructed based on the original list and the key-value pair mapping set, respectively. Then, the keys are inserted into the key data frames, and the values are inserted into the value data frames to obtain the target list. Specifically, based on the original list, the number of data nodes corresponding to the original data is determined; for each key in the key-value pair mapping set, the number of cells spanned by the key is determined based on the number of values corresponding to the key, and a key data frame is generated based on the number of cells spanned by the key; a value data frame is generated based on the number of cells spanned by the key and the number of data nodes; the keys are inserted into the key data frames, and the values corresponding to the keys are sequentially inserted into the value data frames to generate the target list.
[0085] In one embodiment of this application, the merging conditions include a merging attribute and a merging quantity. The merging attribute is a specified data attribute under a specified data node, and the merging quantity is the required quantity of target data corresponding to the merging attribute. That is, when the quantity of the target data (data with the specified data attribute under a specified data node) meets the merging quantity, the target data is merged. It should be noted that the merging quantity can be an integer, such as 2, 3, or 4, or a range value, such as ≥2, ≥3, or ≥4.
[0086] The step of determining the labeled data and the non-labeled data in the original list based on the merging conditions includes:
[0087] Determine the number of target data corresponding to the merged attribute in the original list;
[0088] When the quantity of the target data meets the merging quantity, the labeled data and the unlabeled data are determined based on the target data. Specifically, the target data is used as the labeled data, and all other data under the specified data node except for the labeled data is used as the unlabeled data.
[0089] In one embodiment of this application, the merging condition includes a merging node, which is a designated data node, that is, the target data (all data under the designated data node) under the designated data node is merged according to data attributes.
[0090] The step of determining the labeled and non-labeled data in the original list based on the merging conditions includes:
[0091] Based on the target data under the specified data node, the labeled data and the unlabeled data are determined. Specifically, the target data under the specified data node is used as the labeled data, and the unlabeled data is set to an empty set.
[0092] In one embodiment of this application, determining the data to be merged corresponding to the tag data and the data not to be merged corresponding to the non-tag data in the original list based on the tag data and the non-tag data includes:
[0093] The data to be merged is determined based on other data that are in the same original data group as the tag data. Specifically, other data that are in the same original data group as the tag data are taken as the data to be merged.
[0094] The non-mergeable data is determined based on other data that are in the same original data group as the non-labeled data. Specifically, other data that are in the same original data group as the non-labeled data are considered as the non-mergeable data.
[0095] In one embodiment of this application, generating a target list corresponding to the merging conditions based on the labeled data, the unlabeled data, the merged data, the unmerged data, and the original list includes:
[0096] Based on the labeled data, the unlabeled data, the merged data, and the unmerged data, a key-value pair mapping set is generated. Specifically, based on the labeled data and the unlabeled data, keys are generated; based on the merged data and the unmerged data, values are generated; and based on the keys and the values, the key-value pair mapping set is generated.
[0097] The target list is generated based on the original list and the key-value pair mapping set. Specifically, based on the original list and the key-value pair mapping set, key data frames and value data frames are constructed respectively. The keys are inserted into the key data frames, and the values are inserted into the value data frames to obtain the target list.
[0098] In one embodiment of this application, generating a key-value pair mapping set based on the labeled data, the unlabeled data, the merged data, and the unmerged data includes:
[0099] A key is generated based on the labeled data and the non-labeled data. Specifically, the labeled data and the non-labeled data are set as the key;
[0100] A value is generated based on the merged data and the non-merged data. Specifically, the merged data and the non-merged data are set to the value.
[0101] Based on the key and the value, the key-value pair mapping set is generated. Specifically, for each key, one or more corresponding values are determined, and the key-value pair mapping set containing the correspondence between the key and the value is generated.
[0102] In one embodiment of this application, generating the target list based on the original list and the key-value pair mapping set includes:
[0103] Based on the original list, determine the number of data nodes corresponding to the original data, which is also the number of columns in the original list.
[0104] For each key in the key-value pair mapping set, the number of cells spanned by the key is determined based on the number of values corresponding to the key. Specifically, the number of values is used as the number of cells spanned by the key.
[0105] A key data frame is generated based on the number of cells spanned by the key. Specifically, the number of cells spanned in the row of the key data frame is set to the number of cells spanned by the key; the number of cells spanned in the column of the key data frame is set to 1; and the key data frame is generated based on the number of cells spanned in the row and column of the key data frame.
[0106] In one specific implementation, the number of cells spanned by "A" in the key-value pair mapping set is 2. Therefore, the number of cells spanned by the row of the key data frame corresponding to "A" is set to 2, the number of cells spanned by the column of the key data frame is set to 1, and the key data frame is generated based on the above information.
[0107] A value data frame is generated based on the number of cells spanned by the key and the number of data nodes. Specifically, the number of cells spanned by rows and columns of the value data frame are each set to 1; the number of rows of the value data frame is set to the number of cells spanned by the key; the number of columns of the value data frame is set to the number of data nodes minus 1; and the value data frame is generated based on the number of cells spanned by rows, columns, and columns of the value data frame.
[0108] In one specific implementation, the number of cells spanned by "A" is 2 and the number of data nodes is 4. Therefore, the number of cells spanned by rows and columns of the value data frame corresponding to "A" is set to 1, the number of rows of the value data frame is set to 2, the number of columns of the value data frame is set to 3, and the value data frame is generated based on the above information.
[0109] The key is inserted into the key data frame, and the value corresponding to the key is sequentially inserted into the value data frame to generate the target list. Specifically, the key is inserted into the key data frame; the value corresponding to the key is sequentially inserted into the value data frame from top to bottom, wherein the original data unit contained in each value is sequentially inserted into the value data frame of the corresponding row from left to right to generate the target list.
[0110] In one specific implementation, "A" is inserted into the key data frame, and the corresponding values "Andy, 10000 yuan, 1 year" and "Helen, 80000 yuan, 3 years" are inserted into the value data frame from top to bottom. Specifically, in "Andy, 10000 yuan, 1 year", "Andy", "10000 yuan", and "1 year" are inserted from left to right into the value data frame of the corresponding row, and in "Helen, 80000 yuan, 3 years", "Helen", "80000 yuan", and "3 years" are inserted from left to right into the value data frame of the corresponding row. The generated target list is presented in the following form:
[0111]
[0112] Table 2
[0113] In one embodiment of this application, after generating the target list based on the original list and the key-value pair mapping set, the method further includes:
[0114] Obtain the position of the original list in the table component, and replace the original list with the target list at the position.
[0115] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0116] This application illustrates a dynamic table merging apparatus according to an embodiment of the present application;
[0117] Specifically, it includes:
[0118] The first data determination module 210 is used to obtain the original list and merging conditions, and determine the labeled data and non-labeled data in the original list according to the merging conditions; wherein, the original list includes at least two rows of original data groups, and the original data groups contain a number of original data; the data nodes corresponding to the original data in the same column in each row of the original data group are the same.
[0119] The second data determination module 220 is used to determine, based on the labeled data and the unlabeled data, the data to be merged corresponding to the labeled data and the unmerged data corresponding to the unlabeled data;
[0120] The merge sorting module 230 is used to merge and sort the data to be merged corresponding to the label data of the same type to generate merged data;
[0121] The list generation module 240 is used to generate a target list corresponding to the merging conditions based on the labeled data, the non-labeled data, the merged data, the non-merged data, and the original list.
[0122] In one embodiment of this application, the merging conditions include merging attributes and merging quantity, wherein the merging attribute is a specified data attribute under a specified data node; the first data determination module 210 includes:
[0123] The data acquisition submodule is used to obtain the original list and merging conditions;
[0124] The quantity determination submodule is used to determine the quantity of target data corresponding to the merged attribute in the original list;
[0125] The first data determination submodule is used to determine the labeled data and the non-labeled data based on the target data when the quantity of the target data meets the merging quantity.
[0126] In one embodiment of this application, the merging condition includes a merging node, wherein the merging node is a specified data node; the first data determination module 210 includes:
[0127] The data acquisition submodule is used to obtain the original list and merging conditions;
[0128] The first data determination submodule is used to determine the labeled data and the non-labeled data based on the target data under the specified data node.
[0129] In one embodiment of this application, the second data determination module 220 includes:
[0130] The data to be merged determination submodule is used to determine the data to be merged corresponding to the tag data based on other data that belong to the same original data group as the tag data;
[0131] The non-merged data determination submodule is used to determine the non-merged data corresponding to the non-labeled data based on other data belonging to the same original data group as the non-labeled data.
[0132] In one embodiment of this application, the list generation module 240 includes:
[0133] The mapping set generation submodule is used to generate a key-value pair mapping set based on the labeled data, the unlabeled data, the merged data, and the unmerged data;
[0134] The target list generation submodule is used to generate the target list based on the original list and the key-value pair mapping set.
[0135] In one embodiment of this application, the mapping set generation submodule includes:
[0136] The key generation submodule is used to generate keys based on the tag data and the non-tag data;
[0137] The value generation submodule is used to generate values based on the merged data and the non-merged data;
[0138] The key-value pair mapping set generation submodule is used to generate the key-value pair mapping set based on the key and the value.
[0139] In one embodiment of this application, the target list generation submodule includes:
[0140] The node determination submodule is used to determine the number of data nodes corresponding to the original data based on the original list;
[0141] The cross-cell determination submodule is used to determine the number of cells spanned by a key for each key in the key-value pair mapping set, based on the number of values corresponding to the key.
[0142] The key frame generation submodule is used to generate a key data frame based on the number of cells the key spans;
[0143] The value frame generation submodule is used to generate a value data frame based on the number of cells spanned by the key and the number of data nodes;
[0144] The key-value insertion submodule is used to insert the key into the key data frame and sequentially insert the value corresponding to the key into the value data frame to generate the target list.
[0145] Reference Figure 3 The computer device illustrating a method for merging dynamic tables according to this application may specifically include the following:
[0146] The computer device 12 described above is in the form of a general-purpose computing device. The components of the computer device 12 may include, but are not limited to: one or more processors or processing units 16, memory 28, and a bus 18 connecting different system components (including memory 28 and processing unit 16).
[0147] Bus 18 refers to one or more of several types of bus 18 architectures, including memory bus 18 or memory controller, peripheral bus 18, graphics acceleration port, processor, or local bus 18 using any of the various bus 18 architectures. For example, these architectures include, but are not limited to, Industry Standard Architecture (ISA) bus 18, Micro Channel Architecture (MAC) bus 18, Enhanced ISA bus 18, Audio / Video Electronics Standards Association (VESA) local bus 18, and Peripheral Component Interconnect (PCI) bus 18.
[0148] Computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by computer device 12, including volatile and non-volatile media, removable and non-removable media.
[0149] Memory 28 may include computer system readable media in the form of volatile memory, such as random access memory 30 and / or cache memory 32. Computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (commonly referred to as a "hard disk drive"). Although Figure 3 Not shown, a disk drive for reading and writing to a removable non-volatile disk (such as a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (such as a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. The memory may include at least one program product having a set (e.g., at least one) of program modules 42 configured to perform the functions of the embodiments of this application.
[0150] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory. Such program modules 42 include—but are not limited to—an operating system, one or more application programs, other program modules 42, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of this application.
[0151] Computer device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, camera, etc.), and with one or more devices that enable an operator to interact with the computer device 12, and / or with any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed through I / O interface 22. Furthermore, computer device 12 can also communicate with one or more networks (e.g., local area network (LAN)), wide area network (WAN), and / or public networks (e.g., the Internet) via network adapter 20. Figure 3 As shown, network adapter 20 communicates with other modules of computer device 12 via bus 18. It should be understood that, although... Figure 3 Not shown, it can be combined with computer device 12 to use other hardware and / or software modules, including but not limited to: microcode, device drivers, redundant processing unit 16, external disk drive array, RAID system, tape drive and data backup storage system 34, etc.
[0152] The processing unit 16 executes various functional applications and data processing by running programs stored in memory 28, such as implementing a dynamic table merging method provided in the embodiments of this application.
[0153] That is, when the processing unit 16 executes the above procedure, it performs the following: obtaining the original list and merging conditions, and determining the labeled data and non-labeled data in the original list according to the merging conditions; wherein, the original list includes at least two rows of original data groups, and the original data groups contain a number of original data; the data nodes corresponding to the original data in the same column in each row of the original data group are the same; determining the data to be merged corresponding to the labeled data and the non-merged data corresponding to the non-labeled data according to the labeled data and the non-labeled data; performing merge sorting on the data to be merged corresponding to the labeled data of the same type to generate merged data; and generating a target list corresponding to the merging conditions according to the labeled data, the non-labeled data, the merged data, the non-merged data, and the original list.
[0154] In one embodiment of this application, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements a dynamic table merging method as provided in all embodiments of this application.
[0155] That is, when the program is executed by the processor, it performs the following: obtaining the original list and merging conditions, and determining the labeled and unlabeled data in the original list based on the merging conditions; wherein, the original list includes at least two rows of original data groups, and the original data groups contain several original data; the data nodes corresponding to the original data in the same column in each row of the original data group are the same; based on the labeled data and the unlabeled data, determining the data to be merged corresponding to the labeled data and the data not to be merged corresponding to the unlabeled data; performing merge sorting on the data to be merged corresponding to the labeled data of the same type to generate merged data; and generating a target list corresponding to the merging conditions based on the labeled data, the unlabeled data, the merged data, the unmerged data, and the original list.
[0156] Any combination of one or more computer-readable media may be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.
[0157] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of transmitting, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0158] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof. These programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the operator's computer, partially on the operator's computer, as a standalone software package, partially on the operator's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the operator's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider). The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably.
[0159] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.
[0160] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0161] The above provides a detailed description of a dynamic table merging method, apparatus, device, and storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for merging dynamic tables, wherein the merging method is used to merge dynamic tables based on data nodes, characterized in that, include: Obtain the original list and merging conditions, and determine the labeled and unlabeled data in the original list based on the merging conditions; wherein, the original list includes at least two rows of original data groups, and each original data group contains a number of original data; the data nodes corresponding to the original data in the same column in each row of the original data group are the same; Based on the labeled data and the unlabeled data, determine the data to be merged corresponding to the labeled data and the data not to be merged corresponding to the unlabeled data in the original list; Merge and sort the data to be merged corresponding to the label data of the same type to generate merged data; Based on the labeled data, the unlabeled data, the merged data, the unmerged data, and the original list, a target list corresponding to the merging conditions is generated; this includes: generating a key-value pair mapping set based on the labeled data, the unlabeled data, the merged data, and the unmerged data; and generating the target list based on the original list and the key-value pair mapping set; wherein generating the key-value pair mapping set based on the labeled data, the unlabeled data, the merged data, and the unmerged data includes: generating keys based on the labeled data and the unlabeled data; generating values based on the merged data and the unmerged data; and generating the key-value pair mapping set based on the keys and the values.
2. The merging method according to claim 1, characterized in that, The merging conditions include merging attributes and merging quantity, wherein the merging attributes are specified data attributes under a specified data node; The step of determining the labeled and non-labeled data in the original list based on the merging conditions includes: Determine the number of target data corresponding to the merged attribute in the original list; When the quantity of the target data meets the required quantity to be merged, the labeled data and the unlabeled data are determined based on the target data.
3. The merging method according to claim 1, characterized in that, The merging conditions include the merging node, which is a specified data node; The step of determining the labeled and non-labeled data in the original list based on the merging conditions includes: Based on the target data under the specified data node, the labeled data and the unlabeled data are determined.
4. The merging method according to claim 1, characterized in that, The step of determining, based on the labeled data and the unlabeled data, the data to be merged corresponding to the labeled data and the data not to be merged corresponding to the unlabeled data in the original list includes: Based on other data in the same original data group as the tag data, determine the data to be merged corresponding to the tag data; Based on other data in the same original data group as the unlabeled data, determine the non-merged data corresponding to the unlabeled data.
5. The merging method according to claim 1, characterized in that, The step of generating the target list based on the original list and the key-value pair mapping set includes: Based on the original list, determine the number of data nodes corresponding to the original data; For each key in the key-value pair mapping set, the number of cells spanned by the key is determined based on the number of values corresponding to the key; Generate a key data frame based on the number of cells the key spans; Generate a value data frame based on the number of cells spanned by the key and the number of data nodes; The key is inserted into the key data frame, and the value corresponding to the key is sequentially inserted into the value data frame to generate the target list.
6. A merging device for dynamic tables, the merging device being used to merge dynamic tables based on data nodes, characterized in that, include: The first data determination module is used to obtain the original list and merging conditions, and determine the labeled data and non-labeled data in the original list according to the merging conditions; wherein, the original list includes at least two rows of original data groups, and the original data groups contain a number of original data; the data nodes corresponding to the original data in the same column in each row of the original data group are the same; The second data determination module is used to determine, based on the labeled data and the unlabeled data, the data to be merged corresponding to the labeled data and the data not to be merged corresponding to the unlabeled data in the original list; The merge sorting module is used to merge and sort the data to be merged corresponding to the label data of the same type, and generate merged data; A list generation module is used to generate a target list corresponding to the merging conditions based on the labeled data, the non-labeled data, the merged data, the non-merged data, and the original list; including: generating a key-value pair mapping set based on the labeled data, the non-labeled data, the merged data, and the non-merged data; and generating the target list based on the original list and the key-value pair mapping set; wherein generating the key-value pair mapping set based on the labeled data, the non-labeled data, the merged data, and the non-merged data includes: generating keys based on the labeled data and the non-labeled data; generating values based on the merged data and the non-merged data; and generating the key-value pair mapping set based on the keys and the values.
7. A computer device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Data table processing method, device, apparatus, and storage medium
CN109254969A
Data merging method and device and computer readable storage medium
CN112817919A