Data query method and device, electronic equipment and computer readable medium

By using thread variable copies and distributed cache servers to prioritize the query of institution identifiers in the institution-level relationship query within the bank, the problem of low efficiency in querying institutional affiliation relationships is solved and more efficient and accurate data queries are achieved.

CN118626487APending Publication Date: 2024-09-10CHINA CONSTRUCTION BANK +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410713642.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

When the institutional hierarchical relationships within a bank are complex, the query efficiency and accuracy of institutional affiliations are low, resulting in low data query efficiency.

Method used

By obtaining the organization ID and database ID, the thread variable copy and the distributed cache server are used to query, and the distributed cache server and database are queried first to improve the query efficiency, and when the query result is empty, the thread variable copy and the distributed cache are written. In the server, reduce direct access to the database.

Benefits of technology

It improves the efficiency and accuracy of data query of institutional affiliations, reduces the impact on database performance, and saves system transaction processing time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626487A
    Figure CN118626487A
Patent Text Reader

Abstract

The invention discloses a data query method and device, electronic equipment and a computer readable medium, and relates to the technical field of data query, and a specific implementation mode comprises the steps that in response to a data query request, a corresponding mechanism identifier and a database identifier are obtained; in response to the situation that a superior mechanism identifier corresponding to the mechanism identifier is not queried in the thread variable copy, calling a distributed cache server to query based on the mechanism identifier to obtain first query result data; in response to the fact that the first query result data is null, querying a database corresponding to the database identifier based on the mechanism identifier to obtain second query result data; in response to the fact that the second query result data is non-null, writing the second query result data into the thread variable copy and the distributed cache server; and outputting the second query result data. Therefore, the data query efficiency and accuracy when the mechanism affiliation relationship is determined can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data query technology, and in particular to a data query method, device, electronic device and computer-readable medium. Background Art

[0002] In order to better manage all branches, banks often maintain a very complex set of institutional hierarchical relationships (also known as the institutional tree). In order to isolate the business of different provinces and cities, it is often necessary to trace back from the lowest-level branches to the first- and second-level institutions to which they belong. This process is often very long, and the institutional information changes every day, which means that the institutional hierarchy may also change at any time. In this case, tracing back layer by layer will greatly affect efficiency, resulting in low data query efficiency and low accuracy. Summary of the invention

[0003] In view of this, the embodiments of the present application provide a data query method, device, electronic device and computer-readable medium, which can solve the existing problem that the layer-by-layer tracing when determining the affiliation of an organization will greatly affect the efficiency, thereby resulting in low data query efficiency and low accuracy.

[0004] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present application, a data query method is provided, including: in response to a data query request, obtaining a corresponding organization identifier and a database identifier; in response to not finding a superior organization identifier corresponding to the organization identifier in a thread variable copy, calling a distributed cache server to query based on the organization identifier to obtain first query result data; in response to the first query result data being empty, querying a database corresponding to the database identifier based on the organization identifier to obtain second query result data; in response to the second query result data being non-empty, writing the second query result data to the thread variable copy and the distributed cache server; and outputting the second query result data.

[0005] Optionally, the data query method further includes: in response to the first query result data being non-empty, writing the first query result data into the thread variable copy and outputting the first query result data.

[0006] Optionally, the data query method further includes: in response to querying a superior organization identifier corresponding to the organization identifier in the thread variable copy, outputting the queried superior organization identifier.

[0007] Optionally, the data query method further includes: determining the thread end time corresponding to the thread variable copy, calculating the time difference between the thread end time and the current time; in response to the time difference being less than a preset threshold, clearing the data in the thread variable copy.

[0008] Optionally, the data query method also includes: obtaining an organization tree, converting the data of the organization tree from columns to rows to obtain key-value pair data; and storing the key-value pair data in a distributed cache server.

[0009] Optionally, the key-value pair data includes a key and a value, wherein the key is an organization identifier and the value is a superior organization identifier corresponding to the organization identifier.

[0010] In addition, the present application also provides a data query device, including: an acquisition unit, configured to acquire a corresponding organization identifier and a database identifier in response to a data query request; a first query unit, configured to call a distributed cache server in response to not finding a superior organization identifier corresponding to the organization identifier in a thread variable copy, to query based on the organization identifier to obtain first query result data; a second query unit, configured to query a database corresponding to the database identifier based on the organization identifier in response to the first query result data being empty, to obtain second query result data; a data writing unit, configured to write the second query result data to the thread variable copy and the distributed cache server in response to the second query result data being non-empty; and an output unit, configured to output the second query result data.

[0011] Optionally, the data writing unit is further configured to: in response to the first query result data being non-empty, write the first query result data into the thread variable copy and output the first query result data.

[0012] Optionally, the output unit is further configured to: in response to finding a superior organization identifier corresponding to the organization identifier in the thread variable copy, output the found superior organization identifier.

[0013] Optionally, the data query device also includes a data clearing unit, which is configured to: determine the thread end time corresponding to the thread variable copy, calculate the time difference between the thread end time and the current time; in response to the time difference being less than a preset threshold, clear the data in the thread variable copy.

[0014] Optionally, the data query device also includes a column-to-row unit configured to: obtain the organization tree, perform column-to-row processing on the data of the organization tree to obtain key-value pair data; and store the key-value pair data in a distributed cache server.

[0015] Optionally, the key-value pair data includes a key and a value, wherein the key is an organization identifier and the value is a superior organization identifier corresponding to the organization identifier.

[0016] In addition, the present application also provides a data query electronic device, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the one or more processors implement the data query method as described above.

[0017] In addition, the present application also provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, the data query method as described above is implemented.

[0018] To achieve the above objective, according to another aspect of the embodiments of the present application, a computer program product is provided.

[0019] A computer program product according to an embodiment of the present application includes a computer program, and when the program is executed by a processor, the data query method provided by the embodiment of the present application is implemented.

[0020] One embodiment of the above invention has the following advantages or beneficial effects: the present application obtains the corresponding organization identifier and database identifier in response to a data query request; in response to not finding the superior organization identifier corresponding to the organization identifier in the thread variable copy, calls the distributed cache server to query based on the organization identifier to obtain the first query result data; in response to the first query result data being empty, queries the database corresponding to the database identifier based on the organization identifier to obtain the second query result data; in response to the second query result data being non-empty, writes the second query result data into the thread variable copy and the distributed cache server; and outputs the second query result data. Thus, the data query efficiency and accuracy when determining the organization affiliation can be improved.

[0021] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings are used to better understand the present application and do not constitute an improper limitation on the present application. Figure 1 is a schematic diagram of the main process of a data query method according to an embodiment of the present application; Figure 2 is a schematic diagram of the main process of a data query method according to an embodiment of the present application; Figure 3 It is a schematic diagram of the main process of a data query method according to an embodiment of the present application; Figure 4 is a schematic diagram of the organizational hierarchical relationship of a data query method according to an embodiment of the present application; Figure 5 is a schematic diagram of a storage structure of a data query method according to an embodiment of the present application; Figure 6 It is a schematic diagram of the main process of a data query method according to an embodiment of the present application; Figure 7 is a schematic diagram of main units of a data query device according to an embodiment of the present application; Figure 8 is an exemplary system architecture diagram to which the embodiments of the present application can be applied; Fig. 9 It is a structural diagram of a computer system of a terminal device or server suitable for implementing an embodiment of the present application. DETAILED DESCRIPTION

[0023] The following is a description of the exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, and they should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of known functions and structures is omitted in the following description. It should be noted that the acquisition, transmission, storage, use, and processing of data in the technical solution of the present application are in compliance with the relevant provisions of national laws and regulations. It should be noted that in the embodiments of the present application, certain software, components, models, and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or must have used the solution. In the technical solution of the present application, the collection, analysis, use, transmission, storage, and other aspects of the user's personal information involved are in compliance with the provisions of relevant laws and regulations, and are used for legal and reasonable purposes, and are not shared, leaked, or sold outside of these legal uses, and are subject to supervision and management by regulatory authorities. Take necessary measures to prevent illegal access to such personal information, ensure that persons with access to personal information comply with relevant laws and regulations, and ensure the security of personal information. Once such personal information is no longer needed, risks should be minimized by limiting or even prohibiting data collection and / or deleting data.

