Data query method, device, equipment and storage medium

By preconfiguring the relationship between the service type and the database table on the server, dynamic data query statements are generated, and the problem of repeated development and inefficiency of query on the multi-interface server is solved, and efficient data query is achieved.

CN113779120BActive Publication Date: 2025-08-19BEIJING JINGDONG TUOXIAN TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110128096.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-29
Publication Date
2025-08-19
Estimated Expiration
2041-01-29

AI Technical Summary

Technical Problem

In the prior art, multi-interface servers need to be repeatedly developed when adding new business functions, and the composite query statements lead to a reduction in server query efficiency, and the return of redundant data fields affects performance.

Method used

By preconfiguring the correspondence between the service type and the database table on the server, a dynamic data query statement is generated, redundant fields are eliminated, and only the data fields specified by the caller are returned.

Benefits of technology

It improves the processing speed of server query services, reduces the workload of developers, and improves the query efficiency of servers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113779120B_ABST
    Figure CN113779120B_ABST
Patent Text Reader

Abstract

The present application provides a data query method, apparatus, device, and storage medium, wherein the method includes: a server receives a data query request through a composite interface, wherein the composite interface provides query services for multiple business data, and the data query request is used to indicate the business type and field information of the data to be queried. The server generates a data query statement corresponding to the field information indicated by the data query request based on the data query request, and obtains and returns the data corresponding to the field information indicated by the data query request by executing the data query statement. In the above method, the data query statement does not contain redundant data fields, and the returned data fields only include the source data corresponding to the data fields indicated by the data query request, which can greatly improve the processing speed of the server query business.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a data query method, apparatus, device, and storage medium. Background Art

[0002] Currently, in common operating systems, enterprise resource planning (ERP) systems, or B-to-business (B2B) application systems, the server of the same data source can provide multiple query service interfaces to the outside world, and different query service interfaces respectively implement data queries for different business functions.

[0003] When a new business function is added to the server side of the above multiple interfaces, a new interface needs to be redeveloped, resulting in a high degree of duplication between the multiple interfaces. In response, some systems use a large and comprehensive interface to implement all business function queries, generating complex query statements.

[0004] However, compound query statements will return all database source fields to the calling end, resulting in reduced query efficiency of the server. Summary of the Invention

[0005] The embodiments of the present application provide a data query method, apparatus, device, and storage medium to improve the query efficiency of a server.

[0006] A first aspect of an embodiment of the present application provides a data query method, including:

[0007] receiving a data query request through a composite interface, wherein the composite interface provides query services for multiple business data, and the data query request indicates the business type and field information of the data to be queried;

[0008] generating a data query statement corresponding to the field information according to the data query request;

[0009] By executing the data query statement, the data corresponding to the field information is obtained and returned.

[0010] In one embodiment of the present application, generating a data query statement corresponding to the field information according to the data query request includes:

[0011] Determining a database table corresponding to the business type according to the business type of the data to be queried in the data query request;

[0012] Determining a query path for the field information of the data to be queried based on the database table and the field information in the data query request;

[0013] The data query statement is generated according to the query path.

[0014] In one embodiment of the present application, determining the database table corresponding to the data type according to the business type of the data to be queried in the data query request includes:

[0015] Receive the correspondence between pre-configured business types and database tables;

[0016] According to the pre-configured correspondence between the business type and the database table and the business type of the data to be queried, the database table corresponding to the business type of the data to be queried is determined.

[0017] In one embodiment of the present application, the data query statement is a structured query language SQL statement; before executing the data query statement, the method further includes:

[0018] Preload the generated data query statement.

[0019] Optionally, the field information includes at least one attribute field of the data to be queried.

[0020] In one embodiment of the present application, if the field information includes multiple attribute fields of the data to be queried; determining the query path for the field information of the data to be queried based on the database table and the field information in the data query request includes:

[0021] Determining a query order for the multiple attribute fields and a query path for each attribute field according to the database table and the field information in the data query request;

