CN113094574A - Information query method and device, electronic equipment and readable storage medium - Google Patents

Information query method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN113094574A
CN113094574A CN202110381794.0A CN202110381794A CN113094574A CN 113094574 A CN113094574 A CN 113094574A CN 202110381794 A CN202110381794 A CN 202110381794A CN 113094574 A CN113094574 A CN 113094574A
Authority
CN
China
Prior art keywords
query
result
information
data format
parameter
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
CN202110381794.0A
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.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and 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 QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202110381794.0A priority Critical patent/CN113094574A/en
Publication of CN113094574A publication Critical patent/CN113094574A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9532Query formulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines

Landscapes

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

Abstract

The embodiment of the invention provides an information query method, an information query device, electronic equipment and a readable storage medium, and relates to the technical field of computers, wherein the information query method comprises the steps of receiving a first query statement sent by a client, wherein the first query statement is a query statement in a first data format; converting the first query statement into a second query statement, wherein the second query statement is a query statement in a second data format; querying based on the query method parameter, the query condition parameter and the target result parameter of the second data format in the second query statement to obtain a first query result corresponding to the second data format; and generating a second query result corresponding to the first data format based on the first query result, and sending the second query result to the client. Therefore, the target result information corresponding to the query condition parameters and the target result parameters can be obtained, all information corresponding to the user does not need to be obtained, and the query speed can be increased.

Description

