A data processing method and device, electronic equipment, medium and program product

By comparing the target level with the baseline level and using different query strategies to query the database and relational mapping table, the database I/O problem caused by different access permissions in the construction of the tree structure is solved, thereby improving the construction efficiency and system stability.

CN116719794BActive Publication Date: 2026-04-14CHINA CONSTRUCTION BANK +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-16
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing tree-structure construction methods require rebuilding the tree based on different access permissions, leading to database I/O problems and low efficiency when querying large amounts of data.

Method used

By comparing the target level with the baseline level, different query strategies are used to query the database and relational mapping table to generate the relational mapping table, reducing database I/O problems and omitting the step of rebuilding the tree.

Benefits of technology

This reduces database I/O operations under different access permissions, improves the efficiency of tree structure construction and system stability, and reduces resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116719794B_ABST
    Figure CN116719794B_ABST
Patent Text Reader

Abstract

The application discloses a data processing method and device, electronic equipment, medium and program product, and relates to the technical field of big data. The method comprises the following steps: obtaining a target level to be accessed; comparing the target level with a preset reference level; determining a query strategy according to a comparison result, querying a database and / or a relationship mapping table according to the query strategy, and obtaining node information corresponding to the target level, wherein the relationship mapping table is generated based on node identifiers and node objects of the reference level and each level below the reference level. According to the technical scheme of the application, the relationship mapping table is generated based on the reference level and the node identifiers and node objects of each level below the reference level, different query strategies are adopted to obtain corresponding node information for the target level above and below the reference level, the database IO problem of a large number of queries is reduced, and the step of re-establishing a tree due to different access permissions each time is omitted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of big data technology, and in particular to a data processing method, apparatus, electronic device, medium and program product. Background Technology

[0002] Currently, tree structures are commonly used to represent the relationships between certain data, such as using a tree structure to represent the relationships between data at six levels: province, city, county, town, village, and person.

[0003] The tree structure construction method of related technologies is as follows: 1) Obtain the original data, loop through it to find the child data of the root node, and return the result set. 2) During the loop, use the node identifier of the matched node data as a condition to recursively traverse downwards and repeat step 1). 3) Traverse until all data is matched, and the tree structure construction is completed.

[0004] However, the tree-structure construction method in related technologies requires rebuilding the tree each time the access permissions are different. In addition, it also causes database I / O problems when querying large amounts of data. Summary of the Invention

[0005] This invention provides a data processing method, apparatus, electronic device, medium, and program product that can solve the problem of needing to rebuild the tree due to different access permissions, and also solve the IO problem of querying a large number of databases.

[0006] In a first aspect, embodiments of the present invention provide a data processing method, including:

[0007] Get the target level to be accessed;

[0008] Compare the target level with a preset baseline level;

[0009] Based on the comparison results, a query strategy is determined, and the database and / or relational mapping table are queried according to the query strategy to obtain the node information corresponding to the target level. The relational mapping table is generated based on the node identifiers and node objects of the base level and each level below the base level.

[0010] Secondly, embodiments of the present invention also provide a data processing apparatus, comprising:

[0011] The layer retrieval module is used to retrieve the target layer to be accessed;

[0012] A hierarchy comparison module is used to compare the target hierarchy with a preset baseline hierarchy;

[0013] The node query module is used to determine a query strategy based on the comparison results, and query the database and / or relation mapping table according to the query strategy to obtain the node information corresponding to the target level. The relation mapping table is generated based on the node identifiers and node objects of the base level and each level below the base level.

[0014] Thirdly, embodiments of the present invention also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the data processing method as described in any of the embodiments of the present invention.

[0015] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data processing method as described in any of the embodiments of the present invention.

[0016] Fifthly, embodiments of the present invention also provide a computer program product, including a computer program that, when executed by a processor, implements the data processing method as described in any of the embodiments of the present invention.

[0017] This invention provides a data processing method, apparatus, electronic device, medium, and program product. Based on a baseline level and the node identifiers and node objects of each level below the baseline level, a relational mapping table is generated. Different query strategies are used for the target levels above and below the baseline level to obtain the corresponding node information, thereby reducing the database I / O problem of a large number of queries and omitting the step of rebuilding the tree due to different access permissions each time. Attached Figure Description