[0022] The query path of the field information of the data to be queried is determined according to the query order of the multiple attribute fields and the query path of each attribute field.

[0023] In one embodiment of the present application, the method further includes:

[0024] Receive configuration information of a new service, where the configuration information is used to indicate a correspondence between the new service type and a database table, and the query of the new service reuses the composite interface;

[0025] According to the configuration information, the correspondence between the pre-configured service types and the database table is updated.

[0026] A second aspect of an embodiment of the present application provides a data query device, including:

[0027] A receiving module, configured to receive a data query request through a composite interface, wherein the composite interface provides query services for multiple business data, and the data query request indicates the business type and field information of the data to be queried;

[0028] A processing module, configured to generate a data query statement corresponding to the field information according to the data query request;

[0029] The sending module is used to obtain and return the data corresponding to the field information by executing the data query statement.

[0030] In one embodiment of the present application, the processing module is specifically configured to:

[0031] Determining a database table corresponding to the business type according to the business type of the data to be queried in the data query request;

[0032] Determining a query path for the field information of the data to be queried based on the database table and the field information in the data query request;

[0033] The data query statement is generated according to the query path.

[0034] In one embodiment of the present application, the receiving module is further configured to receive a correspondence between a pre-configured service type and a database table;

[0035] The processing module is further configured to determine the database table corresponding to the business type of the data to be queried according to the pre-configured correspondence between the business type and the database table and the business type of the data to be queried.

[0036] In one embodiment of the present application, the data query statement is a structured query language SQL statement; and before executing the data query statement, the processing module is further configured to:

[0037] Preload the generated data query statement.

[0038] Optionally, the field information includes at least one attribute field of the data to be queried.

[0039] In one embodiment of the present application, if the field information includes multiple attribute fields of the data to be queried; the processing module is specifically configured to:

[0040] Determining a query order for the multiple attribute fields and a query path for each attribute field according to the database table and the field information in the data query request;

[0041] The query path of the field information of the data to be queried is determined according to the query order of the multiple attribute fields and the query path of each attribute field.

[0042] In one embodiment of the present application, the data query device further includes: an update module;

[0043] The receiving module is further configured to receive configuration information of a new service, wherein the configuration information is used to indicate a correspondence between the new service type and a database table, and the query of the new service reuses the composite interface;

[0044] The updating module is used to update the correspondence between the pre-configured service types and the database table according to the configuration information.

[0045] A third aspect of the embodiments of the present application provides an electronic device, including:

[0046] Memory;

[0047] processor; and

[0048] computer programs;

[0049] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in any one of the first aspects of the present application.

[0050] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement a method as described in any one of the first aspects of the present application.

[0051] A fifth aspect of an embodiment of the present application provides a computer program product, including a computer program, which implements any method according to the first aspect of the present application when executed by a processor.

[0052] The embodiments of the present application provide a data query method, apparatus, device, and storage medium, wherein the method includes: a server receives a data query request through a composite interface, wherein the composite interface provides query services for multiple business data, and the data query request is used to indicate the business type and field information of the data to be queried. The server generates a data query statement corresponding to the field information indicated by the data query request based on the data query request, and obtains and returns the data corresponding to the field information indicated by the data query request by executing the data query statement. In the above method, the data query statement does not contain redundant data fields, and the returned data fields only include the source data corresponding to the data fields indicated by the data query request, which can greatly improve the processing speed of the server query business. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0054] Figure 1 Interface diagram for existing data interface query method Figure 1 ;

[0055] Figure 2 Interface diagram for existing data interface query method Figure 2 ;

[0056] Figure 3 A flowchart of a data query method provided in an embodiment of the present application;

[0057] Figure 4 This is a schematic diagram of the interface for the data query method provided in the embodiment of the present application;

[0058] Figure 5 A flowchart of the data query interface function update provided in an embodiment of the present application;

[0059] Figure 6 Schematic diagram of the structure of the data query device provided in the embodiment of the present application Figure 1 ;

