CN117951154A - Data query method, device, system, electronic equipment and storage medium - Google Patents

Data query method, device, system, electronic equipment and storage medium Download PDF

Info

Publication number
CN117951154A
CN117951154A CN202311085182.2A CN202311085182A CN117951154A CN 117951154 A CN117951154 A CN 117951154A CN 202311085182 A CN202311085182 A CN 202311085182A CN 117951154 A CN117951154 A CN 117951154A
Authority
CN
China
Prior art keywords
query
data
parameters
parameter
attribute
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.)
Pending
Application number
CN202311085182.2A
Other languages
Chinese (zh)
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.)
Mashang Xiaofei Finance Co Ltd
Original Assignee
Mashang Xiaofei Finance 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 Mashang Xiaofei Finance Co Ltd filed Critical Mashang Xiaofei Finance Co Ltd
Priority to CN202311085182.2A priority Critical patent/CN117951154A/en
Publication of CN117951154A publication Critical patent/CN117951154A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a data query method, a data query device, a data query system, electronic equipment and a storage medium, and belongs to the technical field of databases. The method comprises the following steps: obtaining query parameters in response to a query request sent by a first terminal; determining database object parameters corresponding to the query parameters according to a preset parameter mapping relation, wherein the parameter mapping relation is used for representing the mapping relation between the query parameters and the database object parameters, and the data format of the query parameters is different from that of the database object parameters; according to the database object parameters, a query method in a query parent class is called based on a query sub-class, a query result corresponding to the query parameters is obtained, and the query sub-class is established by inheriting the query parent class. According to the embodiment of the application, the difficulty of data query can be reduced, the data query can be conveniently realized, and the query efficiency is higher.

Description