Information query method and device, electronic equipment and readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an information query method and apparatus, an electronic device, and a readable storage medium.
Background
With the continuous development of internet technology, user information can be stored through a network, and when the user information is needed, a user can inquire the needed user information through the network. At present, when inquiring user information based on a REST interface request form, user information of a user is usually inquired by using an identifier uniquely corresponding to the user, in practice, the user information includes user registration basic information, user operation information, contract information and the like, if the user information of the user is inquired by using the identifier uniquely corresponding to the user, all information of the user is acquired, and a certain part of user information cannot be acquired separately, so that in the inquiry process, the returned data volume is large, and the problem of slow inquiry is caused.
Disclosure of Invention
The embodiment of the invention aims to provide an information query method, an information query device, electronic equipment and a readable storage medium, so as to solve the problem of slow information query in the prior art. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides an information query method, which is applied to a server, and includes:
receiving a first query statement sent by a client, wherein the first query statement is in a first data format;
converting the first query statement into a second query statement, wherein the second query statement is a query statement in a second data format and comprises a query method parameter, a query condition parameter and a target result parameter, and the target result parameter is used for representing the attribute of target result information which is set by a client and needs to be returned;
querying based on the query method parameter, the query condition parameter and the target result parameter of a second data format in the second query statement to obtain a first query result corresponding to the second data format;
and generating a second query result corresponding to the first data format based on the first query result, and sending the second query result to the client.
In a second aspect, an embodiment of the present application provides an information query apparatus, which is applied to a server, and includes:
the system comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving a first query statement sent by a client, and the first query statement is in a first data format;
the conversion module is used for converting the first query statement into a second query statement, the second query statement is a query statement in a second data format, the second query statement comprises query method parameters, query condition parameters and target result parameters, and the target result parameters are used for representing attributes of target result information which is set by a client and needs to be returned;
the query module is used for querying based on the query method parameter, the query condition parameter and the target result parameter of a second data format in the second query statement to obtain a first query result corresponding to the second data format;
and the sending module is used for generating a second query result corresponding to the first data format based on the first query result and sending the second query result to the client.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor and the communication interface complete communication between the memory and the processor through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of the first aspect when executing the program stored in the memory.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, which when executed by a processor, implements the method steps of the first aspect.
According to the information query method provided by the embodiment of the invention, a first query statement sent by a client is received, wherein the first query statement is a query statement in a first data format; converting the first query statement into a second query statement, wherein the second query statement is a query statement in a second data format and comprises a query method parameter, a query condition parameter and a target result parameter, and the target result parameter is used for representing the attribute of target result information which is set by the client and needs to be returned; querying based on the query method parameter, the query condition parameter and the target result parameter of the second data format in the second query statement to obtain a first query result corresponding to the second data format; and generating a second query result corresponding to the first data format based on the first query result, and sending the second query result to the client. Therefore, the first query statement is converted into the second query statement, the query is performed based on the query method parameter, the query condition parameter and the target result parameter of the second data format in the second query statement, only the target result information corresponding to the query condition parameter and the target result parameter can be obtained, and all information corresponding to the user does not need to be obtained, so that the query speed can be increased, and the query efficiency can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a flowchart of an information query method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a user interface according to an embodiment of the invention;
FIG. 3 is a flowchart of querying using a GraphQL framework in an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of an information query apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device in an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
At present, when inquiring user information based on a REST interface request, the user information of a user is usually inquired by using an identifier uniquely corresponding to the user, in practice, the user information includes user registration basic information, user operation information, contract information and the like, and if the user information of the user is inquired by using the identifier uniquely corresponding to the user, all information of the user is acquired. Based on this, the embodiment of the application provides an information query method.
It should be understood that the information query method provided in the embodiment of the present application may be applied to, but is not limited to, query of user information, and for example, may also be applied to different service scenarios such as aggregation interface query. For example, interfaces used at different clients are required. Also for example, some type of operations back-office system. This is by way of example only and not by way of limitation.
Referring to fig. 1, fig. 1 is a diagram illustrating an information query method applied to a server according to an embodiment of the present application, including:
step 101, a server receives a first query statement sent by a client, wherein the first query statement is in a first data format.
It should be noted that, before the server receives the first query statement sent by the client, the following steps are further included.
The client generates a first query statement.
The client may include a custom module, and when the first query statement is generated, the custom module receives a first input of a user acting on a preset user interface.
The user interface includes a human-computer interaction interface, as shown in fig. 2, the human-computer interaction interface includes a plurality of controls operable by a user, and each control is arranged on the human-computer interaction interface according to a certain rule. The first input executed by the user on the user interface means that the user operates the control, and the operation includes operations of dragging, clicking, sliding and the like performed by the user on the control, which is only an example and is not limited herein. Alternatively, in other possible embodiments, the first input may also be other types of inputs, but any transformation thereof is within the scope of the embodiments of the present application. Specifically, in this embodiment, a drag is taken as an example to describe in detail the first input.
The user-defined module responds to the first input and generates a first query statement corresponding to the first input, wherein the first query statement is in a first data format. The first query statement comprises a query method parameter, a query condition parameter and a target result parameter, wherein the target result parameter is used for representing the attribute of target result information which is set by the client and needs to be returned. And the client sends the first query statement to the server.
Step 102, the server converts the first query statement into a second query statement, the second query statement is a query statement in a second data format, the second query statement comprises query method parameters, query condition parameters and target result parameters, and the target result parameters are used for representing attributes of target result information which is set by the client and needs to be returned.
Specifically, the query method parameter represents a function method called by a query employed by the client, the query condition parameter represents tag information uniquely corresponding to the user, and may be, for example, the UID of the user, and the target result parameter represents a set attribute of the target result information that needs to be returned, and may be, for example, height information, age information, and the like of the user. The examples are given herein by way of illustration only and not by way of limitation. Step 103, the server queries based on the query method parameter, the query condition parameter and the target result parameter of the second data format in the second query statement to obtain a first query result corresponding to the second data format.
The second data format is a data format different from the first data format, for example, the first data format is a JSON format, and the second data format is a GraphQL format. In other words, in this embodiment, the server converts the JSON-formatted first query statement into the GraphQL-formatted second query statement, and then performs a query using the GraphQL-formatted second query statement.
And 104, the server generates a second query result corresponding to the first data format based on the first query result, and sends the second query result to the client.
Specifically, after obtaining a first query result corresponding to the GraphQL format, the server converts the first query result corresponding to the GraphQL format into a second query result corresponding to the JSON format, and sends the second query result corresponding to the JSON format to the client. Therefore, the server can adopt a GraphQL framework for query, can realize a dynamic, on-demand and asynchronous parallel request mode, and achieves the purpose of quickly responding to query.
According to the information query method, the first query statement is converted into the second query statement, query is carried out based on the query method parameter, the query condition parameter and the target result parameter of the second data format in the second query statement, only the target result information corresponding to the query condition parameter and the target result parameter can be obtained, and all information corresponding to a user does not need to be obtained, so that the query speed can be increased, and the query efficiency is improved.
In some possible embodiments, the first data format is JSON format, the second data format is GraphQL format, and converting the first query statement into the second query statement includes:
the server analyzes the first query statement according to the JSON format to obtain a query method parameter, a query condition parameter and a target result parameter which are contained in the first query statement;
and the server generates a second query statement according to the GraphQL format by using the query method parameters, the query condition parameters and the target result parameters.
In the embodiment, in a first query statement sent by a client, a query method parameter is "method: userInfoById" in JSON format, a query condition parameter is "uid, 8888888", and a target result parameter is "result: selefmediainfo, nickname". Then, the second query statement generated may be "userInfoById (uid:8888888) in graphQL format, { selfmediaInfo { uid: 1234. nickname: ming's ". This is by way of example only and not by way of limitation. Thus, through format conversion, as shown in fig. 3, a GraphQL framework can be used for query, and a dynamic, on-demand, asynchronous and parallel request mode can be realized, so as to achieve the purpose of quickly responding to the query.
In some possible embodiments, the querying based on the query method parameter, the query condition parameter, and the target result parameter of the second data format in the second query statement to obtain the first query result corresponding to the second data format includes:
acquiring first query information corresponding to the query condition parameters by using the query method parameters in the second data format;
and obtaining a first query result corresponding to the second data format based on the first query information and the target result parameter.
In this embodiment, the first query information corresponding to the query condition parameter may refer to all query information corresponding to the query condition parameter, for example, when the query condition parameter is "uid: 1234", the first query information is all query information corresponding to "uid: 1234", and when the information is called through the interface, the first query information may refer to all relevant information stored in the interface having a mapping relationship with "uid: 1234".
It should be noted that the user information is stored in a target object, where the target object may be a database locally stored at a client or a database stored in a cloud on a server, and the database is externally provided with an interface, and all information stored in the database corresponding to the interface can be acquired by calling the interface. That is, the first query information may be all the related information of "uid: 1234" stored in the target object.
Further, the target result parameter is matched with the first query information, and a first query result corresponding to the target result parameter is determined from the first query information. For example, when the target result parameter is "basic, individualName", the information associated with "basic, individualName" is screened from all the related information of "uid: 1234" stored in the target object, and is returned as the first query result, so that matching screening is performed through the target result parameter, only the information associated with the target result parameter needs to be returned, all the first query information does not need to be returned, the query speed is increased, and data redundancy is reduced.
In an actual situation, the queried first query information may include target result information corresponding to the target result parameter, or may not include target result information corresponding to the target result parameter. Obtaining a first query result corresponding to the second data format based on the first query information and the target result parameter, including:
screening out target result information corresponding to the target result parameter from the first query information under the condition that the first query information comprises the target result information corresponding to the target result parameter, and generating a first query result based on the target result information;
and under the condition that the first query information does not include the target result information corresponding to the target result parameter, generating prompt information as the first query result, wherein the prompt information is used for indicating that the second query statement is not successful in query.
In this embodiment, when the server successfully screens the target result information corresponding to the target result parameter in the first query information, the target result information corresponding to the target result parameter is directly used as the first query result, the first query result is returned to the client, and the client analyzes and displays the first query result.
In addition, the server returns prompt information that the query of the target query statement is unsuccessful to send to the client under the condition that the target result information corresponding to the target result parameter in the first query information is not successfully screened, and the client analyzes the prompt information and displays a prompt of unsuccessful query to the user. For example, the prompt content may be text information such as "query failed" or "lack of query condition field, query failed" and the like, and the client analyzes the text prompt information and displays it. The present invention is not limited to the above embodiments, but may be other types of prompt messages in other possible embodiments, and any modifications thereof are within the protection scope of the embodiments of the present application. Therefore, the user can know the information query result intuitively.
In some possible embodiments, in order to facilitate the client to quickly resolve the query result, whether the first query result corresponding to the second query statement is obtained by successful query may be represented by the service code, where before generating the second query result corresponding to the first data format based on the first query result, the information query method further includes:
generating a service code, wherein the service code is used for indicating whether the query is successful or not to obtain a first query result corresponding to the second query statement;
generating a second query result corresponding to the first data format based on the first query result, including:
adding a first identification field to the first query result, wherein the first identification field carries a service code;
and generating a second query result corresponding to the first data format based on the first identification field and the first query result.
In this embodiment, the server generates a service code for indicating whether the query is successful or not to obtain the first query result corresponding to the second query statement according to the query condition, so that the corresponding service code is sent to the client, and the client can quickly identify the query result according to the service code.
Specifically, the service code is stored in the first identification field, for example, the first identification field may be "msg", and when the value of "msg" is "sessions", the query is successful, alternatively, in some feasible embodiments, when the value of "msg" is not 0, the query may be unsuccessful, and when the value of "msg" is-1, the query is unsuccessful because the query condition parameter is lacked and the queried user object cannot be determined. The service code may be other values, but it is within the scope of the embodiments of the present application, regardless of the transformation.
In some possible embodiments, before generating the second query result corresponding to the first data format based on the first query result, the information query method further includes:
generating a state code, wherein the state code is used for indicating whether the working state of the server is abnormal or not;
generating a second query result corresponding to the first data format based on the first query result, including:
adding a second identification field to the first query result, wherein the second identification field carries a state code;
and generating a second query result corresponding to the first data format based on the second identification field and the first query result.
In the actual query, the reason for the failure of the query also includes that a database storing user information or a server fails, and in this case, the server generates a corresponding status code to prompt the server to be abnormal.
Specifically, the second identification field stores a status code, for example, if the second identification field is "code", and the status code is "0", then the second identification field may identify that the server is operating normally, and if the status code is not 0, the second identification field may indicate that the server is abnormal. In this way, the client can quickly identify the state of the server according to the state code.
Alternatively, in a possible implementation manner, if the first query statement does not include the target result parameter, all information in the category to which the query condition parameter belongs is returned according to the query condition parameter included in the first query statement. For example, if the user id attribute does not specify a return result according to the uid query, the uid, the nickname of the user, the user type, and the like are returned.
It should be noted that, various optional implementations described in the embodiments of the present invention may be implemented in combination with each other or implemented separately, and the embodiments of the present invention are not limited thereto.
Referring to fig. 4, fig. 4 is a structural diagram of an information query apparatus 400 according to an embodiment of the present invention, and as shown in fig. 4, the information query apparatus 400 includes:
a receiving module 401, configured to receive a first query statement sent by a client, where the first query statement is a query statement in a first data format;
a conversion module 402, configured to convert the first query statement into a second query statement, where the second query statement is a query statement in a second data format, and the second query statement includes a query method parameter, a query condition parameter, and a target result parameter, and the target result parameter is used to represent an attribute of target result information that needs to be returned and is set by a client;
the query module 403 is configured to perform a query based on the query method parameter, the query condition parameter, and the target result parameter in the second data format in the second query statement, and obtain a first query result corresponding to the second data format;
a sending module 404, configured to generate a second query result corresponding to the first data format based on the first query result, and send the second query result to the client.
Optionally, the first data format is a JSON format, the second data format is a GraphQL format, and the conversion module 402 includes:
the analysis submodule is used for analyzing the first query statement according to the JSON format to obtain the query method parameters, the query condition parameters and the target result parameters contained in the first query statement;
and the first generation submodule is used for generating the second query statement by the query method parameters, the query condition parameters and the target result parameters according to the GraphQL format.
Optionally, the query module 403 includes:
the first obtaining sub-module is used for obtaining first query information corresponding to the query condition parameters by using the query method parameters in the second data format;
and the second obtaining sub-module is used for obtaining a first query result corresponding to the second data format based on the first query information and the target result parameter.
Optionally, the second obtaining sub-module includes:
the screening submodule is used for screening out target result information corresponding to the target result parameter in the first query information under the condition that the first query information comprises the target result information corresponding to the target result parameter, and generating the first query result based on the target result information;
and a second generation sub-module, configured to generate, when the first query information does not include target result information corresponding to the target result parameter, prompt information as the first query result, where the prompt information is used to indicate that the query by the second query statement is unsuccessful.
Optionally, the information query apparatus 400 further includes:
a third generating sub-module, configured to generate a service code, where the service code is used to indicate whether a first query result corresponding to the second query statement is obtained by successful query;
the sending module comprises:
a first adding submodule, configured to add a first identification field to the first query result, where the first identification field carries the service code;
and the fourth generation submodule is used for generating the second query result corresponding to the first data format based on the first identification field and the first query result.
Optionally, the information query apparatus 400 further includes:
a fifth generation submodule, configured to generate a status code, where the status code is used to indicate whether a working state of the server is abnormal;
the sending module comprises:
a second adding submodule, configured to add a second identification field to the first query result, where the second identification field carries the status code;
and a sixth generating sub-module, configured to generate the second query result corresponding to the first data format based on the second identification field and the first query result.
The information query apparatus 400 can implement the various implementation manners of the method embodiments described above, and can achieve the same effect, which is not described herein again.
The embodiment of the present invention further provides an electronic device, as shown in fig. 5, including a processor 501, a communication interface 502, a memory 503 and a communication bus 504, where the processor 501, the communication interface 502 and the memory 503 complete mutual communication through the communication bus 504;
a memory 503 for storing a computer program;
the processor 501, when executing the program stored in the memory 503, implements the following steps:
receiving a first query statement sent by a client, wherein the first query statement is in a first data format;
converting the first query statement into a second query statement, wherein the second query statement is a query statement in a second data format and comprises a query method parameter, a query condition parameter and a target result parameter, and the target result parameter is used for representing the attribute of target result information which is set by a client and needs to be returned;
querying based on the query method parameter, the query condition parameter and the target result parameter of a second data format in the second query statement to obtain a first query result corresponding to the second data format;
and generating a second query result corresponding to the first data format based on the first query result, and sending the second query result to the client.
Optionally, the converting the first query statement into a second query statement includes:
analyzing the first query statement according to the JSON format to obtain the query method parameters, the query condition parameters and the target result parameters contained in the first query statement;
and generating the second query statement by using the query method parameters, the query condition parameters and the target result parameters according to the GraphQL format.
Optionally, the querying based on the query method parameter, the query condition parameter, and the target result parameter of the second data format in the second query statement to obtain the first query result corresponding to the second data format includes:
acquiring first query information corresponding to the query condition parameter by using the query method parameter of the second data format;
and obtaining a first query result corresponding to the second data format based on the first query information and the target result parameter.
Optionally, the obtaining a first query result corresponding to the second data format based on the first query information and the target result parameter includes:
screening out target result information corresponding to the target result parameter from the first query information under the condition that the first query information comprises the target result information corresponding to the target result parameter, and generating the first query result based on the target result information;
and generating prompt information as the first query result under the condition that the first query information does not include target result information corresponding to the target result parameter, wherein the prompt information is used for indicating that the second query statement is not successful in query.
Optionally, before generating a second query result corresponding to the first data format based on the first query result, the method further includes:
generating a service code, wherein the service code is used for indicating whether the query is successful or not to obtain a first query result corresponding to the second query statement;
generating a second query result corresponding to the first data format based on the first query result includes:
adding a first identification field to the first query result, wherein the first identification field carries the service code;
and generating the second query result corresponding to the first data format based on the first identification field and the first query result.
Optionally, before generating a second query result corresponding to the first data format based on the first query result, the method further includes:
generating a state code, wherein the state code is used for indicating whether the working state of the server is abnormal or not;
generating a second query result corresponding to the first data format based on the first query result includes:
adding a second identification field to the first query result, wherein the second identification field carries the status code;
and generating the second query result corresponding to the first data format based on the second identification field and the first query result.
The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the terminal and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In another embodiment of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to execute the information query method described in any one of the above embodiments.
In yet another embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the information query method of any one of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. An information query method is applied to a server, and is characterized by comprising the following steps:
receiving a first query statement sent by a client, wherein the first query statement is in a first data format;
converting the first query statement into a second query statement, wherein the second query statement is a query statement in a second data format and comprises a query method parameter, a query condition parameter and a target result parameter, and the target result parameter is used for representing the attribute of target result information which is set by a client and needs to be returned;
querying based on the query method parameter, the query condition parameter and the target result parameter of a second data format in the second query statement to obtain a first query result corresponding to the second data format;
and generating a second query result corresponding to the first data format based on the first query result, and sending the second query result to the client.
2. The information query method according to claim 1, wherein the first data format is a JSON format, the second data format is a GraphQL format, and the converting the first query statement into a second query statement comprises:
analyzing the first query statement according to the JSON format to obtain the query method parameters, the query condition parameters and the target result parameters contained in the first query statement;
and generating the second query statement by using the query method parameters, the query condition parameters and the target result parameters according to the GraphQL format.
3. The information query method according to claim 1, wherein the querying based on the query method parameter, the query condition parameter and the target result parameter of the second data format in the second query statement to obtain the first query result corresponding to the second data format includes:
acquiring first query information corresponding to the query condition parameter by using the query method parameter of the second data format;
and obtaining a first query result corresponding to the second data format based on the first query information and the target result parameter.
4. The information query method of claim 3, wherein the obtaining a first query result corresponding to the second data format based on the first query information and the target result parameter comprises:
screening out target result information corresponding to the target result parameter from the first query information under the condition that the first query information comprises the target result information corresponding to the target result parameter, and generating the first query result based on the target result information;
and generating prompt information as the first query result under the condition that the first query information does not include target result information corresponding to the target result parameter, wherein the prompt information is used for indicating that the second query statement is not successful in query.
5. The information query method of claim 1, wherein before generating the second query result corresponding to the first data format based on the first query result, the method further comprises:
generating a service code, wherein the service code is used for indicating whether the query is successful or not to obtain a first query result corresponding to the second query statement;
generating a second query result corresponding to the first data format based on the first query result includes:
adding a first identification field to the first query result, wherein the first identification field carries the service code;
and generating the second query result corresponding to the first data format based on the first identification field and the first query result.
6. The information query method of claim 1, wherein before generating the second query result corresponding to the first data format based on the first query result, the method further comprises:
generating a state code, wherein the state code is used for indicating whether the working state of the server is abnormal or not;
generating a second query result corresponding to the first data format based on the first query result includes:
adding a second identification field to the first query result, wherein the second identification field carries the status code;
and generating the second query result corresponding to the first data format based on the second identification field and the first query result.
7. An information inquiry device applied to a server is characterized by comprising:
the system comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving a first query statement sent by a client, and the first query statement is in a first data format;
the conversion module is used for converting the first query statement into a second query statement, the second query statement is a query statement in a second data format, the second query statement comprises query method parameters, query condition parameters and target result parameters, and the target result parameters are used for representing attributes of target result information which is set by a client and needs to be returned;
the query module is used for querying based on the query method parameter, the query condition parameter and the target result parameter of a second data format in the second query statement to obtain a first query result corresponding to the second data format;
and the sending module is used for generating a second query result corresponding to the first data format based on the first query result and sending the second query result to the client.
8. The information query device of claim 7, wherein the first data format is JSON format, the second data format is GraphQL format, and the conversion module comprises:
the analysis submodule is used for analyzing the first query statement according to the JSON format to obtain the query method parameters, the query condition parameters and the target result parameters contained in the first query statement;
and the first generation submodule is used for generating the second query statement by the query method parameters, the query condition parameters and the target result parameters according to the GraphQL format.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 6 when executing a program stored in the memory.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method steps of any one of claims 1 to 6.
CN202110381794.0A 2021-04-09 2021-04-09 Information query method and device, electronic equipment and readable storage medium Pending CN113094574A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110381794.0A CN113094574A (en) 2021-04-09 2021-04-09 Information query method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110381794.0A CN113094574A (en) 2021-04-09 2021-04-09 Information query method and device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN113094574A true CN113094574A (en) 2021-07-09