[0060] Figure 7 Schematic diagram of the structure of the data query device provided in the embodiment of the present application Figure 2 ;

[0061] Figure 8 This is a hardware structure diagram of the electronic device provided in an embodiment of the present application.

[0062] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION

[0063] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0064] It should be understood that the terms "include" and "have" and any variations thereof as used herein are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus that includes a series of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, product or apparatus.

[0065] For servers using the same data source, there are two main existing technical solutions for providing external query services. One is to provide a query interface service for each business function. This query approach requires developers to develop a separate query interface service based on the data to be displayed, and both the calling end and the server need to jointly debug the new interface service. The other is to reuse a query interface service for multiple business functions, that is, to unify the query interface service to meet the data queries of related businesses. This query approach can reduce the number of times developers need to jointly debug the interface service.

[0066] For example, Figure 1 This is an illustration of the existing data interface query method. Figure 1 ,like Figure 1 As shown, the server provides a variety of query services, including item query services, inventory query services, and item + inventory query services. The caller can call the item query interface service provided by the server to conduct item-related queries, such as querying the price, size, and evaluation of an item. The caller can also call the inventory query interface service provided by the server to conduct inventory-related queries, such as querying the total inventory quantity, total outbound quantity, and total inbound quantity of inventory items. The caller can also call the item + inventory query interface service provided by the server to conduct queries related to specified items, such as querying the inventory quantity, outbound quantity, and inbound quantity of a specified item. The multiple query interface services provided by the server share the same data source, namely the item + inventory database, and each query interface service corresponds to a query service.

[0067] For example, Figure 2 This is an illustration of the existing data interface query method. Figure 2 ,like Figure 2 As shown, the server also provides a variety of query services, including item query service, inventory query service, item + inventory query service, etc. The server provides a unified query interface service. The caller can query related items, inventory items, or specific items by calling the unified query interface service. Figure 1 Unlike the data interface query method shown above, the query interface service provided by the server can query all business functions. The query statement it generates is typically a composite query statement. Upon executing this composite query statement, the server returns all the query data obtained to the caller, often resulting in redundant data fields. For example, if the caller requests information about a specific item, because the query interface provided by the server is a composite interface, the query statement generated by the server includes queries for all business functions. This means that in addition to information about the item, it also includes inventory information. The server will return all data fields related to the item to the caller.

[0068] In the first example above, the same data source requires the development of multiple different interfaces to meet different business data queries. The disadvantage of this solution is that it causes a lot of repetitive development work. When the data source changes, all interfaces need to be changed and modified. When new business functions are connected, a new interface needs to be redeveloped, and each interface has a high degree of repetition and overlap.

[0069] In the second example above, all business data queries are implemented through a large and comprehensive interface, and all database source fields are returned to the calling end. The disadvantage of this solution is that each interface will query redundant data fields, reducing server execution performance and affecting query efficiency. When the data source changes, the interface also needs to be modified and modified. Some business functions do not require multi-table cascade queries, but redundant database tables will still be queried, seriously reducing response efficiency and server performance.

[0070] In response to the above problems, an embodiment of the present application provides a data query method, which transfers the business function of the data interface to the calling end, and the calling end indicates the data type and data field to be queried. By pre-configuring the correspondence between the business type and the database table, as well as the association between the database tables on the server side, the server side assembles the data query statement corresponding to the query request according to the above pre-configured information after receiving the query request sent by the calling end. The assembled data query statement eliminates redundant data fields, and the data fields returned to the calling end will not have redundant data fields, thereby improving the processing speed of the server side and improving the efficiency of data query. For developers, there is no need to repeatedly develop new interfaces, only to configure the rules corresponding to the new business on the server side, which greatly improves the development efficiency of the server and reduces the workload of developers.

[0071] The following specific embodiments are used to describe the technical solution of the present application in detail. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0072] Figure 3 The data query method provided in this embodiment can be applied to any server (or server) with data query function, which includes one or more database tables for storing data of different business types.

[0073] like Figure 3 As shown, the data query method provided in this embodiment includes the following steps:

[0074] Step 101: Receive a data query request through a composite interface.

[0075] The composite interface provides query services for multiple business data, and the data query request indicates the business type and field information of the data to be queried.

[0076] The query service provided by the composite interface of this embodiment corresponds to the same data source or the same database. The database may include one or more database tables, and there is an association relationship between the multiple database tables.

[0077] For example, the composite interface provides services such as item query and item inventory query. The database table corresponding to the item query service is the item table, which stores attribute information of different items, such as price, size, and review information. The database table corresponding to the item inventory query service is the inventory table, which stores inventory information of different items, such as import and export data and current inventory data. The item table and the inventory table are associated with each other.

[0078] The service type indicated by the data query request in this embodiment is any of the multiple service types provided by the server. It should be understood that the database tables corresponding to different service types may overlap. For example, the item query service corresponds to the item table, the item inventory query service corresponds to the inventory table, and the item + inventory query service corresponds to the item table and the inventory table.

[0079] Step 102: Generate a data query statement corresponding to the field information according to the data query request.

[0080] In one embodiment of the present application, the server may generate a data query statement corresponding to the field information in the data query request in the following manner:

[0081] Step 1021: Determine the database table corresponding to the business type according to the business type of the data to be queried in the data query request.

[0082] Step 1022: Determine a query path for the field information of the data to be queried based on the database table and the field information in the data query request.

[0083] Step 1023: Generate a data query statement according to the query path.

[0084] The server of this embodiment is pre-configured with a correspondence between business types and database tables. The server receives the pre-configured correspondence between business types and database tables, and determines the database table corresponding to the business type of the data to be queried based on the pre-configured correspondence between business types and database tables and the business type of the data to be queried.

[0085] Optionally, one business type may correspond to one database table or multiple database tables, and this embodiment of the present application does not impose any limitation on this.

[0086] Exemplarily, data of business type 1 is stored in database table 1, data of business type 2 is stored in database table 2, and data of business type 3 is stored in both database table 1 and database table 3. It should be understood that data query of business type 3 includes querying database table 1 and database table 3. Database table 1 and database table 3 may be queried simultaneously, or sequentially in a preset query order, for example, querying database table 3 after querying database table 1. This embodiment of the present application does not impose any limitation on the query order.

[0087] In this embodiment, the field information in the data query request includes at least one attribute field of the data to be queried.

[0088] In one embodiment of the present application, the field information in the data query request includes an attribute field of the data to be queried. Based on the database table and the attribute field, the query path of the attribute field of the data to be queried is determined, that is, the location information of the attribute field in the database table is determined, and then based on the query path, a data query statement is generated. The data query statement is used to obtain the source data of the attribute field from the database table.

[0089] In one embodiment of the present application, the field information in the data query request includes multiple attribute fields of the data to be queried. Determining a query path for the field information of the data to be queried based on the database table and the field information in the data query request specifically includes:

[0090] Based on the database table and the field information in the data query request, the query order of the multiple attribute fields and the query path for each attribute field are determined; based on the query order of the multiple attribute fields and the query path for each attribute field, the query path for the field information of the data to be queried is determined. In this embodiment, the source data of the multiple attribute fields in the data query request may be located in the same database table or in different database tables. Therefore, it is necessary to determine the database table corresponding to the source data of each attribute field, and determine the association relationship between the database tables based on pre-configured information, thereby determining the query order of the source data of each attribute field and generating a data query statement. The data query statement is used to obtain the source data of the multiple attribute fields from the database table.

[0091] The server of this embodiment automatically generates query statements corresponding to different data query requests based on the association relationships of pre-configured database tables and the association relationships between attribute fields. The query statements only contain the specified data fields that need to be returned, reducing the query volume on the server side and improving the processing speed of the server query business.

[0092] Step 103: Obtain data corresponding to the field information from the database by executing a data query statement.

[0093] In this embodiment, the data query statement can be a structured query language SQL statement. SQL statements are a language used to operate on databases, and can be used to create or delete databases, create or delete database tables, add or delete columns, add or delete primary keys of database tables, create or delete indexes, etc.