Data query method, device, system, electronic equipment and storage medium
Technical Field
The present application relates to the field of database technologies, and in particular, to a data query method, apparatus, system, electronic device, and computer readable storage medium.
Background
The data may be stored in a plurality of data tables. In general, only a technician who grasps the database query language can write a correct query code, and obtain an associated query result through the query code. Moreover, the technician needs to use specific names of each data table and each attribute in the database in the process of writing the query code, so that the technician is required to be familiar with the database. In summary, only those familiar with the database who have knowledge of the database query language can realize the data query. In addition, if a complete set of query codes is rewritten for each data query, query inefficiency may result. Therefore, how to provide a convenient, simple and high-efficiency data query method for common users who do not master the database query language and are not familiar with the database becomes one of the hot spot problems of the current research.
Disclosure of Invention
The application provides a data query method, a data query device, electronic equipment and a computer readable storage medium, which can reduce the difficulty of data query, conveniently realize data query and have higher query efficiency.
In a first aspect, the present application provides a data query method, which is applicable to a first server, where the data query method includes: obtaining query parameters in response to a query request sent by a first terminal; determining a database object parameter corresponding to the query parameter according to a preset parameter mapping relation, wherein the parameter mapping relation is used for representing the mapping relation between the query parameter and the database object parameter, and the data format of the query parameter is different from the data format of the database object parameter; and according to the database object parameters, calling a query method in a query parent class based on a query subclass to obtain a query result corresponding to the query parameters, wherein the query subclass is established in a manner of inheriting the query parent class.
In a second aspect, the present application provides a data query device, which is applicable to a first terminal, where the data query method includes: responding to a page operation instruction, acquiring a query parameter, wherein a parameter mapping relation exists between the query parameter and a database object parameter, and the data format of the query parameter is different from that of the database object parameter; generating a query request with a target format according to the query parameters; and sending the query request to a first server, wherein the query request is used for indicating the first server to execute data query processing and feeding back a query result corresponding to the query parameter to the first terminal.
In a third aspect, the present application provides a data query system comprising: at least one first terminal and at least one first server; the at least one first server is configured to execute a data query method corresponding to the first aspect of the embodiment of the present application, and the at least one first terminal is configured to execute a data query method corresponding to the second aspect of the embodiment of the present application.
In a fourth aspect, the present application provides a data query device, which may be disposed on a first server, the data query device including: the acquisition module is used for responding to the query request sent by the first terminal to obtain query parameters; the determining module is used for determining database object parameters corresponding to the query parameters according to a preset parameter mapping relation, wherein the parameter mapping relation is used for representing the mapping relation between the query parameters and the database object parameters, and the data format of the query parameters is different from the data format of the database object parameters; and the query module is used for calling a query method in a query parent class based on a query subclass according to the database object parameters to obtain a query result corresponding to the query parameters, wherein the query subclass is established in a manner of inheriting the query parent class.
In a fifth aspect, the present application provides a data query device, which may be provided in a first terminal, the data query device including: the acquisition module is used for responding to the page operation instruction and acquiring query parameters, wherein the query parameters and the database object parameters have parameter mapping relations, and the data format of the query parameters is different from that of the database object parameters; the generation module is used for generating a query request with a target format according to the query parameters; the sending module is used for sending the query request to a first server, wherein the query request is used for indicating the first server to execute data query processing and feeding back a query result corresponding to the query parameter to the first terminal.
In a sixth aspect, the present application provides an electronic device, comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, one or more of the computer programs being executable by the at least one processor to enable the at least one processor to perform the data query method described above.
In a seventh aspect, the present application provides a computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor/processing core implements the data query method described above.
According to the embodiment provided by the application, the query request sent by the first terminal is responded to obtain the query parameters, wherein the query parameters are data obtained by the first terminal based on the page operation instruction of the user, so that the user can initiate the data query request through the page operation instruction without using a database query language for coding, and the difficulty of data query is reduced; according to a preset parameter mapping relation, determining database object parameters corresponding to the query parameters, wherein the data format of the query parameters is different from the data format of the database object parameters, namely, the query parameters with different data formats can be mapped into the corresponding database object parameters through the parameter mapping relation, so that the object of data query can be clarified, a user does not need to be familiar with the data representation mode of the database object parameters in the database, and the requirement of the user on the familiarity degree of the database is reduced; according to the database object parameters, the query method in the query parent class is called based on the query subclass, so that the query result corresponding to the query parameters can be obtained, and the query subclass is established in a manner of inheriting the query parent class, and because the data query is carried out in a manner of inheriting the parent class, the query subclass can directly call the query method in the query parent class, and a new query method is not required to be written or can be generated only by a small amount of rewriting, so that the code writing amount in the data query process is greatly reduced, and the data query efficiency is improved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the application or to delineate the scope of the application. Other features of the present application will become apparent from the description that follows.
Drawings
The accompanying drawings are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate the application and together with the embodiments of the application, serve to explain the application. The above and other features and advantages will become more readily apparent to those skilled in the art by describing in detail exemplary embodiments with reference to the attached drawings, in which:
FIG. 1 is a flowchart of a data query method according to an embodiment of the present application;
FIG. 2 is a flowchart of a data query method according to an embodiment of the present application;
FIG. 3 is a flowchart of a data query method according to an embodiment of the present application;
fig. 4 is a schematic view of a scenario of a data query method according to an embodiment of the present application;
fig. 5 is a schematic flow chart of a data query method according to an embodiment of the present application;
fig. 6 is a schematic process diagram of a data query method according to an embodiment of the present application;
FIG. 7 is a block diagram of a data query device according to an embodiment of the present application;
FIG. 8 is a block diagram of a data query device according to an embodiment of the present application;
FIG. 9 is a block diagram of a data query system according to an embodiment of the present application;
Fig. 10 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For a better understanding of the technical solutions of the present application, the following description of exemplary embodiments of the present application is made with reference to the accompanying drawings, in which various details of embodiments of the present application are included to facilitate understanding, and they should be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The embodiments of the application and features of the embodiments may be combined with each other without conflict.
As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used herein, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. The terms "connected" or "connected," and the like, are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and the present application and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
In the related art, a data query code is generally written by a technician using a database query language, and a data query result is obtained by running the data query code. The query mode requires that a technician is skilled in mastering the use method of the database query language, can accurately write the data query code, and requires that the technician is familiar with the field naming of each data table and the attribute thereof in the database. Therefore, the current query mode has high requirements on the technical threshold of the database of the user, and the common user is difficult to complete the data query conveniently and efficiently.
In view of this, the embodiments of the present application provide a data query method, a data query device, an electronic apparatus, and a computer readable storage medium.
In the embodiment of the application, the query request sent by the first terminal is responded to obtain the query parameter, wherein the query parameter is the data obtained by the first terminal based on the page operation instruction of the user, so that the user can initiate the data query request through the page operation instruction without using the database query language for coding, and the difficulty of data query is reduced; according to a preset parameter mapping relation, determining database object parameters corresponding to the query parameters, wherein the data format of the query parameters is different from the data format of the database object parameters, namely, the query parameters with different data formats can be mapped into the corresponding database object parameters through the parameter mapping relation, so that the object of data query can be clarified, a user does not need to be familiar with the data representation mode of the database object parameters in the database, and the requirement of the user on the familiarity degree of the database is reduced; according to the database object parameters, the query method in the query parent class is called based on the query subclass, so that the query result corresponding to the query parameters can be obtained, and the query subclass is established in a manner of inheriting the query parent class, and because the data query is carried out in a manner of inheriting the parent class, the query subclass can directly call the query method in the query parent class, and a new query method is not required to be written or can be generated only by a small amount of rewriting, so that the code writing amount in the data query process is greatly reduced, and the data query efficiency is improved.
Therefore, in the embodiment of the application, the user does not need to master the database query language, does not need to write codes, does not need to be familiar with the field naming of each data table and the attribute thereof in the database, but can display the data query result for the user on the preset page through a series of processes of the first terminal and the first server by simple text input and/or text clicking on the preset page, thereby greatly reducing the difficulty of data query and enabling the common user to conveniently complete the data query.
The data query method according to the embodiment of the application can be executed by an electronic device such as a terminal device or a server, and the terminal device can be a user device (UserEquipment, UE), a mobile device, a user terminal, a cellular phone, a cordless phone, a personal digital assistant (PersonalDigitalAssistant, PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, or the like, and the method can be implemented by a processor in a manner of calling computer readable program instructions stored in a memory. The servers may be independent physical servers, a server cluster consisting of multiple servers, or cloud servers capable of cloud computing.
In a first aspect, an embodiment of the present application provides a data query method, where the data query method may be applied to a first server.
Fig. 1 is a flowchart of a data query method according to an embodiment of the present application, where the data query method is applied to a first server. The data query method includes the following steps.
And step S11, obtaining query parameters in response to the query request sent by the first terminal.
In some optional implementations, the first terminal may be a terminal on the user side, and the user may send some page operation instructions to the terminal, so that the terminal obtains the query parameters through the page operation instructions, generates a query request based on the query parameters, and sends the query request to the first server, where the first server may obtain the query parameters from the query request. Where the query parameters are parameters used in querying the data that may indicate which data to query includes.
In some alternative implementations, the query parameters include a data table name and an attribute name within the data table; correspondingly, obtaining the query parameters in response to the query request sent by the first terminal comprises the following steps: acquiring list objects in a query request; obtaining a data table name according to the table name element in the list object; and obtaining the attribute name according to the attribute elements in the list object.
For example, the query request is as follows:
wherein, the query request includes two list objects, the first list object is: [ { "tableName": "user table" }, { "FIELDNAMES": "user identification", "user name" } ], the second list object is: [ { "tableName": "department table" }, { "FIELDNAMES": "department identification", "department name" } ].
In the first list object, { "tableName": user table "} belongs to a table name element, through which the data table name is" user table ", {" FIELDNAMES ": user identification", "user name" } belongs to an attribute element, through which the attribute names are determined to be "user identification" and "user name" in the user table.
In the second list object, { "tableName": the "department table" } belongs to a table name element, through which the data table name is "department table", { "FIELDNAMES": the "department identification", "department name" } belongs to an attribute element, through which the attribute names are determined to be "department identification" and "department name" in the department table.
Step S12, according to a preset parameter mapping relation, determining database object parameters corresponding to the query parameters.
The parameter mapping relation is used for representing the mapping relation between the query parameter and the database object parameter, and the data format of the query parameter is different from the data format of the database object parameter. The database object parameters include parameters of each object in the database, which may be a data table name field of a data table, an attribute field of an attribute in the data table, and the like.
It should be noted that, because the query parameters and the database object parameters have different data formats, the query parameters cannot be directly used for data query, and because the parameter mapping relationship characterizes the mapping relationship between the query parameters and the database object parameters, the corresponding database object parameters can be determined according to the query parameters and the parameter mapping relationship under the condition that the query parameters are already defined.
In some alternative implementations, the query parameters may be in a first predetermined format as their data format and the database object parameters may be in a second predetermined format as their data format. The first preset format comprises data formats corresponding to a plurality of natural languages, and the second preset format comprises data formats familiar to a database.
Illustratively, the query parameter may be a chinese character string, the database object parameter may be an english character string, and the query parameter in the form of the chinese character string may be mapped to the database object parameter in the form of the english character string by the parameter mapping relationship.
For example, the query parameters include "user table", and the database object parameters corresponding to "user name" can be determined to be "users_table" by the parameter mapping relationship, that is, the user table is stored in the database with "users_table" as its database table name.
In some alternative implementations, the query request may be a request for making an associative query, which in the context of an associative query generally involves a data query between at least two databases.
The data table names comprise a first data table name and a second data table name, the attribute names comprise a first attribute name and a second attribute name, the first attribute corresponding to the first attribute name is an attribute in the first data table, the second attribute corresponding to the second attribute name is an attribute in the second data table, and the query request is used for querying a correlation result between the first attribute and the second attribute; the database object parameters include: a first data table name field corresponding to the first data table name, a second data table name field corresponding to the second data table name, a first attribute field corresponding to the first attribute name, a second attribute field corresponding to the second attribute name, the first attribute field being a field in the first data table, the second attribute field being a field in the second data table; the parameter mapping relation comprises the following steps: the mapping relation between the first data table name and the first data table name segment, the mapping relation between the second data table name and the second data table name segment, the mapping relation between the first attribute name and the first attribute field, and the mapping relation between the second attribute name and the second attribute field.
Step S13, according to the database object parameters, a query method in a query parent class is called based on a query sub-class, a query result corresponding to the query parameters is obtained, and the query sub-class is established in a manner of inheriting the query parent class.
In some alternative implementations, a query parent may be preset, and some attributes and multiple query methods may be defined in the query parent. When the query is carried out, the query subclass is directly established in a mode of inheriting the query parent class, so that the query method in the query parent class can be called based on the query subclass to execute the data query, and the query result corresponding to the query parameter is obtained. The query subclass established by inheriting the query parent class naturally inherits the attribute of the query parent class and a plurality of query methods. In this way, the code writing amount can be effectively reduced and the query efficiency can be improved without rewriting the code corresponding to the query method when the query is executed each time.
It should be noted that, as the query scene expands and the query requirement is updated, the attribute and/or the query method in the query parent class may be adaptively updated. The updating may be to set a new attribute or query method, or to change an original attribute or query method, which is not limited in this embodiment of the present application.
In addition, in addition to directly invoking the query method in the query parent class, the query sub-class may rewrite the query method defined by the parent class, thereby generating the query sub-method of the query sub-class itself, or the query sub-class may define a new query sub-method (the new query sub-method is a method specific to the query sub-class), which is not limited in this embodiment of the present application.
The following takes the related query scenario as an example, and the query process is described in an unfolding manner.
In some alternative implementations, multiple association query methods are defined in association query parent JoinServiceImpl, which may include: joinServiceIll.joinList method, joinServiceIll.joinGetOne method, joinServiceIll.joinCount method, and JoinServiceIll.jonPage method. The JoinServiceIII.jojnList method is used for realizing continuous table query, the JoinServiceIII.jojnGetOne method can be used for realizing single data query, the JoinServiceIII.jojnCount method can be used for realizing counting query, and the JoinServiceIII.jojnPage method is used for realizing paging query.
If the database object parameters include: the association query request is used to query the department information of each user, and then the association query parent class JoinServiceImpl can be inherited, the association query subclass UserDeptServiceImpl is established, the JoinServiceIII.join List method is called, and the database object parameters are used as parameters of the JoinServiceIII.join List method, so that dept _id and dept _name corresponding to each user (the users are identified by the user_id and the user_name) can be obtained.
And the database object parameters can be mapped into corresponding associated query parameters to obtain associated query results.
For example, invoking the JoinServiceIII. Join List method may result in the following:
table 1 database query results schematic table
users_id users_name dept_id dept_name
1 aaa 2 yyy
2 bbb 5 qqq
3 ccc 1 xxx
For table 1, the second type characters in the header can be converted into the first type characters through the parameter mapping relation, so as to obtain table 2 as shown below:
table 2 converted database query results schematic table
User identification User name Department identification Department name
1 aaa 2 yyy
2 bbb 5 qqq
3 ccc 1 xxx
Table 2 shows the obtained related query results.
In some optional implementations, after calling a query method in a query parent class based on a query subclass according to a database object parameter to obtain a query result corresponding to the query parameter, the method further includes: converting the query result into target data with a target format; and sending the target data to the first terminal.
The first terminal is provided with a preset page, and after the first server obtains the query result, the query result can be converted into target data with a target format and the target data is sent to the first terminal; the first terminal receives the target data, analyzes the target data into page data supported by a preset page, and then displays the page data on the preset page for a user to check a query result.
For example, for the associated query result shown in table 2, the first server may first perform format conversion on the associated query result to obtain target data with a target format, as follows:
After the target data is obtained, the first server transmits it to the first terminal. The first terminal analyzes the target data to obtain page data which can be displayed on a preset page, and the page data is displayed in the preset page. The displayed page data may be in a form of a table, a still image, a moving image, etc., which is not limited in the embodiment of the present application.
In the embodiment of the application, the query request sent by the first terminal is responded to obtain the query parameter, wherein the query parameter is the data obtained by the first terminal based on the page operation instruction of the user, so that the user can initiate the data query request through the page operation instruction without using the database query language for coding, and the difficulty of data query is reduced; according to a preset parameter mapping relation, determining database object parameters corresponding to the query parameters, wherein the data format of the query parameters is different from the data format of the database object parameters, namely, the query parameters with different data formats can be mapped into the corresponding database object parameters through the parameter mapping relation, so that the object of data query can be clarified, a user does not need to be familiar with the data representation mode of the database object parameters in the database, and the requirement of the user on the familiarity degree of the database is reduced; according to the database object parameters, the query method in the query parent class is called based on the query subclass, so that the query result corresponding to the query parameters can be obtained, and the query subclass is established in a manner of inheriting the query parent class, and because the data query is carried out in a manner of inheriting the parent class, the query subclass can directly call the query method in the query parent class, and a new query method is not required to be written or can be generated only by a small amount of rewriting, so that the code writing amount in the data query process is greatly reduced, and the data query efficiency is improved.
Fig. 2 is a flowchart of a data query method according to an embodiment of the present application, which may be applied to a first server, and referring to fig. 2, the data query method may include the following steps.
Step S21, a query request sent by the first terminal is received.
Step S22, analyzing the query request to obtain a plurality of query parameters.
Step S23, according to the preset parameter mapping relation, determining the database object parameters corresponding to each query parameter.
Step S24, establishing query subclasses by inheriting the query parent class.
Step S25, according to the database object parameters, a query method in a query parent class is called based on the query subclass, and a query result corresponding to the query parameters is obtained.
In a second aspect, an embodiment of the present application provides a data query method, where the data query method may be applied to a first terminal.
Fig. 3 is a flowchart of a data query method according to an embodiment of the present application, where the data query method is applied to a first terminal. The data query method includes the following steps.
Step S31, responding to the page operation instruction, and acquiring the query parameters.
In some alternative implementations, the page operation instructions are instructions generated by a user performing some operations on a page of the first terminal. The query parameters are parameters used in the data query process, which data to be queried comprise can be determined through the query parameters, and the query parameters can be data carried in page operation instructions.
In some alternative implementations, the page operation instructions include page input instructions and/or page click instructions. The page input instruction is an instruction generated based on the input behavior of the user, and the page click instruction is an instruction generated based on the click behavior of the user.
The first terminal is provided with a preset page for users to use when querying data. The user can send a page input instruction to the first terminal in a mode of text input on a preset page, and the page input instruction carries query parameters input by the user. Or the user can also send a page clicking instruction to the first terminal in a mode of clicking certain texts on a preset page, and the page clicking instruction carries the query parameters clicked by the user.
In some optional implementations, the query parameters are parameters provided by the user when the user performs data query, and are different from the data formats of the database object parameters in the database, so that the parameter mapping relationship between the query parameters and the database object parameters is preset, and the corresponding database object parameters can be obtained according to the query parameters. The data format adopted by the query parameters can be the data format corresponding to various natural languages.
For example, the query parameters may be represented by chinese characters, and correspondingly, the database object parameters may be represented by english or english shorthand. For users who are familiar with Chinese, they can initiate a query directly based on the query parameters of Chinese characters, without the users being familiar with what data format is used in the database.
In summary, for the user, the user does not need to write a query code, and can send a page operation instruction to the first terminal only through simple page operation, and query parameters are carried in the page operation instruction, so that the query difficulty of the user is greatly simplified, and the query convenience is improved; in addition, the query parameters can be in a data format which is more used by users, so that the users do not need to be familiar with the data representation mode of the database object parameters in the database, and the requirements of the users on the familiarity degree of the database are reduced.
Step S32, according to the query parameters, generating a query request with a target format.
In some alternative implementations, the target format is a data exchange format supporting data interaction between the server and the terminal, and the query request may instruct the first server to perform the data query processing according to the query parameter.
Illustratively, the target format may be any one of JSON (JavaScript Object Notation, JS object profile) format and XML (Extensible Markup Language ) format.
In some optional implementations, if the user inputs "user data table, user identifier, user name, department data table, department identifier, department name" on the preset page, the first terminal may generate a query request as follows based on the foregoing:
Wherein tableName fields may specify the data table to be queried, FILEDNAMES fields may specify which fields in the data table to query. For example, "tableName" to "user table" means that the data table to be queried is a user table, "FIELDNAMES" to [ "user identification", "user name" ] means that the "user identification" field and the "user name" field in the user table are to be queried.
It should be noted that the foregoing is merely illustrative of the target format, and embodiments of the present application are not limited thereto.
Step S33, a query request is sent to the first server.
The query request is used for indicating the first server to execute data query processing and feeding back a query result corresponding to the query parameter to the first terminal.
In some alternative implementations, after the first server obtains the query result, the query result may be converted into target data having a target format, and the target data may be sent to the first terminal. The first terminal is provided with a preset page, after the first terminal receives the target data, the target data can be analyzed into page data supported by the preset page, and then the page data are displayed on the preset page, so that a user can view the query result.
In summary, the first terminal provides a preset page for the user, when the user needs to query, the user can execute some simple page operations on the preset page, through the page operation behavior of the user, the first terminal receives the page operation instruction and obtains the query parameters from the page operation instruction, the method does not need the user to use the database query language to encode, the difficulty of data query is reduced, and the query parameters are represented by the first type characters which are used conventionally by the user because the query parameters are different from the data formats of the database object parameters, and therefore, the user does not need to be familiar with the data forms of all data tables and all attributes in the database, and the requirement of the user on the familiarity degree of the database is reduced; further, the first terminal generates and transmits the query request with the target format to the first server based on the query parameter, and the target format is a data exchange format supporting the data interaction between the server and the terminal, so that smooth and accurate transmission of the query request can be ensured, and an accurate query result can be obtained.
In the embodiment of the application, the query parameters are obtained in response to the page operation instruction, wherein the query parameters are data obtained by the first terminal based on the page operation instruction of the user, so that the user can initiate a data query request through the page operation instruction without using a database query language for coding, the difficulty of data query is reduced, the data format of the query parameters is different from the data format of the database object parameters, and the query parameters with different data formats can be mapped into corresponding database object parameters through the parameter mapping relation, so that the object of the data query can be defined, and therefore, the user does not need to be familiar with the data representation mode of the database object parameters in the database, thereby reducing the requirement of the user on the familiarity degree of the database; according to the query parameters, generating a query request with a target format, sending the query request to the first server, indicating the first server to execute data query processing through the query request, and feeding back a query result corresponding to the query parameters to the first terminal.
Fig. 4 is a schematic view of a scenario of a data query method according to an embodiment of the present application.
As shown in fig. 4, the first terminal and the first server may communicate with each other, where the communication manner includes external wired communication, external wireless communication, internal wired communication, internal wireless communication, and the like, which is not limited in this embodiment of the present application.
The first terminal provides a preset page for a user, and an input area and a click area are arranged in the preset page. The input area is used for a user to input query parameters and supports text automatic filling. For example, after the user inputs "use" in the input box of the preset page, the first terminal may automatically fill the text according to the "use", pop up a plurality of text box lists below the input box, respectively display "user list", "electricity meter" and "water meter" in each text box, and the user selects one of them according to the need, so that the text content in the selected text box may appear in the input box, and thus the related query parameter is transmitted to the first terminal. The automatically populated text may be content provided according to query parameters in a parameter mapping relationship.
N categories (N is greater than or equal to 1) are configured in the click zone, and each category comprises a plurality of query parameters. The user can determine the category to which the query parameter belongs first, then clicks the category, the preset page responds to the click operation of the user, a plurality of query parameters under the category are displayed for the user in a list and the like, the user can select the corresponding query parameters according to the required key points, and the clicked query parameters can be transmitted to the first terminal. The categories may be divided according to the initial letters of the query parameters, the frequency of use, the service types to which the query parameters belong, and the embodiment of the present application is not limited.
In the first server, a query parent class is configured in advance, and M query methods (M is greater than or equal to 1) are defined under the query parent class, wherein different query methods have different functions and are used for realizing respective query operations.
In some optional implementations, after the first terminal responds to a page operation instruction sent by a user for a preset page, a plurality of query parameters are obtained and then converted into a target format, a query request is obtained, and the query request is sent to the first server. After receiving a query request, a first server calls a parameter analysis method to analyze the query request to obtain a plurality of query parameters, determines database object parameters corresponding to each query parameter according to a preset parameter mapping relation, inherits a query parent class to establish a query subclass, calls a corresponding query method by using the query subclass, takes the database object parameters as a parameter entering execution method of the query method to obtain an initial query result, and maps the database object parameters in the initial query result to the corresponding query parameters to obtain a query result; and converting the query result into a target format, generating target data, and transmitting the target data to the first terminal. The first terminal analyzes the target data into page data (the page data is the paged data of the query result), and displays the query result for the user on a preset page.
Fig. 5 is a flow chart of a data query method according to an embodiment of the present application. Referring to fig. 5, the data query method may include the following steps.
In step S501, the first terminal responds to the page operation instruction to obtain the query parameter.
In step S502, the first terminal generates a query request with a target format according to the query parameter.
In step S503, the first terminal sends a query request to the first server.
In step S504, the first server invokes a preset parameter parsing method to parse the query request into a list object.
In step S505, the first server obtains a plurality of query parameters according to the list object.
In step S506, the first server determines database object parameters corresponding to the query parameters according to the preset parameter mapping relationship.
In some alternative implementations, when determining database object parameters corresponding to each associated query parameter according to the parameter mapping relationship, an exact match and fuzzy match mode is supported.
For example, the parameter mapping relationship includes a mapping relationship between the user table and the users_table and a mapping relationship between the department table and dept _table. When the associated query parameter is "user table", the database object parameter corresponding to the associated query parameter can be accurately determined to be "users_table". In the case where the associated query parameters are "user list", "user table", etc., it is determined that the matching probability of the "user table" is relatively large among the "user table" and the "department table" by the semantic similarity, the same word number matching degree, etc., and therefore, it is determined that the database object parameter corresponding to the associated query parameters of "user list", "user table", etc. is "users_table".
It should be noted that, in some alternative implementations, if the database object parameter corresponding to the associated query parameter cannot be determined according to the parameter mapping relationship, an error reporting message may be fed back to the first terminal, and an error reporting cause is described in the error reporting message (for example, the unmatched associated query parameter is "electricity meter"), so that the user may adjust the input or selected associated query parameter according to the error reporting cause.
In step S507, the first server establishes a query sub-class by inheriting a preset query parent class.
In step S508, the first server invokes the query method in the query parent class based on the query subclass according to the database object parameter, to obtain a query result corresponding to the query parameter.
In step S509, the first server sends the query result to the first terminal, so that the user can view the query result through the first terminal.
Fig. 6 is a schematic process diagram of a data query method according to an embodiment of the present application, mainly describing a processing procedure of a related query.
Referring to fig. 6, a first terminal acquires a query parameter through a page operation instruction, generates a query request based on the query parameter, and transmits the query request to a first server. After receiving the query request, the first server calls a parameter analysis method to analyze the query request to obtain the query parameters. The parameter parsing method may be a predefined and general parsing method in the first server, which may be used to parse the query request and extract the query parameters from the query request.
After receiving the query request, the first server calls a parameter analysis method to analyze the query request to obtain query parameters, and can judge whether the query request belongs to the associated query request or not through the query parameters. For example, if the query parameters parsed from the query request relate to collaborative queries of multiple data tables, it is determined to belong to the associated query request, and if the query parameters parsed from the query request relate only to single-table queries, it is determined not to belong to the associated query request. Correspondingly, the query parameters corresponding to the associated query request belong to the associated query parameters.
Further, the query parent in the first server includes an associated query parent including a plurality of associated query methods. Illustratively, the first server is preset with a related query parent class, and a parameter analysis method, a JoinServiceIII.jolnList method, a JoinServiceIII.jolnGetOne method, a JoinServiceIII.jolnCount method, a JoinServiceIII.jolnPage method, a … …, and a wrapier method are defined under the related query parent class. Wherein the Wrapper method can be used to construct a Wrapper object to enable manipulation of the data table through the Wrapper object.
In the case that the query request is an association query request, the first server may create an association query sub-class by inheriting the association query parent class, define a return result UserDeptVo based on the association query parameter, and create a Wrapper object based on the association query parameter.
Illustratively, if the associated query parameters include a user data table, a user identification, a user name, a department data table, a department identification, and a department name, and the user identification is a formal user and the department identification is a development class department. The user identification is an identification about the user type, and the user types corresponding to different user identifications are different; the department identification is an identification about the type of the department, and the types of departments corresponding to different department identifications are different. The association inquiry request is used for inquiring the department names of the various formal users belonging to the development type departments.
The above-mentioned related query parameters are assumed to correspond to the database object parameters respectively as follows: the users_table, the users_id, the users_name, the dept_table, the dept_id and the dept_name are respectively identified as 1 and the departments of the development class department are identified as A. If the user_table is the main table, the main table operation method is that a user of which user_id=1 is determined by calling a wrapper_eq () method (for example, wrapper_table; userId: 1)), and a field to be queried in the user_table is determined by calling a wrapper_select () method.
If dept _table is an association table, the association table operation method is that a wrapper/internejoin () method can be called, and the dept _id and dept _name corresponding to the users with users_id=1 in dept _table can be determined, or a wrapper/select () method can be called, and the field to be queried in dept _table can be determined.
And finally, further processing the main table operation result and the associated table operation result through the called associated query method to obtain an associated query result, and carrying the associated query result through a returned result class UserDeptVo.
For example, return results class UserDeptVo may be defined to include the following fields: the associated query results are assigned to the fields respectively by the users_id, the users_name, the dept_id and the dept _name, so that the associated query results can be definitely associated based on the returned result class UserDeptVo.
After obtaining the associated query result, and sending the associated query result to the first terminal, i.e. the first server may send the associated query result to the first terminal. The first terminal can display the associated query result for the user through a preset page.
In some optional implementations, the processing procedure of the data query method specifically includes the following:
(1) The query request sent by the first terminal to the first server is a request for jointly querying the user information and the department information, the first server obtains query parameters through the query request, and corresponding database object parameters are determined through parameter mapping. Wherein, the user information corresponds to UserEntity entity class in the database, the corresponding database table is system_users, the attribute field includes id (user identifier), deptId (department identifier), userName (user name), CREATETIME (creation time), updateTime (update time), the department information corresponds to DEPTENTITY entity class in the database, the corresponding database table is system_ dept, and the attribute field includes id (user identifier) and deptName (department name).
(2) A federated query return result UserDeptVo class is defined that includes attribute fields: id, deptId, userName, deptName. In other words, the returned query result is defined to include attribute fields id, deptId, userName, deptName, and the query result specifically includes which attribute fields can be set according to the query requirement, which is not limited by the embodiment of the present application.
(3) A new service class UserDeptServiceImpl is created, which inherits JoinServiceImpl class, wherein JoinServiceImpl class is a query parent class, and the new service class belongs to a query subclass. And, the query parent class includes 4 query methods, which can be called by query subclasses, namely joinList (method of associating query list), joinGetOne (method of associating query with one record), joinCount (method of associating query data number) and joinPage (method of associating list paging query).
(4) Defining a joint query method < T > List < T > in UserDeptServiceImpl business classes
UserToDept (Long userId, class < T > cls), which is a method generated by calling joinList, is used for inquiring user department information according to user identification id, namely, carrying out joint inquiry according to a user table and a department table to obtain departments to which the user belongs, wherein cls parameters can be transmitted to a returned result UserDeptVo Class in (2), the parameter transmission mode comprises UserDeptVo.class, the obtained data is List < UserDeptVo >, and a plurality of data inquiry records are represented, and each record corresponds to information of one user and the department to which the user belongs.
(5) Creating a joint query object JoinLambdaWrapper, wherein the main table object is UserEntity, and when in sql conversion, using a default alias name @ TableAlias ("users") marked in UserEntity, the corresponding code is JoinLambdaWra pper < UserEntity > wrapper= joinLambdaQueryWrapper (userdentity); if the default alias is not desired, a federated query object JoinLambdaWrapper < UserEntity > wrapper= joinLambd aQueryWrapper (userdentity. Class, "users_a") may be created, where "users_a" is the specified alias.
(6) The following operations are performed for the user table system_users: wrapier. Eq (UserEntity:: getId, userId), wherein eq () refers to the id field in the database table system_users corresponding to the querying user entity UserEntity according to the entry user id. If the user identification id is 1, the operation is to inquire the information of the user with the id of 1 in the user table; the following operations are performed for the department table system_users: a wrapier.select (UserEntity:: GETDEPTID, USERENTITY:: getUserName), which is used to query the dept _id and user_name attribute fields in the system_users table; also, the select method may be selected not to be used, and all attribute fields of the default lookup user table system_users are represented when the select method is not used.
(7) Performing an association table operation: wrapier, interneJoin (DeptEntity.class, deptEntity: getId, userEntity: GETDEPTID), which represents the joint query DEPTENTITY entity and UserEntity entity, or the joint query department table system_ dept and user table system_users, and the association between the two is
System_dept.id=system_users_dept_id, i.e. the data records of the user table that are identical to the user identities in the department table are jointly queried.
(8) In some alternative implementations, a joinList method may also be invoked, executing a federated query :SELECT users.dept_id,users.user_name,users.id,dept.dept_name FROM system_users as users INNER JOIN system_dept as dept ON dept.id=users.dept_id WHERE(users.id=X),"X" to represent a specific value for the user identification id.
(9) Further, for (2) to (8), list < UserDeptVo > may also be directly invoked
Userdeptservice. Usertodept (1 l, userdeptvo. Class)) method, thereby obtaining a plurality of UserDeptVo list results with a user id of 1.
(10) In addition, if a return object UserDeptAllVo needs to be returned, the attribute fields in it are 2 more fields than UserDeptVo class: CREATETIME and updateTime, instead of the select method in (6), all attribute fields in the user table system_users can be queried to get multiple UserDeptAllVo List results by directly calling the List < UserDeptAllVo > userdeptservice.
According to the results (9) and (10), different query results can be obtained by setting different returned objects, and the corresponding query codes are not required to be modified or only required to be modified in a small amount, so that more flexible and convenient data query can be realized.
It will be appreciated that the above-mentioned method embodiments of the present application can be combined with each other to form a combined embodiment without departing from the principle logic, and the present application is not repeated herein. It will be appreciated by those skilled in the art that in the above-described methods of the embodiments, the particular order of execution of the steps should be determined by their function and possible inherent logic.
In a second aspect, an embodiment of the present application provides a data query apparatus.
Fig. 7 is a block diagram of a data query device according to an embodiment of the present application, where the data query device is applicable to a first server.
Referring to fig. 7, the data query apparatus 700 may include the following modules.
An obtaining module 701, configured to obtain a query parameter in response to a query request sent by a first terminal;
The determining module 702 is configured to determine a database object parameter corresponding to the query parameter according to a preset parameter mapping relationship, where the parameter mapping relationship is used to characterize a mapping relationship between the query parameter and the database object parameter, and a data format of the query parameter is different from a data format of the database object parameter;
The query module 703 is configured to invoke a query method in a query parent class based on a query subclass according to the database object parameter, to obtain a query result corresponding to the query parameter, where the query subclass is established by inheriting the query parent class.
In some alternative implementations, the query parameters include a data table name and an attribute name within the data table;
correspondingly, when the acquiring module 701 obtains the query parameters in response to the query request sent by the first terminal, the following steps are executed:
Acquiring list objects in a query request;
Obtaining a data table name according to the table name element in the list object;
and obtaining the attribute name according to the attribute elements in the list object.
In some optional implementations, the data table names include a first data table name and a second data table name, the attribute names include a first attribute name and a second attribute name, the first attribute corresponding to the first attribute name is an attribute in the first data table, the second attribute corresponding to the second attribute name is an attribute in the second data table, and the query request is used for querying an association result between the first attribute and the second attribute;
The database object parameters include: a first data table name field corresponding to the first data table name, a second data table name field corresponding to the second data table name, a first attribute field corresponding to the first attribute name, a second attribute field corresponding to the second attribute name, the first attribute field being a field in the first data table, the second attribute field being a field in the second data table;
The parameter mapping relation comprises the following steps: the mapping relation between the first data table name and the first data table name segment, the mapping relation between the second data table name and the second data table name segment, the mapping relation between the first attribute name and the first attribute field, and the mapping relation between the second attribute name and the second attribute field.
In some optional implementations, the query module invokes a query method in a query parent class based on a query subclass according to the database object parameter, and after obtaining a query result corresponding to the query parameter, the data query device is further configured to perform the following steps:
Converting the query result into target data with a target format;
and sending the target data to the first terminal.
In the embodiment of the application, the query request sent by the first terminal is responded to by the acquisition module to obtain the query parameters, wherein the query parameters are data obtained by the first terminal based on the page operation instruction of the user, so that the user can initiate the data query request through the page operation instruction without using a database query language for coding, and the difficulty of data query is reduced; the database object parameters corresponding to the query parameters are determined through the determining module according to the preset parameter mapping relation, the data format of the query parameters is different from the data format of the database object parameters, namely, the query parameters with different data formats can be mapped into the corresponding database object parameters through the parameter mapping relation, so that the objects of data query can be defined, a user does not need to be familiar with the data representation mode of the database object parameters in the database, and the requirement of the user on the familiarity degree of the database is reduced; according to the database object parameters, the query module is used for calling the query method in the query parent class based on the query subclass, so that a query result corresponding to the query parameters can be obtained, the query subclass is established in a manner of inheriting the query parent class, and the query subclass can directly call the query method in the query parent class due to the data query in a manner of inheriting the parent class, so that a new query method is not required to be written or can be generated only by a small amount of rewriting, the code writing amount in the data query process is greatly reduced, and the data query efficiency is improved.
Fig. 8 is a block diagram of a data query device according to an embodiment of the present application, where the data query device may be applied to a first terminal.
Referring to fig. 8, the data query apparatus 800 may include the following modules.
An obtaining module 801, configured to obtain, in response to a page operation instruction of a user, a query parameter, where the query parameter and a database object parameter have a parameter mapping relationship, and a data format of the query parameter is different from a data format of the database object parameter;
a generating module 802, configured to generate a query request with a target format according to the query parameter;
And the sending module 803 is configured to send a query request to the first server, where the query request is used to instruct the first server to perform data query processing, and feed back a query result corresponding to the query parameter to the first terminal.
In some alternative implementations, the page operation instructions include page input instructions and/or page click instructions.
In the embodiment of the application, the query parameters are obtained through the obtaining module in response to the page operation instruction, wherein the query parameters are data obtained by the first terminal based on the page operation instruction of the user, so that the user can initiate a data query request through the page operation instruction without using a database query language for coding, the difficulty of data query is reduced, the data format of the query parameters is different from the data format of the database object parameters, and the query parameters with different data formats can be mapped into the corresponding database object parameters through the parameter mapping relation, so that the object of the data query can be clarified, and therefore, the user does not need to be familiar with the data representation mode of the database object parameters in the database, thereby reducing the requirement of the user on the familiarity degree of the database; and generating a query request with a target format according to the query parameters through the generation module, sending the query request to the first server based on the sending module, indicating the first server to execute data query processing through the query request, and feeding back a query result corresponding to the query parameters to the first terminal.
In a third aspect, an embodiment of the present application provides a data query system.
Fig. 9 is a block diagram of a data query system according to an embodiment of the present application.
Referring to fig. 9, the data query system 900 may include: at least one first server 910 and at least one first terminal 920;
The at least one first server 910 is configured to execute any item of data query method corresponding to the first server in the embodiment of the present application, and the at least one first terminal 920 is configured to execute any item of data query method corresponding to the first terminal in the embodiment of the present application.
In the embodiment of the application, a first terminal responds to a page operation instruction, acquires a query parameter, generates a query request with a target format according to the query parameter, and sends the query request to a first server; the first server responds to a query request sent by the first terminal to obtain query parameters, determines database object parameters corresponding to the query parameters according to a preset parameter mapping relation, and calls a query method in a query parent class based on a query subclass according to the database object parameters to obtain a query result corresponding to the query parameters. The query parameters are data obtained by the first terminal based on the page operation instruction of the user, so that the user can initiate a data query request through the page operation instruction without using a database query language to encode, and the difficulty of data query is reduced; the first server can determine the database object parameters corresponding to the query parameters according to the preset parameter mapping relation, the data format of the query parameters is different from the data format of the database object parameters, namely, the query parameters with different data formats can be mapped into the corresponding database object parameters through the parameter mapping relation, so that the object of data query can be defined, a user does not need to be familiar with the data representation mode of the database object parameters in the database, and the requirement of the user on the familiarity degree of the database is reduced; in addition, the query subclass is established in a manner of inheriting the query parent class, and the data query is carried out in a manner of inheriting the parent class, so that the query subclass can directly call the query method in the query parent class, a new query method is not required to be written or can be generated only by a small amount of rewriting, the code writing amount in the data query process is greatly reduced, and the data query efficiency is improved.
The various modules in the data querying device/data querying system described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In addition, the application also provides electronic equipment and a computer readable storage medium, and the electronic equipment and the computer readable storage medium can be used for realizing any one of the data query methods provided by the application, and the corresponding technical scheme and description and corresponding records of the method parts are omitted.
Fig. 10 is a block diagram of an electronic device according to an embodiment of the present application.
Referring to fig. 10, an embodiment of the present application provides an electronic device including: at least one processor 1001; at least one memory 1002, and one or more I/O interfaces 1003, connected between the processor 1001 and the memory 1002; the memory 1002 stores one or more computer programs executable by the at least one processor 1001, and the one or more computer programs are executed by the at least one processor 1001 to enable the at least one processor 1001 to perform the data query method described above.
The various modules in the electronic device described above may be implemented in whole or in part in software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
The embodiment of the application also provides a computer readable storage medium, on which a computer program is stored, wherein the computer program realizes the data query method when being executed by a processor/processing core. The computer readable storage medium may be a volatile or nonvolatile computer readable storage medium.
Embodiments of the present application also provide a computer program product comprising computer readable code, or a non-transitory computer readable storage medium carrying computer readable code, which when executed in a processor of an electronic device, performs the above-described data query method.
Those of ordinary skill in the art will appreciate that all or some of the steps, systems, functional modules/units in the apparatus, and methods disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. In a hardware implementation, the division between the functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed cooperatively by several physical components. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer-readable storage media, which may include computer storage media (or non-transitory media) and communication media (or transitory media).
The term computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable program instructions, data structures, program modules or other data, as known to those skilled in the art. Computer storage media includes, but is not limited to, random Access Memory (RAM), read Only Memory (ROM), erasable Programmable Read Only Memory (EPROM), static Random Access Memory (SRAM), flash memory or other memory technology, portable compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical disc storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by a computer. Furthermore, as is well known to those of ordinary skill in the art, communication media typically embodies computer readable program instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and may include any information delivery media.
The computer readable program instructions described herein may be downloaded from a computer readable storage medium to a respective computing/processing device or to an external computer or external storage device over a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmissions, wireless transmissions, routers, firewalls, switches, gateway computers and/or edge servers. The network interface card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium in the respective computing/processing device.
Computer program instructions for carrying out operations of the present application may be assembly instructions, instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as SMALLTALK, C ++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer readable program instructions may be executed entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, aspects of the present application are implemented by personalizing electronic circuitry, such as programmable logic circuitry, field Programmable Gate Arrays (FPGAs), or Programmable Logic Arrays (PLAs), with state information for computer readable program instructions, which can execute the computer readable program instructions.
The computer program product described herein may be embodied in hardware, software, or a combination thereof. In an alternative embodiment, the computer program product is embodied as a computer storage medium, and in another alternative embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), or the like.
Various aspects of the present application are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable medium having the instructions stored therein includes an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted in a generic and descriptive sense only and not for purpose of limitation. In some instances, it will be apparent to one skilled in the art that features, characteristics, and/or elements described in connection with a particular embodiment may be used alone or in combination with other embodiments unless explicitly stated otherwise. It will therefore be understood by those of ordinary skill in the art that various changes in form and details may be made therein without departing from the scope of the present application as set forth in the following claims.