[0024] When used, including in certain related applications, user privacy is protected by de-identifying data, such as by removing specific identifiers when used, controlling the amount or specificity of data stored, controlling how data is stored, and / or other methods of de-identification.

[0025] Figure 1 is a schematic diagram of the main process of a data query method according to an embodiment of the present application, such as Figure 1 As shown, the data query method includes the following steps S101 to S105.

[0026] Step S101, in response to a data query request, obtaining a corresponding institution identifier and a database identifier.

[0027] In this embodiment, the execution subject of the data query method (for example, a server) can receive the data query request through a wired connection or a wireless connection. After receiving the data query request, the execution subject can obtain the organization identifier carried in the request, which is used to represent the number or name of a subordinate organization such as a branch, and can obtain the database identifier, which can be used to represent the number or name of the database to be queried, etc.

[0028] Step S102, in response to not finding the superior organization identifier corresponding to the organization identifier in the thread variable copy, calling the distributed cache server to query based on the organization identifier to obtain first query result data.

[0029] After obtaining the organization identifier and database identifier carried in the data query request, the execution subject can first query whether there is a corresponding superior organization identifier in the thread variable copy, so as to effectively reduce the impact on database performance caused by frequent direct interactions with the database. If the superior organization identifier corresponding to the organization identifier is not found in the thread variable copy, the second priority distributed cache server is called again to find whether there is a superior organization identifier corresponding to the organization identifier in the corresponding distributed cache, and output the corresponding query result data as the first query result data.

[0030] Specifically, the data query method also includes: obtaining an organization tree, converting the data of the organization tree into columns and rows to obtain key-value pair data; and storing the key-value pair data in a distributed cache server.

[0031] In the distributed cache server, key-value pair data after column-to-row conversion is stored. The key-value pair data is obtained by converting the organization tree corresponding to various organizations and is a mapping relationship data consisting of an organization identifier (for example, an organization number) and all superior organizations of the organization. The execution subject can store the obtained key-value pair data in the distributed cache server in advance for subsequent use, thereby speeding up data query.

[0032] Specifically, the key-value pair data includes a key and a value, wherein the key is an organization identifier and the value is a parent organization identifier corresponding to the organization identifier.

[0033] Step S103, in response to the first query result data being empty, query the database corresponding to the database identifier based on the institution identifier to obtain the second query result data.

[0034] If the first query result data is empty, it means that the superior institution identifier corresponding to the institution identifier is not found in the distributed cache server. Then further query is performed on the database with the third priority, specifically, the corresponding superior institution identifier can be queried from the database corresponding to the database identifier based on the institution identifier, so as to use the obtained query result data as the second query result data. By querying the database as the third priority, it can effectively prevent too many direct queries to the database when receiving a data query request, so as to minimize the impact on the database performance, and also save more system transaction processing time.

[0035] Step S104: in response to the second query result data being non-empty, writing the second query result data into the thread variable replica and the distributed cache server.

[0036] When the second query result data is non-empty, it indicates that the superior institution identifier corresponding to the institution identifier has been queried in the database, and the second query result data is the superior institution identifier corresponding to the institution identifier. At this time, the second query result data needs to be written into the thread variable copy and the distributed cache server, so that the next time the same data query request arrives, the desired superior institution identifier can be quickly and directly obtained from the thread variable copy or the distributed cache server, thereby speeding up data query speed, reducing the impact on database performance, and saving more system transaction processing time.

[0037] Specifically, the data query method also includes: determining the thread end time corresponding to the thread variable copy, calculating the time difference between the thread end time and the current time; in response to the time difference being less than a preset threshold, clearing the data in the thread variable copy.

[0038] For example, the data in the thread variable copy ThreadLocal is cleared before the thread corresponding to the thread variable copy ends to avoid memory leaks.

[0039] Step S105, outputting the second query result data.

[0040] When the second query result data is not empty, the second query result data is the superior institution identifier corresponding to the institution identifier, and the superior institution identifier is output.

[0041] This embodiment obtains the corresponding organization identifier and database identifier in response to a data query request; in response to not finding the superior organization identifier corresponding to the organization identifier in the thread variable copy, calls the distributed cache server to query based on the organization identifier to obtain the first query result data; in response to the first query result data being empty, queries the database corresponding to the database identifier based on the organization identifier to obtain the second query result data; in response to the second query result data being non-empty, writes the second query result data into the thread variable copy and the distributed cache server; and outputs the second query result data. This can improve the data query efficiency and accuracy when determining the organization affiliation.