[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 A flowchart of a data processing method provided in an embodiment of the present invention;

[0020] Figure 2 A schematic diagram of an original dataset list provided in an embodiment of the present invention;

[0021] Figure 3 A flowchart of another data processing method provided in an embodiment of the present invention;

[0022] Figure 4This is a schematic diagram of the root result set in a data processing method provided in an embodiment of the present invention;

[0023] Figure 5 This is a schematic diagram of the sub-node data structure in a data processing method provided by an embodiment of the present invention;

[0024] Figure 6 This is a flowchart illustrating the rapid generation of a tree structure in a data processing method provided by an embodiment of the present invention;

[0025] Figure 7 This is a schematic diagram of the structure of a data processing device provided in an embodiment of the present invention;

[0026] Figure 8 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0027] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.

[0028] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this invention, terms such as "first," "second," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance. The acquisition, storage, use, and processing of data in the technical solutions of this application all comply with the relevant provisions of national laws and regulations.

[0029] Figure 1 This is a flowchart illustrating a data processing method provided in an embodiment of the present invention. This method is applicable to scenarios involving large datasets where a tree structure can be rapidly constructed and node data queried. The method can be executed by a data processing device, which can be implemented in hardware and / or software and is typically housed in an electronic device. For example, the electronic device may include a computer or server. Figure 1 As shown, the method includes:

[0030] S110, Obtain the target level to be accessed.

[0031] The target level refers to the level of the data to be accessed within the business data. For example, if the business data has six levels: province, city, county, town, village, and person, then the target level is village to access village-level data, and city-level data to access city-level data.

[0032] For example, obtaining the target level to be accessed includes: obtaining the level value of the target level to be accessed, wherein the level value is used to represent the level information of the target data in the original business data.

[0033] It should be noted that hierarchy values ​​are pre-defined for each level of the original business data, representing each level. For example, if the original business data includes 5 levels, with hierarchy values ​​of 0 for the first level, 1 for the second, 2 for the third, 3 for the fourth, and 4 for the fifth, then if the target level to be accessed is the third level, the hierarchy value for that target level would be 2.

[0034] S120. Compare the target level with the preset benchmark level.

[0035] The base level can be a pre-set level parameter, and a tree structure is constructed for the base level and all levels below the base level.

[0036] For example, comparing the target level with a preset benchmark level includes: comparing the level value of the target level with the level value of the preset benchmark level to obtain a comparison result, wherein the comparison result includes the target level being higher than the benchmark level but not the level preceding the benchmark level, the target level being the level preceding the benchmark level, and the target level being equal to or lower than the benchmark level.

[0037] S130. Determine the query strategy based on the comparison results, and query the database and / or relational mapping table according to the query strategy to obtain the node information corresponding to the target level.

[0038] The query strategy can be a rule for querying node information corresponding to a target level. The query strategy can be determined by comparing the target level and the baseline level. For example, the query strategy includes: if the comparison result shows that the target level is higher than the baseline level but not the level preceding the baseline level, querying the database based on the level value of the target level using lazy loading; if the comparison result shows that the target level is the level preceding the baseline level, first retrieving a list of node identifiers whose parent node is the target level from the database, and then querying the relationship mapping table based on the list of node identifiers; if the target level is equal to or lower than the baseline level, querying the relationship mapping table based on the node identifiers of the target level.

[0039] The relationship mapping table is generated based on the node identifiers and node objects of the base level and all levels below it.

[0040] Optionally, before obtaining the target level to be accessed, the method further includes: obtaining the level value of the base level and each level below the base level; querying the database based on the level value to obtain the node objects of the base level and each level below the base level; and generating a relationship mapping table based on the level value and the node objects.

[0041] Optionally, generating a relationship mapping table based on the hierarchy value and the node object includes: determining a key based on the node identifier, determining a value based on the node object, and generating the relationship mapping table in key-value form, wherein the node identifier is a string containing the hierarchy value of the current node.