[0094] Optionally, in some embodiments, before executing the data query statement, the following step may be included: pre-loading the generated data query statement, mainly to prevent SQL injection problems.

[0095] Among them, SQL injection refers to the web application's failure to judge the legitimacy of user input data or lax filtering. Attackers can add additional SQL statements to the end of pre-defined query statements in the web application, performing illegal operations without the administrator's knowledge, thereby deceiving the database server into executing unauthorized arbitrary queries and further obtaining corresponding data information.

[0096] Step 104: Return the data corresponding to the field information.

[0097] In the data query method provided by an embodiment of the present application, a server receives a data query request via a composite interface, wherein the composite interface provides query services for multiple business data. The data query request is used to indicate the business type and field information of the data to be queried. Based on the data query request, the server generates a data query statement corresponding to the field information indicated by the data query request. By executing the data query statement, the server obtains and returns the data corresponding to the field information indicated by the data query request. In the above method, the data query statement does not contain redundant data fields, and the returned data fields only include the source data corresponding to the data fields indicated by the data query request, thereby improving the processing speed of the server query service.

[0098] For example, Figure 4 This is a schematic diagram of the interface of the data query method provided in the embodiment of the present application, such as Figure 4As shown, the server provides a variety of query services, including item query, inventory query, and item + inventory query. The server provides a unified query interface service, through which the caller can conduct item-related queries, item inventory-related queries, or queries related to specified items. Unlike existing data interface query methods, the server in this embodiment receives a query request from the caller. This query request is a query request processed by the caller, that is, the query request sent by the caller specifies the business type and field information of the data to be queried. Based on the processed query request and pre-configured information, the server generates a dynamic data query statement. This dynamic data query statement eliminates redundant data fields and only includes the data fields specified in the caller's query request. By executing the data query statement, the source data for the data fields specified in the query request is retrieved from the database table and returned to the caller.

[0099] For example, the calling end requests to query information about an item, and the calling end sends a query request to the server. The query request is used to indicate the item query service and the attribute fields of the item. The server determines the database table corresponding to the item query service, such as the item library, based on the item query service type indicated by the query request. The server obtains the source data corresponding to the attribute fields from the database table based on the attribute fields of the item indicated by the query request, such as the price, size and other attribute data of an item in the item library.

[0100] Based on the above embodiment, if the server needs to add new business functions, such as adding electronic voucher inquiry services, new product inquiry services, order inquiry services, etc., and the new business functions overlap with the data in the current database table of the server, the business functions of the server can be updated through the following embodiments.

[0101] For example, Figure 5 A flowchart of the data query interface function update provided in the embodiment of the present application, such as Figure 5 As shown, the update process includes the following steps:

[0102] Step 201: Receive configuration information of a new service, where the configuration information is used to indicate the correspondence between the new service type and the database table.

[0103] Among them, the query of the new business reuses the composite interface.

[0104] Step 202: Update the correspondence between the pre-configured business types and the database table according to the configuration information.

[0105] In one embodiment of the present application, the data corresponding to the new service is associated with the data in the existing database table of the server, the configuration information includes the correspondence between the new service type and the existing database table, and the query interface of the new service reuses the original composite interface.

[0106] For example, the newly added business function is the electronic voucher query business. It should be understood that there is an association between electronic vouchers and items. Therefore, there is an association between the new business type and the existing item library. An electronic voucher list can be added to the item library, and different items correspond to the same or different electronic vouchers.

[0107] Based on the above example, developers do not need to develop a new query interface. By combining the existing query interface and configuring the correspondence between the new business type and the existing database table, the server can automatically generate data query statements corresponding to the new business type based on the updated configuration information, realize the query of the new business, and improve the development efficiency of the server.

[0108] Optionally, in some embodiments, the data corresponding to the new business has no association with the data in the existing database table of the server. The configuration information includes the correspondence between the new business type and the new database table, and an interface can be redefined for new business queries.