[0042] Figure 2 is a schematic diagram of the main flow of a data query method according to an embodiment of the present application, such as Figure 2 As shown, the data query method includes the following steps S201 to S206.

[0043] Step S201, in response to a data query request, obtain a corresponding institution identifier and a database identifier.

[0044] The data query request can be a request to query the affiliation of an organization. First, the known organization identifier in the data query request and whether the organization identifier is at a lower level or a higher level in the affiliation of the organization can be obtained, so as to determine the direction of the data query, whether to query the lower level organization or the higher level organization. The embodiment of the present application is explained by taking the query to the higher level organization as an example. The execution subject can also obtain the database identifier carried in the data query request, and can specifically determine the database for the bottom query based on the database identifier.

[0045] Step S202, in response to not finding the superior organization identifier corresponding to the organization identifier in the thread variable copy, calling the distributed cache server to query based on the organization identifier to obtain first query result data.

[0046] The first query result data is the number of households in the query result based on the organization identifier in the distributed cache server. The next execution logic can be determined according to whether the first query result data is empty.

[0047] Step S203, in response to the first query result data being empty, query the database corresponding to the database identifier based on the institution identifier to obtain the second query result data.

[0048] If the first query result data is empty, it indicates that there is no superior organization identifier corresponding to the organization identifier in the distributed cache server, and therefore it is necessary to query the underlying database to obtain the second query result data from the database.

[0049] Step S204: in response to the second query result data being non-empty, writing the second query result data into the thread variable copy and the distributed cache server.

[0050] When the second query data is not empty, the second query data is the superior organization identifier corresponding to the queried organization identifier, and the superior organization identifier can be the number or name of the superior organization, etc. The embodiment of the present application does not specifically limit the superior organization identifier. The second query result data (that is, the superior organization identifier corresponding to the organization identifier) ​​is written into the thread variable copy and the distributed cache server.

[0051] Step S205: output the second query result data.

[0052] Step S206 , in response to the first query result data being non-empty, writing the first query result data into the thread variable copy and outputting the first query result data.

[0053] When the first query result data is not empty, it indicates that the superior institution identifier corresponding to the institution identifier has been queried in the distributed cache server, and the first query result data is the queried superior institution identifier. The execution subject can write the first query result data (i.e., the superior institution identifier) ​​into the thread variable copy, so that when the same data query request is received later, the corresponding superior institution identifier can be quickly and accurately obtained directly from the thread variable copy, thereby speeding up the data query speed, improving the accuracy of the data query, reducing the impact on the database performance, and saving more system transaction processing time.

[0054] Figure 3 is a schematic diagram of the main flow of a data query method according to an embodiment of the present application, such as Figure 3 As shown, the data query method includes the following steps S301 to S306.

[0055] Step S301, in response to a data query request, obtain a corresponding institution identifier and a database identifier.

[0056] Step S302, in response to finding the superior organization identifier corresponding to the organization identifier in the thread variable copy, outputting the found superior organization identifier.

[0057] The thread variable copy is the first priority for data query. When the superior institution identifier corresponding to the institution identifier is directly queried in the thread variable copy, there is no need to query the data stored in the second priority distributed cache server, nor is there any need to query the data stored in the third priority database, thereby speeding up data query, improving data query accuracy, reducing the impact on database performance, and saving more system transaction processing time.

[0058] Step S303, in response to not finding the superior organization identifier corresponding to the organization identifier in the thread variable copy, calling the distributed cache server to query based on the organization identifier to obtain first query result data.

[0059] When the superior organization identifier corresponding to the organization identifier is not found in the first priority thread variable copy, it is necessary to query the data stored in the second priority distributed cache server to obtain the first query result data.

[0060] Step S304, in response to the first query result data being empty, query the database corresponding to the database identifier based on the institution identifier to obtain the second query result data.

[0061] When the first query result data is empty, it is necessary to query the data stored in the third priority database to obtain the second query result data.

[0062] Step S305 , in response to the second query result data being non-empty, writing the second query result data into the thread variable copy and the distributed cache server.

[0063] When the second query result data is not empty, the second query result data is the superior organization identifier corresponding to the organization identifier, and the superior organization identifier needs to be written into the thread variable copy and the distributed cache server for subsequent data query.

[0064] Step S306, outputting the second query result data.

[0065] Output the second query result data, that is, output the superior institution identifier corresponding to the institution identifier.

[0066] Figure 4 This is a diagram of the institutional hierarchical relationship of a data query method according to an embodiment of the present application. The present application embodiment implements data query based on a cache tool for complex hierarchical management of banking institutions. The tool converts all the data in the institution tree into rows and caches the latest data in Redis, using key-value pairs for storage, where the Key is the institution number of the institution and the Value is all the superior institutions of the institution. For example, Figure 4As shown, the institutional hierarchy can be represented by an institutional tree from outlets, branches to the head office. The specific institutional hierarchy relationship can be: the root node is the head office, the first-level branch A and the first-level branch B are the child nodes of the root node (head office), the second-level branch A1 and the second-level branch A2 are the child nodes of the parent node (first-level branch A), the second-level branch B1 and the second-level branch B2 are the child nodes of the parent node (first-level branch B), outlet 1 is the child node of the parent node (second-level branch A1), outlet 2 is the child node of the parent node (second-level branch A2), outlet 3 is the child node of the parent node (second-level branch B1), and outlet 4 is the child node of the parent node (second-level branch B2).

[0067] After putting the organization hierarchy data into the Redis cache, the storage structure is as follows Figure 5 As shown, Figure 5 FIG. 1 is a schematic diagram of a storage structure of a data query method according to an embodiment of the present application. Figure 5 In the storage structure shown, the Key is branch 1, and the corresponding Value is second-level branch A1, first-level branch A, and head office; the Key is branch 2, and the corresponding Value is second-level branch A2, first-level branch A, and head office; the Key is branch 3, and the corresponding Value is second-level branch B1, first-level branch B, and head office; the Key is branch 4, and the corresponding Value is second-level branch B2, first-level branch B, and head office. When the application system needs to query the hierarchical relationship of an organization, it first uses the current organization number as the Key to find the corresponding Value in Redis, and then puts the queried value into ThreadLocal (thread variable copy). Then, if the subsequent steps in the same thread still involve querying the hierarchical relationship of an organization, there is no need to access the Redis server (distributed cache server) again, but only needs to obtain data from ThreadLocal (thread variable copy).

[0068] Figure 6 It is a main flow diagram of a data query method according to an embodiment of the present application. In the embodiment of the present application, ThreadLocal: refers to a mechanism in which each thread has its own independent copy of a variable in a multi-threaded environment, and the variable copies between threads do not affect each other, and each thread has its own independent copy of the variable, thereby ensuring thread safety; Redis: refers to an open source log-type, Key-Value database written in ANSI C language, supporting the network, memory-based and persistent, and providing APIs in multiple languages. It is also a high-performance key-value pair storage system with fast, flexible and scalable characteristics.

[0069] like Figure 6 As shown, the data query process can be shown as follows (1)-(4): (1) Check whether there is a copy of the hierarchical relationship of the organization in ThreadLocal (thread variable copy) (that is, determine whether there is a value). If so, return directly; if not, proceed to step (2); (2) Check whether there is cache data of the hierarchical relationship of the organization in the Redis cache (distributed cache) (i.e., determine whether there is a value). If so, write the data into ThreadLocal (thread variable copy) and return directly; if not, proceed to step (3); (3) Query the data of organizational hierarchical relationships in the database, write the data to ThreadLocal (thread variable copy) and Redis server (distributed cache server) at the same time, and then return; (4) Clear the data in ThreadLocal (thread variable copy) before the thread ends to avoid memory leaks.

[0070] The embodiment of the present application establishes a mechanism for caching the hierarchical relationship of banking institutions to achieve rapid tracing of institutional relationships, effectively reduce the CPU usage of the database server, reduce the overhead of the distributed cache server, and improve the transaction processing efficiency of the application system. A more complete institutional hierarchical management mechanism is established, which makes the institutional hierarchical relationship clearer at a glance, and can quickly trace the relevant information of the superior institution corresponding to the subordinate institutions such as outlets, improve the tracing efficiency, and facilitate the superior institution's management of its subordinate institutions. It can effectively reduce the interaction between the application system and the database and distributed cache server, greatly reducing the performance overhead of the database and distributed cache server; more use of the data of the thread variable copy is performed in the memory area of ​​the application system for logical processing, improving the system transaction processing performance, reducing transaction time, and supporting higher TPS.