[0042] Specifically, the process involves retrieving the level values ​​of the baseline level and all levels below it from the original business data. Then, the database is queried based on these level values ​​to obtain the data for all levels below the baseline level, which forms the original dataset. Each data point in the original dataset has attributes such as a node ID and a parent node ID. For example, the node ID can be a string containing the level value of the current node, and the parent node ID can be a string representing the parent node of the current node. The original dataset can be sorted in ascending order of level to obtain a list of original datasets. Figure 2 This is a schematic diagram of an original dataset list provided in an embodiment of the present invention, such as... Figure 2 As shown, the original dataset list is traversed, and a node is retrieved from the head of the list at each traversal. A relational mapping record is generated based on the node's ID and the memory reference of the node object, and this record is inserted into the relational mapping table. The node object can include the current node ID, parent node ID, whether a subset exists, and a list of subsets. The memory address of the node object can be used as the value, and the node identifier as the key, generating the relational mapping record in key-value format. Since each traversal of the original dataset list involves retrieving a node from the head, generating a relational mapping record for that node ID, and inserting it into the relational mapping table, this process continues until the entire original dataset list is traversed, resulting in the relational mapping table. This relational mapping table is then stored in memory and declared as a static variable. Therefore, for a node ID existing in the relational mapping table, the node object can be directly retrieved from memory, avoiding a database query.

[0043] Optionally, after generating the relationship mapping table in key-value format, the method further includes: if the node identifier and / or node object changes, updating the relationship mapping table according to the changed level value or node object. If the node identifier changes, updating the relationship mapping record in the original relationship mapping table according to the new node identifier yields a new relationship mapping table. If the node object changes, querying the original relationship mapping table based on the node identifier to obtain the node object, and updating the queried node object according to the new node object yields a new relationship mapping table. If both the node identifier and the node object change, updating the relationship mapping record in the original relationship mapping table according to the new node identifier and node object yields a new relationship mapping table.

[0044] In some embodiments, when the comparison result is that the target level is higher than the baseline level but not the level preceding the baseline level, the query strategy includes querying the database based on the level value of the target level using lazy loading; and querying the database according to the query strategy to obtain the node information corresponding to the target level.

[0045] Lazy loading can be either delayed loading or on-demand loading. For example, it can be used to query a database to obtain a layer of data based on demand.

[0046] Specifically, if the target level of the current access is C and the base level is L, and C < L and C ! = L - 1, then the database data is queried using lazy loading. Each query returns data for one level. For example, C = 0 represents the target level as provincial level, L = 2 represents the target level as county level, and there exists a case where C < L and C ! = L - 1. Therefore, the database data is queried using lazy loading to obtain the provincial level data from the database.

[0047] In other embodiments, when the comparison result indicates that the target level is the level preceding the baseline level, the query strategy includes retrieving a list of node identifiers whose parent nodes are at the target level from the database; querying a relationship mapping table based on the list of node identifiers; querying the database according to the query strategy to obtain a list of node identifiers whose parent nodes are at the target level; querying the relationship mapping table based on the list of node identifiers to obtain node objects that match the list of node identifiers; and using the node objects at the target level and the node objects that match the node identifiers as the node information corresponding to the target level.

[0048] Specifically, if the target level is C and the base level is L, and C = L - 1, the system first finds a list of node identifiers with parent node identifier Pid = C in the database. Then, it queries the relational mapping table for all L-level nodes that match the node identifier list. For example, if C = 1 represents a city-level target level and L = 2 represents a county-level target level, and C = L - 1 exists, the system first finds a list of IDs for city-level parent nodes in the database. Based on each ID in the list, it queries the relational mapping table to obtain all matching county-level nodes. The system then queries the database to obtain the node objects for the city-level nodes. These city-level and county-level node objects are used as the node information returned when accessing the city-level node.

[0049] In other embodiments, when the target level is equal to or lower than the base level, the query strategy is to query the relationship mapping table based on the node identifier of the target level; query the relationship mapping table according to the query strategy to obtain the node objects and child node list of the target level; and use the node objects and child node list of the target level as the node information corresponding to the target level.

[0050] Specifically, if the target level is C and the base level is L, and C >= L, then the node with id C is found in the relational mapping table, and its child nodes are returned. For example, C=2 represents a target level of county, L=2 represents a target level of county, and C=L exists. The relational mapping table is queried based on the node id of the county-level node to obtain the county-level node and its child nodes. C=3 represents a target level of town, L=2 represents a target level of county, and C>L exists. The relational mapping table is queried based on the node id of the town-level node to obtain the town-level node and its child nodes.