[0109] For example, a new service feature, such as order query, requires a new interface to provide order query services. Furthermore, an order table must be created in the database to record the execution status of different user orders. Before a new service goes online, the server receives configuration information for the new service, including the mapping between order services and order tables. This allows the service to automatically generate data query statements corresponding to the new service type based on the new configuration information, enabling queries for the new service and improving server development efficiency.

[0110] The embodiment of the present application illustrates the update process of new business functions on the server side. By reusing the interface and updating the configuration information, the new business data is associated with the existing database table, so that the server side automatically generates data query statements corresponding to the new query business based on the updated configuration information, thereby improving the query efficiency of the new business data.

[0111] The embodiment of the present application can divide the functional modules of the data query device according to the above method embodiment. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation. The following is an example of dividing each functional module corresponding to each function.

[0112] Figure 6 Schematic diagram of the structure of the data query device provided in the embodiment of the present application Figure 1 .like Figure 6 As shown, the data query device 300 provided in this embodiment includes: a receiving module 301 , a processing module 302 and a sending module 303 .

[0113] A receiving module 301 is configured to receive a data query request through a composite interface, wherein the composite interface provides query services for multiple business data, and the data query request indicates the business type and field information of the data to be queried;

[0114] A processing module 302 is configured to generate a data query statement corresponding to the field information according to the data query request;

[0115] The sending module 303 is used to obtain and return the data corresponding to the field information by executing the data query statement.

[0116] In one embodiment of the present application, the processing module 302 is specifically configured to:

[0117] Determining a database table corresponding to the business type according to the business type of the data to be queried in the data query request;

[0118] Determining a query path for the field information of the data to be queried based on the database table and the field information in the data query request;

[0119] The data query statement is generated according to the query path.

[0120] In one embodiment of the present application, the receiving module 301 is further configured to receive a correspondence between a pre-configured service type and a database table;

[0121] The processing module 302 is further configured to determine the database table corresponding to the business type of the data to be queried according to the pre-configured correspondence between the business type and the database table and the business type of the data to be queried.

[0122] In one embodiment of the present application, the data query statement is a structured query language SQL statement; before executing the data query statement, the processing module 302 is further configured to:

[0123] Preload the generated data query statement.

[0124] Optionally, the field information includes at least one attribute field of the data to be queried.

[0125] In one embodiment of the present application, if the field information includes multiple attribute fields of the data to be queried; the processing module 302 is specifically configured to:

[0126] Determining a query order for the multiple attribute fields and a query path for each attribute field according to the database table and the field information in the data query request;

[0127] The query path of the field information of the data to be queried is determined according to the query order of the multiple attribute fields and the query path of each attribute field.

[0128] Figure 7 Schematic diagram of the structure of the data query device provided in the embodiment of the present application Figure 2 .exist Figure 6 Based on the device shown, Figure 7 As shown, the data query device 300 provided in this embodiment further includes: an updating module 304.

[0129] The receiving module 301 is further configured to receive configuration information of a new service, wherein the configuration information is used to indicate a correspondence between the new service type and a database table, and the query of the new service reuses the composite interface;

[0130] The updating module 304 is configured to update the correspondence between the pre-configured service types and the database table according to the configuration information.

[0131] The data query device provided in this embodiment can execute the technical solution of any of the above method embodiments. Its implementation principles and technical effects are similar and will not be repeated here.

[0132] Figure 8 The hardware structure diagram of the electronic device provided in the embodiment of the present application is as follows: Figure 8 As shown, the electronic device 400 provided in this embodiment includes:

[0133] Memory 401;

[0134] Processor 402; and

[0135] computer programs;

[0136] Among them, the computer program is stored in the memory 401 and is configured to be executed by the processor 402 to implement the technical solution of any of the above method embodiments. Its implementation principles and technical effects are similar and will not be repeated here.

[0137] Optionally, the memory 401 can be independent or integrated with the processor 402. When the memory 401 is a device independent of the processor 402, the electronic device 400 further includes a bus 403 for connecting the memory 401 and the processor 402.

[0138] The embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by the processor 402 to implement the technical solution in any of the aforementioned method embodiments.

[0139] An embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the technical solution in any of the aforementioned method embodiments.

[0140] An embodiment of the present application further provides a chip, including: a processing module and a communication interface, wherein the processing module can execute the technical solution in the aforementioned method embodiment.

[0141] Furthermore, the chip also includes a storage module (such as a memory), the storage module is used to store instructions, the processing module is used to execute the instructions stored in the storage module, and the execution of the instructions stored in the storage module enables the processing module to execute the technical solution in the aforementioned method embodiment.

[0142] It should be understood that the processor described above may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), or application-specific integrated circuits (ASICs). A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly executed by a hardware processor or by a combination of hardware and software modules within the processor.

[0143] The memory may include a high-speed RAM memory, and may also include non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk.

[0144] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be classified into address buses, data buses, and control buses. For ease of illustration, the buses in the drawings of this application are not limited to just one bus or just one type of bus.

[0145] The storage medium may be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0146] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and storage medium can be located in an application-specific integrated circuit (ASIC). Of course, the processor and storage medium can also exist as discrete components in an electronic device.

[0147] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A data query method, characterized in that: include: receiving a data query request through a composite interface, wherein the composite interface provides query services for multiple business data, and the data query request indicates the business type and field information of the data to be queried; Determining a database table corresponding to the business type according to the business type of the data to be queried in the data query request; Determining a query path for the field information of the data to be queried based on the database table and the field information in the data query request; Generate a data query statement according to the query path; By executing the data query statement, the data corresponding to the field information is obtained and returned; If the field information includes multiple attribute fields of the data to be queried; The determining, based on the database table and the field information in the data query request, a query path for the field information of the data to be queried includes: Determining a query order for the multiple attribute fields and a query path for each attribute field according to the database table and the field information in the data query request; The query path of the field information of the data to be queried is determined according to the query order of the multiple attribute fields and the query path of each attribute field.

2. The method according to claim 1, characterized in that The determining, according to the business type of the data to be queried in the data query request, a database table corresponding to the business type includes: Receive the correspondence between pre-configured business types and database tables; According to the pre-configured correspondence between the business type and the database table and the business type of the data to be queried, the database table corresponding to the business type of the data to be queried is determined.

3. The method according to claim 1, characterized in that The data query statement is a structured query language SQL statement; before executing the data query statement, the method further includes: Preload the generated data query statement.

4. The method according to any one of claims 1 to 3, characterized in that The field information includes at least one attribute field of the data to be queried.

5. The method according to claim 2, characterized in that The method further comprises: Receive configuration information of a new service, where the configuration information is used to indicate a correspondence between a new service type and a database table, and the query of the new service reuses the composite interface; According to the configuration information, the correspondence between the pre-configured service types and the database table is updated.

6. A data query device, characterized in that: include: A receiving module, configured to receive a data query request through a composite interface, wherein the composite interface provides query services for multiple business data, and the data query request indicates the business type and field information of the data to be queried; A processing module, configured to determine a database table corresponding to a business type according to the business type of the data to be queried in the data query request; Determining a query path for the field information of the data to be queried based on the database table and the field information in the data query request; Generate a data query statement according to the query path; A sending module, configured to obtain and return data corresponding to the field information by executing the data query statement; The processing module is specifically configured to determine, if the field information includes multiple attribute fields of the data to be queried, a query order of the multiple attribute fields and a query path for each attribute field based on the database table and the field information in the data query request; Determining a query path for the field information of the data to be queried according to the query order of the multiple attribute fields and the query path of each attribute field; Generate a data query statement according to the query path.

7. An electronic device, characterized in that: include: Memory; processor; as well as computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that A computer program is stored thereon, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 5.

9. A computer program product, characterized in that The method comprises a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • SQL statement classification management and unified query method and device

    CN111078702A