[0071] Figure 7 Schematic diagram of the main units of the data query device according to an embodiment of the present application. Figure 7 As shown, the data query device 700 includes an acquisition unit 701 , a first query unit 702 , a second query unit 703 , a data writing unit 704 and an output unit 705 .

[0072] The acquisition unit 701 is configured to acquire the corresponding institution identifier and database identifier in response to a data query request.

[0073] The first query unit 702 is configured to call the distributed cache server to query based on the organization identifier in response to not finding the superior organization identifier corresponding to the organization identifier in the thread variable copy to obtain first query result data.

[0074] The second query unit 703 is configured to query the database corresponding to the database identifier based on the institution identifier in response to the first query result data being empty, so as to obtain the second query result data.

[0075] The data writing unit 704 is configured to write the second query result data into the thread variable replica and the distributed cache server in response to the second query result data being non-empty.

[0076] The output unit 705 is configured to output the second query result data.

[0077] In some embodiments, the data writing unit 704 is further configured to: in response to the first query result data being non-null, write the first query result data into the thread variable copy and output the first query result data.

[0078] In some embodiments, the output unit 705 is further configured to: in response to finding a superior organization identifier corresponding to the organization identifier in the thread variable copy, output the found superior organization identifier.

[0079] In some embodiments, the data query device further includes Figure 7 The data clearing unit not shown in the figure is configured to: determine the thread end time corresponding to the thread variable copy, calculate the time difference between the thread end time and the current time; in response to the time difference being less than a preset threshold, clear the data in the thread variable copy.

[0080] In some embodiments, the data query device further includes Figure 7 The column-to-row unit not shown in the figure is configured to: obtain the organization tree, perform column-to-row processing on the data of the organization tree to obtain key-value pair data; and store the key-value pair data in the distributed cache server.

[0081] In some embodiments, the key-value pair data includes a key and a value, wherein the key is an organization identifier and the value is a parent organization identifier corresponding to the organization identifier.

[0082] It should be noted that the data query method and the data query device of the present application have a corresponding relationship in terms of specific implementation contents, so the repeated contents will not be described again.

[0083] Figure 8 An exemplary system architecture 800 to which the data query method or data query device according to the embodiment of the present application can be applied is shown.

[0084] like Figure 8As shown, system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. Network 804 is used to provide a medium for communication links between terminal devices 801, 802, 803 and server 805. Network 804 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0085] Users can use terminal devices 801, 802, and 803 to interact with server 805 through network 804 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 801, 802, and 803, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).

[0086] The terminal devices 801 , 802 , and 803 may be various electronic devices having a data query processing screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0087] Server 805 can be a server that provides various services, such as a background management server that provides support for data query requests submitted by users using terminal devices 801, 802, and 803 (only as an example). The background management server can respond to the data query request and obtain the corresponding organization identifier and database identifier; in response to not finding the superior organization identifier corresponding to the organization identifier in the thread variable copy, call the distributed cache server to query based on the organization identifier to obtain the first query result data; in response to the first query result data being empty, query the database corresponding to the database identifier based on the organization identifier to obtain the second query result data; in response to the second query result data being non-empty, write the second query result data into the thread variable copy and the distributed cache server; and output the second query result data. This can improve the efficiency and accuracy of data query when determining the affiliation of organizations.

[0088] It should be noted that the data query method provided in the embodiment of the present application is generally executed by the server 805 , and accordingly, the data query device is generally arranged in the server 805 .

[0089] It should be understood that Figure 8 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.

[0090] Reference below Fig. 9 , which shows a schematic diagram of the structure of a computer system 900 of a terminal device suitable for implementing an embodiment of the present application. Fig. 9The terminal device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0091] like Fig. 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the computer system 900 are also stored. The CPU 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0092] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage section 908 as needed.

[0093] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the above-mentioned functions defined in the system of the present application are executed.