[0051] It should be noted that the relationship mapping table is stored in memory as a static variable. When there is an access requirement, the relationship mapping table can be queried by node ID, saving the problem of having to recreate the tree structure every time the access permissions are different.

[0052] This invention generates a relational mapping table based on the node identifiers and node objects of the baseline level and the levels below it. Different query strategies are used for the target levels above and below the baseline level to obtain the corresponding node information, thereby reducing the database I / O problem of a large number of queries and omitting the step of rebuilding the tree due to different access permissions each time.

[0053] Figure 3 This is a flowchart illustrating another data processing method provided in an embodiment of the present invention. This embodiment, based on the above embodiments, further specifies the method for constructing the tree structure. For example... Figure 3 As shown, the method includes:

[0054] S301. Obtain the base level and the level values ​​of each level below the base level.

[0055] For example, hierarchy values ​​are pre-set for different levels of data. After determining the baseline hierarchy, the hierarchy values ​​of the baseline hierarchy and all levels below it are obtained.

[0056] S302. Query the database based on the level value to obtain the base level and the node objects of each level below the base level.

[0057] For example, the database is queried based on the level value to obtain the base level and the nodes of each level below the base level. Based on the hierarchical relationship of the nodes, the parent node and child nodes are determined, and a subset list consisting of each child node of the parent node is determined.

[0058] S303. Determine the key based on the node identifier, determine the value based on the node object, and generate a relational mapping table in key-value format, wherein the node identifier is a string containing the hierarchy value of the current node.

[0059] For example, a relationship mapping table is generated using node identifiers as keys and memory references of node objects as values, in a key-value format. The memory reference can be the memory address of the node object.

[0060] S304. Determine whether the target node is a top-level node based on its level value. If it is, execute S305; otherwise, execute S306.

[0061] For example, the level value of the target node can represent the hierarchical relationship of the data, and the level value can be used to determine whether the target node is a top-level node.

[0062] S305. Add the top-level node to the root result set, wherein the root result set is used to store the root node of the tree structure.

[0063] Figure 4 This is a schematic diagram of the root result set in a data processing method provided in an embodiment of the present invention. Figure 4 As shown, the root result set node list includes node 1 and node 2, as well as the node object 'node1id' referenced in memory for node 1, and the node object 'node2id' referenced in memory for node 2. The data structure of the node objects is as follows:

[0064] node nid Where n = 1, 2, 3, ...

[0065] If the target node is a top-level node, then the target node is placed in the root result set, and in the relation mapping table, the node ID of the target node is used as the key, and the value is the node object of the target node (the value points to a memory address).

[0066] S306. Obtain the parent node identifier of the target node, query the relationship mapping table based on the parent node identifier to obtain the parent node of the target node, and add the node object of the target node to the subset list of the parent node.

[0067] Figure 5 This is a schematic diagram of the sub-node data structure in a data processing method provided by an embodiment of the present invention. For example... Figure 5 As shown, add node 1-1id to the subset list of node 1id, and add node 1-2id to the subset list of node 1id.

[0068] S307. Obtain new target nodes from the base level and the levels below the base level according to the hierarchical relationship, and return to execute the determination of whether the target node is a top-level node based on the hierarchical value of the target node, until the base level and all levels below the base level have been traversed.

[0069] For example, if the target node has a parent node and the parent node object can be found in the relational mapping table, the parent node object is retrieved from the relational mapping table based on the parent node's node ID, and it is determined whether the parent node has a subset list. If the subset list does not exist, a new subset list is created, the `haschild` field of the parent node is set to `true`, and the target node is inserted into the parent node's subset list. If the base level and all levels below it have not been traversed, the above steps are repeated to reduce the time and resource consumption for generating the tree structure. Due to the existing tree structure construction method, there is no record of processed nodes. If a node is already in the parent level, subsequent recursive traversal and logical judgment of it are useless. Furthermore, in deep tree structures, stack overflow problems can easily occur due to excessively deep call stacks.

[0070] S308. Obtain the target level to be accessed.

[0071] S309. Compare the target level with the preset baseline level.