Claims (11)

1. A method of querying data, the method being applied to a first server, the method comprising:
obtaining query parameters in response to a query request sent by a first terminal;
Determining a database object parameter corresponding to the query parameter according to a preset parameter mapping relation, wherein the parameter mapping relation is used for representing the mapping relation between the query parameter and the database object parameter, and the data format of the query parameter is different from the data format of the database object parameter;
and according to the database object parameters, calling a query method in a query parent class based on a query subclass to obtain a query result corresponding to the query parameters, wherein the query subclass is established in a manner of inheriting the query parent class.
2. The method of claim 1, wherein the query parameters include a data table name and an attribute name within the data table;
The obtaining the query parameters in response to the query request sent by the first terminal comprises the following steps:
Acquiring a list object in the query request;
obtaining the data table name according to the table name element in the list object;
And obtaining the attribute name according to the attribute elements in the list object.
3. The method according to claim 2, wherein the data table names include a first data table name and a second data table name, the attribute names include a first attribute name and a second attribute name, the first attribute corresponding to the first attribute name is an attribute in the first data table, the second attribute corresponding to the second attribute name is an attribute in the second data table, and the query request is used for querying a correlation result between the first attribute and the second attribute;
The database object parameters include: a first data table name field corresponding to the first data table name, a second data table name field corresponding to the second data table name, a first attribute field corresponding to the first attribute name, a second attribute field corresponding to the second attribute name, wherein the first attribute field is a field in a first data table, and the second attribute field is a field in a second data table;
The parameter mapping relation comprises the following steps: the mapping relation between the first data table name and the first data table name segment, the mapping relation between the second data table name and the second data table name segment, the mapping relation between the first attribute name and the first attribute field, and the mapping relation between the second attribute name and the second attribute field.
4. The method according to claim 1, wherein after the query result corresponding to the query parameter is obtained by calling a query method in a query parent class based on a query child class according to the database object parameter, the method further comprises:
Converting the query result into target data with a target format;
and sending the target data to the first terminal.
5. A data query method, wherein the method is applied to a first terminal, the method comprising:
Responding to a page operation instruction, acquiring a query parameter, wherein a parameter mapping relation exists between the query parameter and a database object parameter, and the data format of the query parameter is different from that of the database object parameter;
generating a query request with a target format according to the query parameters;
And sending the query request to a first server, wherein the query request is used for indicating the first server to execute data query processing and feeding back a query result corresponding to the query parameter to the first terminal.
6. The method of claim 5, wherein the page operation instruction comprises a page input instruction and/or a page click instruction.
7. A data query system, the data query system comprising: at least one first terminal and at least one first server;
The first server is configured to perform the data query method according to any one of claims 1 to 4, and the first terminal is configured to perform the data query method according to any one of claims 5 to 6.
8. A data query device, wherein the data query device is disposed on a first server, the device comprising:
The acquisition module is used for responding to the query request sent by the first terminal to obtain query parameters;
The determining module is used for determining database object parameters corresponding to the query parameters according to a preset parameter mapping relation, wherein the parameter mapping relation is used for representing the mapping relation between the query parameters and the database object parameters, and the data format of the query parameters is different from the data format of the database object parameters;
And the query module is used for calling a query method in a query parent class based on a query subclass according to the database object parameters to obtain a query result corresponding to the query parameters, wherein the query subclass is established in a manner of inheriting the query parent class.
9. A data query device, wherein the data query device is disposed at a first terminal, the device comprising:
the acquisition module is used for responding to the page operation instruction and acquiring query parameters, wherein the query parameters and the database object parameters have parameter mapping relations, and the data format of the query parameters is different from that of the database object parameters;
the generation module is used for generating a query request with a target format according to the query parameters;
the sending module is used for sending the query request to a first server, wherein the query request is used for indicating the first server to execute data query processing and feeding back a query result corresponding to the query parameter to the first terminal.
10. An electronic device, comprising:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores one or more computer programs executable by the at least one processor to enable the at least one processor to perform the data query method of any one of claims 1-4 or the data query method of any one of claims 5-6.
11. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements a data query method according to any of claims 1-4 or a data query method according to any of claims 5-6.
CN202311085182.2A 2023-08-25 2023-08-25 Data query method, device, system, electronic equipment and storage medium Pending CN117951154A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311085182.2A CN117951154A (en) 2023-08-25 2023-08-25 Data query method, device, system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311085182.2A CN117951154A (en) 2023-08-25 2023-08-25 Data query method, device, system, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117951154A true CN117951154A (en) 2024-04-30