[0094] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. Computer-readable storage media may include, for example, but are not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0095] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0096] The units involved in the embodiments described in the present application may be implemented by software or by hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes an acquisition unit, a first query unit, a second query unit, a data writing unit, and an output unit. The names of these units do not constitute limitations on the units themselves in some cases.

[0097] As another aspect, the present application also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device responds to a data query request and obtains the corresponding organization identifier and database identifier; in response to not finding the superior organization identifier corresponding to the organization identifier in the thread variable copy, calling the distributed cache server to query based on the organization identifier to obtain the first query result data; in response to the first query result data being empty, querying the database corresponding to the database identifier based on the organization identifier to obtain the second query result data; in response to the second query result data being non-empty, writing the second query result data into the thread variable copy and the distributed cache server; and outputting the second query result data.

[0098] The computer program product of the present application includes a computer program, and when the computer program is executed by a processor, the data query method in the embodiment of the present application is implemented.

[0099] According to the technical solution of the embodiment of the present application, the data query efficiency and accuracy when determining the affiliation of institutions can be improved.

[0100] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.

Claims

1. A data query method, characterized in that: include: In response to a data query request, obtaining a corresponding institution identifier and a database identifier; In response to not finding the superior organization identifier corresponding to the organization identifier in the thread variable copy, calling the distributed cache server to perform a query based on the organization identifier to obtain first query result data; In response to the first query result data being empty, querying a database corresponding to the database identifier based on the institution identifier to obtain second query result data; In response to the second query result data being non-empty, writing the second query result data into the thread variable copy and the distributed cache server; The second query result data is output.

2. The method according to claim 1, characterized in that The method further comprises: In response to the first query result data being non-empty, writing the first query result data into the thread variable copy and outputting the first query result data.

3. The method according to claim 1, characterized in that The method further comprises: In response to finding the superior organization identifier corresponding to the organization identifier in the thread variable copy, the found superior organization identifier is output.

4. The method according to claim 1, characterized in that: The method further comprises: Determine the thread end time corresponding to the thread variable copy, and calculate the time difference between the thread end time and the current time; In response to the time difference being less than a preset threshold, clearing the data in the thread variable copy.

5. The method according to claim 1, characterized in that The method further comprises: Obtain an organization tree, and perform column-to-row processing on data of the organization tree to obtain key-value pair data; The key-value pair data is stored in a distributed cache server.

6. The method according to claim 5, characterized in that The key-value pair data includes a key and a value, wherein the key is an organization identifier, and the value is a superior organization identifier corresponding to the organization identifier.

7. A data query device, characterized in that: include: An acquisition unit, configured to acquire a corresponding institution identifier and a database identifier in response to a data query request; A first query unit is configured to, in response to not finding a superior organization identifier corresponding to the organization identifier in the thread variable copy, call the distributed cache server to query based on the organization identifier to obtain first query result data; A second query unit is configured to query the database corresponding to the database identifier based on the institution identifier in response to the first query result data being empty, so as to obtain second query result data; a data writing unit, configured to write the second query result data into the thread variable replica and the distributed cache server in response to the second query result data being non-empty; The output unit is configured to output the second query result data.

8. The device according to claim 7, characterized in that The data writing unit is further configured to: In response to the first query result data being non-empty, writing the first query result data into the thread variable copy and outputting the first query result data.

9. The device according to claim 7, characterized in that The output unit is further configured to: In response to finding the superior organization identifier corresponding to the organization identifier in the thread variable copy, the found superior organization identifier is output.

10. The device according to claim 7, characterized in that The device also includes a data clearing unit configured to: Determine the thread end time corresponding to the thread variable copy, and calculate the time difference between the thread end time and the current time; In response to the time difference being less than a preset threshold, clearing the data in the thread variable copy.

11. The device according to claim 7, characterized in that The device further includes a column-to-row unit configured to: Obtain an organization tree, and perform column-to-row processing on data of the organization tree to obtain key-value pair data; The key-value pair data is stored in a distributed cache server.

12. The device according to claim 11, characterized in that The key-value pair data includes a key and a value, wherein the key is an organization identifier, and the value is a superior organization identifier corresponding to the organization identifier.

13. A data query electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

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

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