[0072] S310. Determine a query strategy based on the comparison results, and query the database and / or relational mapping table according to the query strategy to obtain the node information corresponding to the target level. The relational mapping table is generated based on the node identifiers and node objects of the base level and each level below the base level.

[0073] In this embodiment of the invention, target nodes are obtained from the base level and the levels below the base level according to the hierarchical relationship. If the target node is a top-level node, the target node is added to the root result set. Otherwise, the relationship mapping table is queried according to the parent node identifier of the target node to obtain the parent node. The node object of the target node is added to the subset list of the parent node. By combining the relationship mapping table in a loop, the problem of recursive calls consuming system resources is solved, the system stability is improved, and a tree structure is generated quickly with less memory usage.

[0074] Figure 6 This is a flowchart illustrating the rapid generation of a tree structure in a data processing method provided by an embodiment of the present invention. For example... Figure 6 As shown, the method includes:

[0075] S601, Begin.

[0076] S602. Determine whether the original dataset list has been traversed. If yes, execute S609; otherwise, execute S603.

[0077] S603, pop up the head node of the original dataset list.

[0078] S604. Generate a relationship mapping record based on the node ID and node object of the head node, and insert the relationship mapping record into the relationship mapping table.

[0079] S605. Determine whether the head node is a top-level node. If yes, execute S606; otherwise, execute S607.

[0080] S606. Add the header node to the root result set.

[0081] S607. Obtain the parent node identifier of the head node, and query the relationship mapping table based on the parent node identifier to obtain the node object of the parent node.

[0082] S608. Add the head node to the subset list contained in the node object of the parent node, and return to execute S602.

[0083] S609, Output the root result set.

[0084] The embodiments of the present invention use a single loop traversal combined with a relational mapping table to replace the recursive traversal method, which can reduce the time and resource consumption for generating tree structures, and improve the generation speed of tree structures and user experience.

[0085] Figure 7This is a schematic diagram of a data processing apparatus provided in an embodiment of the present invention. This apparatus can execute the data processing method described in any embodiment of the present invention. The apparatus can be implemented in hardware and / or software and is typically housed in an electronic device. For example, the electronic device may include a computer or a server, etc. Figure 7 As shown, the device includes: a hierarchy acquisition module 710, a hierarchy comparison module 720, and a node query module 730.

[0086] The layer acquisition module 710 is used to acquire the target layer to be accessed.

[0087] The hierarchical comparison module 720 is used to compare the target hierarchical level with a preset benchmark hierarchical level;

[0088] The node query module 730 is used to determine a query strategy based on the comparison results, and query the database and / or relation mapping table according to the query strategy to obtain the node information corresponding to the target level. The relation mapping table is generated based on the node identifiers and node objects of the base level and each level below the base level.

[0089] This invention provides a data processing device that generates a relational mapping table based on a baseline level and the node identifiers and node objects of each level below the baseline level. Different query strategies are used for the target levels above and below the baseline level to obtain the corresponding node information, thereby reducing the database I / O problem of a large number of queries and omitting the step of rebuilding the tree due to different access permissions each time.

[0090] Optionally, the device further includes:

[0091] The mapping table generation module is used to obtain the base level and the level values ​​of each level below the base level before obtaining the target level to be accessed; query the database according to the level values ​​to obtain the node objects of the base level and each level below the base level; and generate a relationship mapping table according to the level values ​​and node objects.

[0092] Further, generating a relationship mapping table based on the hierarchy value and node objects includes:

[0093] The key is determined based on the node identifier, and the value is determined based on the node object. A relationship mapping table is generated in key-value format, where the node identifier is a string containing the hierarchy value of the current node.

[0094] Optionally, the device further includes:

[0095] The mapping table update module is used to update the relationship mapping table according to the changed hierarchy value or node object after the node identifier and / or node object changes, once the relationship mapping table is generated in key-value form.

[0096] Optionally, the device further includes:

[0097] The tree creation module is used to determine whether a target node is a top-level node based on its hierarchy value after generating a relational mapping table in key-value form.

[0098] If so, the top-level node is added to the root result set, where the root result set is used to store the root node of the tree structure;

[0099] Otherwise, obtain the parent node identifier of the target node, query the relationship mapping table based on the parent node identifier to obtain the parent node of the target node, and add the node object of the target node to the subset list of the parent node.

[0100] Furthermore, the device also includes:

[0101] The target node update module is used to add the node object of the target node to the subset list of the parent node, obtain a new target node from the base level and the levels below the base level according to the hierarchical relationship, and return to execute to determine whether the target node is a top-level node based on the level value of the target node, until the base level and all levels below the base level have been traversed.

[0102] Optionally, the hierarchy acquisition module 710 is specifically used for:

[0103] Obtain the level value of the target level to be accessed, wherein the level value is used to represent the level information of the target data in the original business data.

[0104] Optionally, the hierarchy comparison module 720 is specifically used for, including:

[0105] The level value of the target level is compared with the level value of the preset benchmark level to obtain a comparison result. The comparison result includes the target level being higher than the benchmark level but not the level preceding the benchmark level, the target level being the level preceding the benchmark level, and the target level being equal to or lower than the benchmark level.

[0106] Optionally, the node query module 730 is specifically used for:

[0107] If the comparison result is that the target level is higher than the baseline level but not the level preceding the baseline level, the query strategy includes querying the database based on the level value of the target level using lazy loading.

[0108] The database is queried according to the query strategy to obtain the node information corresponding to the target level.

[0109] Specifically, the node query module 730 is also used for:

[0110] If the comparison result indicates that the target level is the level preceding the baseline level, the query strategy includes retrieving a list of node identifiers whose parent node is the target level from the database, and querying the relationship mapping table based on the list of node identifiers.

[0111] The database is queried according to the query strategy to obtain a list of node identifiers whose parent node is the target level;

[0112] The relationship mapping table is queried based on the node identifier list to obtain the node object that matches the node identifier list;

[0113] The node objects of the target level and the node objects matched in the node identifier table are used as the node information corresponding to the target level.

[0114] Optionally, the node query module 730 is also specifically used for:

[0115] When the target level is equal to or lower than the base level, the query strategy is to query the relationship mapping table based on the node identifier of the target level.

[0116] The relationship mapping table is queried according to the query strategy to obtain the node objects and child node list of the target level;

[0117] The node objects and child node list of the target level are used as the node information corresponding to the target level.

[0118] The data processing apparatus provided in the embodiments of the present invention can execute the data processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.

[0119] Figure 8 This is a structural block diagram of an electronic device provided for an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0120] like Figure 8As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0121] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0122] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as access control methods.

[0123] In some embodiments, the access control method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the access control method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the access control method by any other suitable means (e.g., by means of firmware).

[0124] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0125] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0126] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0127] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0128] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0129] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the data processing method provided in any embodiment of this application.

[0130] In implementing the computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages ​​or a combination thereof. 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 user's computer, partially on the user's computer, as a standalone software package, partially on the user'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 user'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).

[0131] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.

Claims

1. A data processing method, characterized in that, include: Get the target level to be accessed; Compare the target level with a preset baseline level; The query strategy is determined based on the comparison results. The database and / or relational mapping table are queried according to the query strategy to obtain the node information corresponding to the target level. The relational mapping table is generated based on the node identifiers and node objects of the base level and each level below the base level. The comparison of the target level with the preset benchmark level includes: The level value of the target level is compared with the level value of the preset benchmark level to obtain a comparison result. The comparison result includes the target level being higher than the benchmark level but not the level preceding the benchmark level, the target level being the level preceding the benchmark level, and the target level being equal to or lower than the benchmark level. The step of determining the query strategy based on the comparison results includes: If the comparison result is that the target level is higher than the baseline level but not the level preceding the baseline level, the query strategy includes querying the database based on the level value of the target level using lazy loading. If the comparison result indicates that the target level is the level preceding the baseline level, the query strategy includes retrieving a list of node identifiers whose parent node is the target level from the database, and querying the relationship mapping table based on the list of node identifiers. When the target level is equal to or lower than the base level, the query strategy is to query the relationship mapping table based on the node identifier of the target level.

2. The method according to claim 1, characterized in that, Before obtaining the target level to be accessed, the following steps are also included: Obtain the base level and the level values ​​of each level below the base level; The database is queried based on the level value to obtain the base level and the node objects of each level below the base level; A relationship mapping table is generated based on the hierarchy value and node objects.