Family

ID=76675605

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110381794.0A Pending CN113094574A (en) 2021-04-09 2021-04-09 Information query method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN113094574A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114116823A (en) * 2021-11-29 2022-03-01 杭州数理大数据技术有限公司 Query interface generation method, data query method and device
CN114896272A (en) * 2022-06-15 2022-08-12 北京奇艺世纪科技有限公司 Information acquisition method and device, electronic equipment and computer readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112163000A (en) * 2020-08-31 2021-01-01 阿里巴巴集团控股有限公司 Data query method and device
CN112597187A (en) * 2021-03-03 2021-04-02 北京冠新医卫软件科技有限公司 GraphQL query method and device based on FHIR standard

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112163000A (en) * 2020-08-31 2021-01-01 阿里巴巴集团控股有限公司 Data query method and device
CN112597187A (en) * 2021-03-03 2021-04-02 北京冠新医卫软件科技有限公司 GraphQL query method and device based on FHIR standard

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114116823A (en) * 2021-11-29 2022-03-01 杭州数理大数据技术有限公司 Query interface generation method, data query method and device
CN114896272A (en) * 2022-06-15 2022-08-12 北京奇艺世纪科技有限公司 Information acquisition method and device, electronic equipment and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN110347560B (en) Method, device, system, equipment and medium for prompting abnormity of big data product
CN108427705B (en) Electronic device, distributed system log query method and storage medium
CN113364853A (en) Business service system, business request method and gateway equipment
CN105337787A (en) Multi-server monitoring method, device and system
CN113094574A (en) Information query method and device, electronic equipment and readable storage medium
CN113079198B (en) Method and device for converting cloud platform interface protocol
CN111680108A (en) Data storage method and device and data acquisition method and device
CN114389969B (en) Method and device for testing client, electronic equipment and storage medium
US20180074797A1 (en) Transform a data object in a meta model based on a generic type
CN111008254B (en) Object creation method, device, computer equipment and storage medium
CN116055551A (en) Information pushing method, device and system, electronic equipment and storage medium
CN111506641A (en) Data management method, data acquisition platform, data management system and storage medium
CN117668560A (en) Model training and plug-in predicting method, device, equipment, medium and product
CN111026972B (en) Subscription data pushing method, device, equipment and storage medium in Internet of things
CN112988589A (en) Interface testing method, device and system
CN111124542A (en) Configuration information management system
CN113239048B (en) Data management method and device, electronic equipment and storage medium
CN114090268B (en) Container management method and container management system
CN113590180B (en) Detection strategy generation method and device
CN115905227A (en) Data import method and device, electronic equipment and storage medium
CN113468446A (en) Method, system and equipment for supporting identification of third-party two-dimensional code data
CN112835573A (en) Data query method and device, electronic equipment and storage medium
CN112579325A (en) Business object processing method and device, electronic equipment and storage medium
CN111708828A (en) Tagged data management method, device, equipment and computer readable storage medium
CN112468443A (en) Method and system for realizing optimization decision through big data situation analysis

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