Family

ID=90795003

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311085182.2A Pending CN117951154A (en) 2023-08-25 2023-08-25 Data query method, device, system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117951154A (en)

Similar Documents

Publication Publication Date Title
CN110083650B (en) Metadata self-discovery-based automatic generation method for data query interface
CN110489433B (en) MongoDB-based message processing method and device and electronic equipment
CN108762808A (en) The generation method and system of interface document
WO2023142911A1 (en) Service processing method and device
WO2018053594A1 (en) Emoji images in text messages
CN111400554B (en) Access method and device for unified tag library
EP3217632A1 (en) Oid configuration, parsing method, client, node, database and storage medium
CN111708805A (en) Data query method and device, electronic equipment and storage medium
US20220245155A1 (en) Distributed multi-source data processing and publishing platform
CN114036425A (en) Page access method, client, server and system
CN114722036A (en) Data processing method and device, electronic equipment and readable storage medium
CN112434115B (en) Data processing method and device, electronic equipment and readable storage medium
CN111078773B (en) Data processing method and device
JP2022552435A (en) Methods and apparatus for pushing subscription data in the Internet of Things, and devices and storage media thereof
CN117951154A (en) Data query method, device, system, electronic equipment and storage medium
CN109255065A (en) A kind of method and reporting system of report form processing
CN110308907A (en) Data transfer device, device, storage medium and electronic equipment
CN112287177B (en) Method and device for creating, changing, displaying and inquiring object label
CN107977381B (en) Data configuration method, index management method, related device and computing equipment
CN115114321A (en) Dynamic query method and system
CN115795187A (en) Resource access method, device and equipment
CN114036178A (en) Service interface generation method, device, computer and readable storage medium
CN112835573A (en) Data query method and device, electronic equipment and storage medium
CN112596719A (en) Method and system for generating front-end and back-end codes
CN111309932A (en) Comment data query method, device, equipment and storage medium

Legal Events

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