3. The method according to claim 2, characterized in that, The step of generating a relationship mapping table based on the hierarchy value and node objects includes: The key is determined based on the node identifier, and the value is determined based on the node object. A relationship mapping table is generated in key-value format, where the node identifier is a string containing the hierarchy value of the current node.

4. The method according to claim 3, characterized in that, After generating the relational mapping table in key-value format, the following is also included: If the node identifier and / or node object changes, the relationship mapping table is updated according to the changed hierarchy value or node object.

5. The method according to claim 3, characterized in that, After generating the relational mapping table in key-value format, the following is also included: Determine whether the target node is a top-level node based on its hierarchical value; If so, the top-level node is added to the root result set, where the root result set is used to store the root node of the tree structure; Otherwise, obtain the parent node identifier of the target node, query the relationship mapping table based on the parent node identifier to obtain the parent node of the target node, and add the node object of the target node to the subset list of the parent node.

6. The method according to claim 5, characterized in that, After adding the node object of the target node to the subset list of the parent node, the method further includes: According to the hierarchical relationship, new target nodes are obtained from the base level and the levels below the base level. Then, the execution is returned to determine whether the target node is a top-level node based on the level value of the target node, until the base level and all levels below the base level have been traversed.

7. The method according to claim 1, characterized in that, The process of obtaining the target level to be accessed includes: Obtain the level value of the target level to be accessed, wherein the level value is used to represent the level information of the target data in the original business data.

8. The method according to claim 1, characterized in that, If the comparison result indicates that the target level is higher than the baseline level but not the level preceding the baseline level, the database and / or relational mapping table are queried according to the query strategy to obtain the node information corresponding to the target level, including: The database is queried according to the query strategy to obtain the node information corresponding to the target level.

9. The method according to claim 1, characterized in that, If the comparison result indicates that the target level is one level above the baseline level, the database and / or relational mapping table are queried according to the query strategy to obtain the node information corresponding to the target level, including: The database is queried according to the query strategy to obtain a list of node identifiers whose parent node is the target level; The relationship mapping table is queried based on the node identifier list to obtain the node object that matches the node identifier list; The node objects of the target level and the node objects matched in the node identifier table are used as the node information corresponding to the target level.

10. The method according to claim 1, characterized in that, When the target level is equal to or lower than the baseline level, the database and / or relational mapping table are queried according to the query strategy to obtain the node information corresponding to the target level, including: The relationship mapping table is queried according to the query strategy to obtain the node objects and child node list of the target level; The node objects and child node list of the target level are used as the node information corresponding to the target level.

11. A data processing apparatus, characterized in that, include: The layer retrieval module is used to retrieve the target layer to be accessed; A hierarchy comparison module is used to compare the target hierarchy with a preset baseline hierarchy; The node query module is used to determine a query strategy based on the comparison results, and query the database and / or relation mapping table according to the query strategy to obtain the node information corresponding to the target level. The relation mapping table is generated based on the node identifiers and node objects of the base level and each level below the base level. The hierarchical comparison module is specifically used for: The level value of the target level is compared with the level value of the preset benchmark level to obtain a comparison result. The comparison result includes the target level being higher than the benchmark level but not the level preceding the benchmark level, the target level being the level preceding the benchmark level, and the target level being equal to or lower than the benchmark level. The node query module is specifically used for: If the comparison result is that the target level is higher than the baseline level but not the level preceding the baseline level, the query strategy includes querying the database based on the level value of the target level using lazy loading. If the comparison result indicates that the target level is the level preceding the baseline level, the query strategy includes retrieving a list of node identifiers whose parent node is the target level from the database, and querying the relationship mapping table based on the list of node identifiers. When the target level is equal to or lower than the base level, the query strategy is to query the relationship mapping table based on the node identifier of the target level.

12. An electronic device, characterized in that, The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the computer program, implements the data processing method as described in any one of claims 1-10.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the data processing method as described in any one of claims 1-10.

14. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the data processing method as described in any one of claims 1-10.

Citation Information

Patent Citations

  • Information query method and device, terminal and storage medium

    CN110210034A

  • Data recommendation method and device, computer equipment and storage medium

    CN111382352A