[go: up one dir, main page]

CN113779120B - Data query method, device, equipment and storage medium - Google Patents

Data query method, device, equipment and storage medium

Info

Publication number
CN113779120B
CN113779120B CN202110128096.XA CN202110128096A CN113779120B CN 113779120 B CN113779120 B CN 113779120B CN 202110128096 A CN202110128096 A CN 202110128096A CN 113779120 B CN113779120 B CN 113779120B
Authority
CN
China
Prior art keywords
data
query
database table
service
data query
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110128096.XA
Other languages
Chinese (zh)
Other versions
CN113779120A (en
Inventor
龙建勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Tuoxian Technology Co Ltd
Original Assignee
Beijing Jingdong Tuoxian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Tuoxian Technology Co Ltd filed Critical Beijing Jingdong Tuoxian Technology Co Ltd
Priority to CN202110128096.XA priority Critical patent/CN113779120B/en
Publication of CN113779120A publication Critical patent/CN113779120A/en
Application granted granted Critical
Publication of CN113779120B publication Critical patent/CN113779120B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a data query method, a device, equipment and a storage medium, wherein the method comprises the steps that a server receives a data query request through a composite interface, wherein the composite interface provides query services of various service data, and the data query request is used for indicating the service 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 according to the data query request, and acquires and returns data corresponding to the field information indicated by the data query request by executing the data query statement. In the method, the data query statement does not contain redundant data fields, and the returned data fields only comprise source data corresponding to the data fields indicated by the data query request, so that the processing speed of the server query service can be greatly improved.

Description

Data query method, device, equipment and storage medium
Technical Field
The present application relates to the field of computers, and in particular, to a data query method, apparatus, device, and storage medium.
Background
At present, in a common operation system, an enterprise resource planning ERP system or an application system facing a B end (tobusiness), a service end of the same data source can externally provide a plurality of query service interfaces, and different query service interfaces respectively realize data query of different service functions.
When a new service function is accessed, the service end with multiple interfaces needs to be newly developed, and the repeated intersection among the multiple interfaces is high. In this regard, some systems employ a large and full interface to implement all business function queries, generating composite query statements.
However, the compound query statement will return all database source fields together to the calling end, resulting in reduced query efficiency for the server.
Disclosure of Invention
The embodiment of the application provides a data query method, a device, equipment and a storage medium, which improve the query efficiency of a server.
A first aspect of an embodiment of the present application provides a data query method, including:
receiving a data query request through a composite interface, wherein the composite interface provides query services of various service data, and the data query request indicates the service type and field information of the data to be queried;
generating a data query statement corresponding to the field information according to the data query request;
and acquiring and returning the data corresponding to the field information by executing the data query statement.
In one embodiment of the present application, the generating the data query statement corresponding to the field information according to the data query request includes:
determining a database table corresponding to the service type according to the service type of the data to be queried in the data query request;
determining a query path of the field information of the data to be queried according to the database table and the field information in the data query request;
and generating the data query statement according to the query path.
In one embodiment of the present application, the determining, according to the service type of the data to be queried in the data query request, a database table corresponding to the data type includes:
receiving a corresponding relation between a pre-configured service type and a database table;
and determining a database table corresponding to the service type of the data to be queried according to the corresponding relation between the pre-configured service type and the database table and the service type of the data to be queried.
In one embodiment of the application, the data query statement is a structured query language SQL statement, and before executing the data query statement, the method further comprises:
and carrying out preloading processing on the generated data query statement.
Optionally, the field information includes at least one attribute field of the data to be queried.
In one embodiment of the present application, if the field information includes a plurality of attribute fields of the data to be queried, determining a query path of the field information of the data to be queried according to the database table and the field information in the data query request includes:
determining the query sequence of the attribute fields and the query path of each attribute field according to the database table and the field information in the data query request;
and determining the query path of the field information of the data to be queried according to the query sequence of the attribute fields and the query path of each attribute field.
In one embodiment of the application, the method further comprises:
receiving configuration information of a new service, wherein the configuration information is used for indicating the corresponding relation between the new service type and a database table, and the query of the new service multiplexes the composite interface;
and updating the corresponding relation between the pre-configured service type and the database table according to the configuration information.
A second aspect of an embodiment of the present application provides a data query apparatus, including:
The receiving module is used for receiving a data query request through a composite interface, the composite interface provides query services of various business data, and the data query request indicates the business type and field information of the data to be queried;
the processing module is used for generating a data query statement corresponding to the field information according to the data query request;
and the sending module is used for acquiring and returning the data corresponding to the field information by executing the data query statement.
In one embodiment of the present application, the processing module is specifically configured to:
determining a database table corresponding to the service type according to the service type of the data to be queried in the data query request;
determining a query path of the field information of the data to be queried according to the database table and the field information in the data query request;
and generating the data query statement according to the query path.
In one embodiment of the present application, the receiving module is further configured to receive a correspondence between a preconfigured service type and a database table;
The processing module is further configured to determine a database table corresponding to the service type of the data to be queried according to the corresponding relation between the pre-configured service type and the database table and the service type of the data to be queried.
In one embodiment of the application, the data query statement is a structured query language SQL statement, and the processing module is further configured to, prior to executing the data query statement:
and carrying out preloading processing on the generated data query statement.
Optionally, the field information includes at least one attribute field of the data to be queried.
In one embodiment of the present application, if the field information includes a plurality of attribute fields of the data to be queried, the processing module is specifically configured to:
determining the query sequence of the attribute fields and the query path of each attribute field according to the database table and the field information in the data query request;
and determining the query path of the field information of the data to be queried according to the query sequence of the attribute fields and the query path of each attribute field.
In one embodiment of the application, the data query device further comprises an updating module;
the receiving module is further configured to receive configuration information of a new service, where the configuration information is used to indicate a corresponding relationship between the new service type and a database table, and the new service queries the composite interface;
and the updating module is used for updating the corresponding relation between the pre-configured service type and the database table according to the configuration information.
A third aspect of an embodiment of the present application provides an electronic device, including:
a memory;
processor, and
A computer program;
wherein the computer program is stored in the memory and configured to be executed by the processor to implement the method according to any of the first aspects of the present application.
A fourth aspect of an embodiment of the application provides a computer readable storage medium having stored thereon a computer program for execution by a processor to implement a method according to any of the first aspects of the application.
A fifth aspect of an embodiment of the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the method according to any of the first aspects of the present application.
The embodiment of the application provides a data query method, a device, equipment and a storage medium, wherein the method comprises the steps that a server receives a data query request through a composite interface, wherein the composite interface provides query services of various service data, and the data query request is used for indicating the service 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 according to the data query request, and acquires and returns data corresponding to the field information indicated by the data query request by executing the data query statement. In the method, the data query statement does not contain redundant data fields, and the returned data fields only comprise source data corresponding to the data fields indicated by the data query request, so that the processing speed of the server query service can be greatly improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions of the prior art, the drawings that are needed in the embodiments or the description of the prior art will be briefly described below, it will be obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained according to these drawings without inventive effort to a person skilled in the art.
FIG. 1 is a diagram illustrating a first interface diagram of a conventional data interface query method;
FIG. 2 is a second diagram of an interface in the conventional data interface query mode;
FIG. 3 is a schematic flow chart of a data query method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of an interface of a data query method according to an embodiment of the present application;
FIG. 5 is a flowchart of updating a data query interface function according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a data query device according to an embodiment of the present application;
Fig. 7 is a schematic structural diagram of a data query device according to an embodiment of the present application;
fig. 8 is a hardware configuration diagram of an electronic device according to an embodiment of the present application.
Specific embodiments of the present application have been shown by way of the above drawings and will be described in more detail below. The drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to the specific embodiments.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be understood that the terms "comprises" and "comprising," and any variations thereof, as used herein, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements that are expressly listed or inherent to such process, method, article, or apparatus.
When the service end of the same data source provides query service to the outside, the prior art scheme mainly has two types, namely, each service function provides a query interface service, the query mode needs a developer to develop a query interface service independently according to the data displayed as required, and the calling end and the service end need to conduct joint debugging on the new interface service. The other is that a plurality of business functions multiplex one query interface service, namely, unify one query interface service to meet the data query of the related business, and the query mode can reduce the joint debugging times of the developer to the interface service.
For example, fig. 1 is a schematic diagram of an existing data interface query manner, as shown in fig. 1, a server provides multiple query services, including an item query service, an inventory query service, an item+inventory query service, and so on. The calling terminal can call the article inquiry interface service provided by the service terminal to inquire about articles, such as inquiring the price, size, evaluation and the like of an article. The calling terminal can also call the inventory inquiry interface service provided by the service terminal to inquire about inventory items, such as inquiring the total inventory quantity, total ex-warehouse quantity, total warehouse quantity and the like of the inventory items. The calling terminal can also call the article and inventory inquiry interface service provided by the service terminal to perform related inquiry of the appointed articles, such as inquiring the inventory, the ex-warehouse and the warehouse-in quantity of the appointed articles. And a plurality of query interface services provided by the service end share the same data source, namely an article and inventory database, and each query interface service corresponds to one query service.
For example, fig. 2 is a schematic diagram of an existing data interface query manner, as shown in fig. 2, a server side also provides multiple query services, including an item query service, an inventory query service, an item+inventory query service, and the like, and the server side provides a unified query interface service, and a calling side may perform related query on an item, or related query on an inventory item, or related query on a specified item by calling the unified query interface service. Unlike the data interface query mode shown in fig. 1, the query interface service provided by the server side can implement the query of all service functions, the generated query statement is usually a compound query statement, and by executing the compound query statement, the server side returns all acquired query data to the calling side, and generally queries redundant data fields. For example, the calling end requests to query information of a certain article, and because the query interface provided by the service end is a compound interface, the query statement generated by the service end contains queries for all services, namely, the query statement contains inventory information of the article in addition to the information of the article, and the service end returns all data fields related to the article to the calling end.
In the first example, the same data source needs to develop multiple different interfaces to meet different service data queries, which has the disadvantage of causing a lot of repeated development work, when the data source is changed, all interfaces need to be changed and reformed, when a new service function is accessed, a new interface needs to be redeveloped, and the repeated intersection of each interface is high.
In the second example, all service data queries are implemented through one large and full interface, all database source fields are returned to the calling end together, which has the disadvantage that each interface queries redundant data fields, reduces the execution performance of the server end, when the data source is changed, the interface is also required to be changed and modified, and some business functions do not need to be subjected to multi-table cascade query, and redundant database tables can still be queried, so that the response efficiency and the performance of the server are seriously reduced.
In view of the above problems, an embodiment of the present application provides a data query method, in which a service function implementation of a data interface is transferred to a calling end, the calling end indicates a data type and a data field to be queried, and a corresponding relationship between a service type and a database table and an association relationship between database tables are preconfigured in a server end, so that after receiving a query request sent by the calling end, the server end assembles a data query statement corresponding to the query request according to the preconfigured information, the assembled data query statement eliminates redundant data fields, and no redundant data field exists in the data field returned to the calling end, thereby improving a processing speed of the server end and improving a data query efficiency. For the developer, the developer does not need to repeatedly develop a new interface, and only needs to configure rules corresponding to the new service at the server, so that the development efficiency of the server is greatly improved, and the workload of the developer is reduced.
The technical scheme of the application is described in detail below by specific examples. The following embodiments may be combined with each other, and some embodiments may not be repeated for the same or similar concepts or processes.
Fig. 3 is a flow chart of a data query method according to an embodiment of the present application. The data query method provided in this embodiment may be applied to any server (or called a server) with a data query function, where the server includes one or more database tables, and the database tables are used to store data of different service types.
As shown in fig. 3, the data query method provided in this embodiment includes the following steps:
step 101, receiving a data query request through a composite interface.
The compound interface provides query service of various service data, and the data query request indicates service type and field information of the data to be queried.
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 having an association relationship therebetween.
Illustratively, the compound interface provides an item inquiry service, an item inventory inquiry service and the like, the database table corresponding to the item inquiry service is an item table, and attribute information of different items, such as price, size, evaluation information and the like, are stored in the item table. The database table corresponding to the article inventory inquiry service is an inventory table, and inventory information of different articles, such as access data of the articles, current inventory data and the like, is stored in the inventory table. Wherein the item list and the inventory list have an association relationship.
The service type indicated by the data query request in this embodiment is any one of a plurality of service types provided by the server, and it should be understood that there may be overlapping database tables corresponding to different service types. Illustratively, an item inquiry service corresponds to an item table, an item inventory inquiry service corresponds to an inventory table, an item+inventory inquiry service corresponds to an item table, and an inventory table.
Step 102, generating a data query statement corresponding to the field information according to the data query request.
In one embodiment of the present application, the server may generate a data query statement corresponding to field information in the data query request as follows:
step 1021, determining a database table corresponding to the service type according to the service type of the data to be queried in the data query request.
Step 1022, determining a query path of the field information of the data to be queried according to the database table and the field information in the data query request.
Step 1023, generating a data query statement according to the query path.
The corresponding relationship between the service type and the database table is preconfigured in the server of the embodiment. The server determines the database table corresponding to the service type of the data to be queried according to the corresponding relation between the pre-configured service type and the database table and the service type of the data to be queried by receiving the corresponding relation between the pre-configured service type and the database table.
Alternatively, a service type may correspond to one database table or may correspond to a plurality of database tables, which is not limited in this embodiment of the present application.
Illustratively, data for business type 1 is stored in database table 1, data for business type 2 is stored in database table 2, and data for business type 3 is stored in database table 1 and database table 3. It should be understood that the data query of the service type 3 includes a query on the database table 1 and the database table 3, and the database table 1 and the database table 3 may be queried simultaneously, or sequentially according to a preset query sequence, for example, the database table 3 is queried on the basis of the query of the database table 1, which is not limited in any way.
In this embodiment, the field information in the data query request includes at least one attribute field of the data to be queried.
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, and a query path of the attribute field of the data to be queried is determined according to the database table and the attribute field, that is, location information of the attribute field in the database table is determined, and then a data query statement is generated according to the query path, where the data query statement is used for obtaining source data of the attribute field from the database table.
In one embodiment of the present application, the field information in the data query request includes a plurality of attribute fields of the data to be queried, and the determining a query path of the field information of the data to be queried according to the database table and the field information in the data query request specifically includes:
Determining the query sequence of a plurality of attribute fields and the query path of each attribute field according to the database table and the field information in the data query request, and determining the query path of the field information of the data to be queried according to the query sequence of the plurality of attribute fields and the query path of each attribute field. In this embodiment, source data of a plurality of attribute fields in the data query request may be located in the same database table or may be located in different database tables, so that it is necessary to determine a database table corresponding to the source data of each attribute field, and determine an association relationship between the database tables according to the preconfiguration information, thereby determining a query sequence of the source data of each attribute field, and generating a data query statement, where the data query statement is used to obtain the source data of the plurality of attribute fields from the database table.
According to the association relation of the pre-configured database table and the association relation between the attribute fields, the server automatically generates query sentences corresponding to different data query requests, wherein the query sentences only contain the designated data fields required to be returned, so that the query amount of the server is reduced, and the processing speed of the server query service is improved.
Step 103, obtaining data corresponding to the field information from the database by executing the data query statement.
In this embodiment, the data query statement may be a structured query language SQL statement. SQL statements are a language for manipulating databases that may be implemented to create or delete databases, create or delete database tables, add or delete a column, add or delete a primary key of a database table, create or delete an index, etc.
Optionally, in some embodiments, the method may further comprise the step of pre-loading the generated data query statement prior to executing the data query statement, primarily to prevent SQL injection problems.
The SQL injection means that the validity of the data input by the user is not judged or filtered seriously by the web application program, an attacker can add additional SQL sentences on the end of query sentences defined in advance in the web application program, and illegal operation is realized under the condition that an administrator does not know, so that the database server is deceived to execute unauthorized random query, and corresponding data information is further obtained.
And 104, returning the data corresponding to the field information.
According to the data query method provided by the embodiment of the application, the server receives the data query request through the composite interface, wherein the composite interface provides query services of various service data, and the data query request is used for indicating the service 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 according to the data query request, and acquires and returns data corresponding to the field information indicated by the data query request by executing the data query statement. In the method, the data query statement does not contain redundant data fields, and the returned data fields only comprise source data corresponding to the data fields indicated by the data query request, so that the processing speed of the server query service is improved.
Exemplary, fig. 4 is an interface schematic diagram of a data query manner provided by the embodiment of the present application, as shown in fig. 4, a service side provides a plurality of query services, including an item query service, an inventory query service, an item+inventory query service, etc., the service side provides a unified query interface service, and a calling side may perform related query on an item, or related query on an item inventory, or related query on a specified item by calling the unified query interface service. Different from the existing data interface query mode, the service end of the embodiment receives the query request of the calling end, wherein the query request is the query request processed by the calling end, namely, the service type and the field information of the data to be queried are specified in the query request sent by the calling end. The server generates a dynamic data query statement according to the processed query request and the pre-configuration information, wherein the dynamic data query statement eliminates redundant data fields and only contains the data fields appointed in the query request of the calling end, and the source data of the data fields appointed in the query request are acquired from the database table by executing the data query statement and returned to the calling end.
For example, the calling end requests to inquire information of a certain article, the calling end sends an inquiry request to the service end, the inquiry request is used for indicating article inquiry service and attribute fields of the articles, the service end determines a database table corresponding to the article inquiry service, such as an article library, according to the type of the article inquiry service indicated by the inquiry request, and the service end obtains source data corresponding to the attribute fields, such as price, size and other attribute data of the certain articles in the article library, from the database table according to the attribute fields of the articles indicated by the inquiry request.
On the basis of the above embodiment, if the server needs to add a new service function, for example, adding an electronic ticket query service, a new product query service, an order query service, and the like, and the new service function overlaps with the data in the current database table of the server, the service function of the server may be updated by the following embodiment.
Fig. 5 is a flowchart of updating a data query interface function according to an embodiment of the present application, and as shown in fig. 5, the updating process includes the following steps:
step 201, receiving 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.
Wherein the new service queries the multiplexed composite interface.
Step 202, updating the corresponding relation between the pre-configured service type and the database table according to the configuration information.
In one embodiment of the application, the data corresponding to the new service has an association relationship with the data in the existing database table of the server, the configuration information comprises the correspondence relationship between the new service type and the existing database table, and the query interface of the new service multiplexes the original composite interface.
The new service function is an electronic ticket query service, and it is understood that an association relationship exists between the electronic ticket and the article, so that an association relationship exists between the new service type and the existing article library, an electronic ticket list can be added in the article library, and different articles correspond to the same or different electronic tickets.
Based on the above example, the developer does not need to develop a new query interface, and by compounding the existing query interface and configuring the corresponding relation between the new service type and the existing database table, the server can automatically generate a data query statement corresponding to the new service type according to the updated configuration information, so as to realize the query of the new service and improve the development efficiency of the server.
Optionally, in some embodiments, the data corresponding to the new service has no association with the data in the existing database table of the server, and the configuration information includes the correspondence between the new service type and the new database table, and an interface may be redefined for querying the new service.
The new service function is an order service inquiry, and accordingly, a new interface needs to be established, the interface provides an order service inquiry service, and meanwhile, an order library table needs to be established in the database for recording execution conditions of orders of different users. Before the new service is on line, the server receives configuration information of the new service, wherein the configuration information comprises a corresponding relation between the order service and an order library table, so that the service automatically generates a data query statement corresponding to the new service type according to the new configuration information, the query of the new service is realized, and the development efficiency of the server is improved.
The embodiment of the application shows the updating process of the new service function of the server, and associates the new service data with the existing database table in a mode of updating the configuration information through the multiplexing interface, so that the server can automatically generate the data query statement corresponding to the new query service according to the updated configuration information, and the query efficiency of the new service data is improved.
The embodiment of the application can divide the functional modules of the data query device according to the embodiment of the method, for example, each functional module can be divided corresponding to each function, and two or more functions can be integrated in one processing module. The integrated modules described above may be implemented either in hardware or in software functional modules. It should be noted that, in the embodiment of the present application, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation. The following description will be given by taking an example of dividing each function module into corresponding functions.
Fig. 6 is a schematic structural diagram of a data query device according to an embodiment of the present application. As shown in fig. 6, the data query device 300 provided in this embodiment includes a receiving module 301, a processing module 302, and a sending module 303.
A receiving module 301, configured to receive a data query request through a composite interface, where the composite interface provides a query service of multiple service data, and the data query request indicates a service type and field information of the data to be queried;
A processing module 302, configured to generate a data query statement corresponding to the field information according to the data query request;
and the sending module 303 is configured to obtain and return data corresponding to the field information by executing the data query statement.
In one embodiment of the present application, the processing module 302 is specifically configured to:
determining a database table corresponding to the service type according to the service type of the data to be queried in the data query request;
determining a query path of the field information of the data to be queried according to the database table and the field information in the data query request;
and generating the data query statement according to the query path.
In one embodiment of the present application, the receiving module 301 is further configured to receive a correspondence between a preconfigured service type and a database table;
The processing module 302 is further configured to determine a database table corresponding to the service type of the data to be queried according to the corresponding relationship between the pre-configured service type and the database table and the service type of the data to be queried.
In one embodiment of the present application, the data query statement is a structured query language SQL statement, and the processing module 302 is further configured to, prior to executing the data query statement:
and carrying out preloading processing on the generated data query statement.
Optionally, the field information includes at least one attribute field of the data to be queried.
In one embodiment of the present application, if the field information includes a plurality of attribute fields of the data to be queried, the processing module 302 is specifically configured to:
determining the query sequence of the attribute fields and the query path of each attribute field according to the database table and the field information in the data query request;
and determining the query path of the field information of the data to be queried according to the query sequence of the attribute fields and the query path of each attribute field.
Fig. 7 is a schematic diagram of a data query device according to an embodiment of the present application. On the basis of the apparatus shown in fig. 6, as shown in fig. 7, the data query apparatus 300 provided in this embodiment further includes an update module 304.
The receiving module 301 is further configured to 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 multiplexes the composite interface;
The updating module 304 is configured to update the correspondence between the pre-configured service type and the database table according to the configuration information.
The data query device provided in this embodiment may execute the technical scheme of any one of the method embodiments, and its implementation principle and technical effects are similar, and will not be described herein.
Fig. 8 is a hardware configuration diagram of an electronic device according to an embodiment of the present application, as shown in fig. 8, an electronic device 400 according to the present embodiment includes:
A memory 401;
processor 402, and
A computer program;
the computer program is stored in the memory 401 and configured to be executed by the processor 402 to implement the technical solution of any of the above method embodiments, and the implementation principle and technical effect are similar, and will not be described herein again.
Alternatively, the memory 401 may be separate or integrated with the processor 402. When the memory 401 is a device separate from the processor 402, the electronic device 400 further comprises a bus 403 for connecting the memory 401 and the processor 402.
Embodiments of the present application also provide a computer readable storage medium having stored thereon a computer program for execution by the processor 402 to implement the solution as in any of the method embodiments described above.
Embodiments of the present application provide a computer program product comprising a computer program which, when executed by a processor, implements the technical solution as in any of the method embodiments described above.
The embodiment of the application also provides a chip which comprises a processing module and a communication interface, wherein the processing module can execute the technical scheme in the embodiment of the method.
Further, the chip further includes a storage module (e.g., a memory), where the storage module is configured to store the instructions, and the processing module is configured to execute the instructions stored in the storage module, and execution of the instructions stored in the storage module causes the processing module to execute the technical solution in the foregoing method embodiment.
It should be understood that the above Processor may be a central processing unit (english: central Processing Unit, abbreviated as CPU), or may be other general purpose processors, a digital signal Processor (english: DIGITAL SIGNAL Processor, abbreviated as DSP), an Application-specific integrated Circuit (english: application SPECIFIC INTEGRATED Circuit, abbreviated as ASIC), or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution.
The memory may comprise a high-speed RAM memory, and may further comprise a non-volatile memory NVM, such as at least one magnetic disk memory, and may also be a U-disk, a removable hard disk, a read-only memory, a magnetic disk or optical disk, etc.
The bus may be an industry standard architecture (Industry Standard Architecture, ISA) bus, an external device interconnect (PERIPHERAL COMPONENT, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, the buses in the drawings of the present application are not limited to only one bus or to one type of bus.
The storage medium may be implemented by any type or combination of volatile or nonvolatile memory devices 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 memory, flash memory, magnetic or optical disk. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an Application SPECIFIC INTEGRATED Circuits (ASIC). The processor and the storage medium may reside as discrete components in an electronic device.
It should be noted that the above embodiments are merely for illustrating the technical solution of the present application and not for limiting the same, and although the present application has been described in detail with reference to the above embodiments, it should be understood by those skilled in the art that the technical solution described in the above embodiments may be modified or some or all of the technical features may be equivalently replaced, and these modifications or substitutions do not make the essence of the corresponding technical solution deviate from the scope of the technical solution of the embodiments of the present application.

Claims (9)

1. A method of querying data, comprising:
receiving a data query request through a composite interface, wherein the composite interface provides query services of various service data, and the data query request indicates the service type and field information of the data to be queried;
determining a database table corresponding to the service type according to the service type of the data to be queried in the data query request;
determining a query path of the field information of the data to be queried according to the database table and the field information in the data query request;
Generating a data query statement according to the query path;
Acquiring and returning data corresponding to the field information by executing the data query statement;
and determining a query path of the field information of the data to be queried according to the database table and the field information in the data query request, wherein the query path comprises the following steps:
determining the query sequence of the attribute fields and the query path of each attribute field according to the database table and the field information in the data query request;
and determining the query path of the field information of the data to be queried according to the query sequence of the attribute fields and the query path of each attribute field.
2. The method according to claim 1, wherein the determining the database table corresponding to the service type according to the service type of the data to be queried in the data query request includes:
receiving a corresponding relation between a pre-configured service type and a database table;
and determining a database table corresponding to the service type of the data to be queried according to the corresponding relation between the pre-configured service type and the database table and the service type of the data to be queried.
3. The method of claim 1, wherein the data query statement is a structured query language SQL statement, and wherein prior to executing the data query statement, the method further comprises:
and carrying out preloading processing on the generated data query statement.
4. A method according to any of claims 1-3, characterized in that the field information comprises at least one attribute field of the data to be queried.
5. The method according to claim 2, wherein the method further comprises:
Receiving configuration information of a new service, wherein the configuration information is used for indicating the corresponding relation between a new service type and a database table, and the query of the new service multiplexes the composite interface;
and updating the corresponding relation between the pre-configured service type and the database table according to the configuration information.
6. A data query device, comprising:
The receiving module is used for receiving a data query request through a composite interface, the composite interface provides query services of various business data, and the data query request indicates the business type and field information of the data to be queried;
The processing module is used for determining a database table corresponding to the service type according to the service type of the data to be queried in the data query request, determining a query path of the field information of the data to be queried according to the database table and the field information in the data query request, and generating a data query statement according to the query path;
The sending module is used for acquiring and returning the data corresponding to the field information by executing the data query statement;
The processing module is specifically configured to determine a query sequence of the plurality of attribute fields and a query path of each attribute field according to the database table and the field information in the data query request, determine a query path of the field information of the data to be queried according to the query sequence of the plurality of attribute fields and the query path of each attribute field, and generate a data query statement according to the query path.
7. An electronic device, comprising:
a memory;
processor, and
A computer program;
Wherein the computer program is stored in the memory and configured to be executed by the processor to implement the method of any one of claims 1 to 5.
8. A computer readable storage medium, having stored thereon a computer program, the computer program being executed by a processor to implement the method of any of claims 1 to 5.
9. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the method of any one of claims 1 to 5.
CN202110128096.XA 2021-01-29 2021-01-29 Data query method, device, equipment and storage medium Active CN113779120B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110128096.XA CN113779120B (en) 2021-01-29 2021-01-29 Data query method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110128096.XA CN113779120B (en) 2021-01-29 2021-01-29 Data query method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113779120A CN113779120A (en) 2021-12-10
CN113779120B true CN113779120B (en) 2025-08-19

Family

ID=78835456

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110128096.XA Active CN113779120B (en) 2021-01-29 2021-01-29 Data query method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113779120B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116662377A (en) * 2022-02-17 2023-08-29 北京鼎普科技股份有限公司 Database content inspection method, equipment and storage medium
CN114741392A (en) * 2022-04-14 2022-07-12 北京字节跳动网络技术有限公司 Data query method, device, electronic device and storage medium
CN115098530A (en) * 2022-06-16 2022-09-23 京东科技控股股份有限公司 Data acquisition method and device
CN115203306A (en) * 2022-07-19 2022-10-18 平安付科技服务有限公司 Data exporting method and device, computer equipment and readable storage medium
CN115729951B (en) * 2022-11-28 2024-02-09 易保网络技术(上海)有限公司 Data query method, system, device and computer readable storage medium
CN116010682A (en) * 2023-01-10 2023-04-25 中国建设银行股份有限公司 Data query method and device, equipment, medium and product thereof

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111078702A (en) * 2019-12-17 2020-04-28 南京南瑞继保工程技术有限公司 SQL sentence classification management and unified query method and device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109766354A (en) * 2018-12-04 2019-05-17 北京辰森世纪科技股份有限公司 Optimization method, device and the equipment of business datum inquiry
US11762851B2 (en) * 2019-05-01 2023-09-19 Vmware, Inc. Methods and systems that provide a general query interface to multiple management services and applications
CN110990400B (en) * 2019-11-20 2023-07-04 浙江大搜车软件技术有限公司 Database query method, device, computer equipment and storage medium
CN112131294A (en) * 2020-09-22 2020-12-25 城云科技(中国)有限公司 Method, system and device for quickly generating interface
CN112052267B (en) * 2020-11-09 2021-03-02 未鲲(上海)科技服务有限公司 Data query method, equipment, server and storage medium
CN112163131A (en) * 2020-11-10 2021-01-01 平安普惠企业管理有限公司 Configuration method and device of business data query platform, computer equipment and medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111078702A (en) * 2019-12-17 2020-04-28 南京南瑞继保工程技术有限公司 SQL sentence classification management and unified query method and device

Also Published As

Publication number Publication date
CN113779120A (en) 2021-12-10

Similar Documents

Publication Publication Date Title
CN113779120B (en) Data query method, device, equipment and storage medium
US7779386B2 (en) Method and system to automatically regenerate software code
CN110162512B (en) Log retrieval method, device and storage medium
CN111177231A (en) Report generation method and report generation device
CN111797073B (en) Database management method, electronic device, and computer-readable storage medium
CN108599973B (en) Log association method, device and equipment
US20060136810A1 (en) Electronic form generator
CN113569257B (en) User authority management method and device in gray level release
CN112434015B (en) Data storage method and device, electronic equipment and medium
WO2023098462A1 (en) Improving performance of sql execution sequence in production database instance
CN112434037A (en) Data processing method, processing device, data processing apparatus, and storage medium
CN117009397A (en) Data query method, data query device, electronic equipment and storage medium
US8433729B2 (en) Method and system for automatically generating a communication interface
CN115438240A (en) Data processing method and device, electronic equipment and storage medium
CN115062047A (en) Data optimization method and device, computer equipment and storage medium
WO2025082272A1 (en) Method and apparatus for providing business function interface
US7657528B2 (en) Method, computer program product and article of manufacture for providing service-to-role assignment to launch application services in role-based computer system
US20050120352A1 (en) Meta directory server providing users the ability to customize work-flows
CN117077095A (en) Authority request response method and device and electronic equipment
CN116257673A (en) Data query method, device, equipment and storage medium based on ElasticSearch
CN114185898A (en) A data query method, device and terminal device
US6922671B2 (en) System and method for grouping companies according to accounting system or rules
US7424493B2 (en) Replication-based propagation mechanism for pipelines
CN115357604B (en) Data query method and device
CN113761053A (en) Data query method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant