CN113535749A - Query statement generation method and device - Google Patents

Query statement generation method and device Download PDF

Info

Publication number
CN113535749A
CN113535749A CN202010306797.3A CN202010306797A CN113535749A CN 113535749 A CN113535749 A CN 113535749A CN 202010306797 A CN202010306797 A CN 202010306797A CN 113535749 A CN113535749 A CN 113535749A
Authority
CN
China
Prior art keywords
field
query statement
user
editing interface
query
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010306797.3A
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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN202010306797.3A priority Critical patent/CN113535749A/en
Publication of CN113535749A publication Critical patent/CN113535749A/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/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages

Landscapes

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

Abstract

The method comprises the steps of receiving a field selection instruction of a user, and selecting a corresponding field on a query statement target editing interface based on the field selection instruction; inquiring a preset component corresponding table; determining a field operator and an input component corresponding to the field type of the field in the preset component corresponding table; receiving a field value corresponding to the field selected by the user based on the input component, and generating a query statement based on the field, a field operator corresponding to the field, and the field value.

Description

Query statement generation method and device
Technical Field
The embodiment of the specification relates to the technical field of computers, in particular to a query statement generation method. One or more embodiments of the present specification also relate to a query statement generation apparatus, a computing device, and a computer-readable storage medium.
Background
In some existing project management, processing of database data is often involved, such as accessing data, querying, updating, managing data, and the like, and these data processing logics all need to be implemented by SQL (Structured Query Language) statements, which not only need to be manually written by a special developer, but also when the nesting logics of SQL statements are complex, errors easily occur when SQL statements are directly written, resulting in low writing efficiency of SQL statements.
Disclosure of Invention
In view of this, the present specification provides a query statement generation method. One or more embodiments of the present specification also relate to a query statement generation apparatus, a computing device, and a computer-readable storage medium to address technical deficiencies in the prior art.
According to a first aspect of embodiments of the present specification, there is provided a query statement generation method including:
receiving a field selection instruction of a user, and selecting a corresponding field on a query statement target editing interface based on the field selection instruction;
inquiring a preset component corresponding table, wherein the preset component corresponding table comprises corresponding relations of field types, field operators and input components;
determining a field operator and an input component corresponding to the field type of the field in the preset component corresponding table;
displaying the input component to the user, and receiving a field value corresponding to the field selected by the user based on the input component;
generating a query statement based on the field type, a field operator to which the field corresponds, and the field value.
According to a second aspect of embodiments of the present specification, there is provided a query statement generation apparatus including:
the field selection module is configured to receive a field selection instruction of a user and select a corresponding field on a query statement target editing interface based on the field selection instruction;
the field query module is configured to query a preset component corresponding table, wherein the preset component corresponding table comprises corresponding relations of field types, field operators and input components;
a component determination module configured to determine a field operator corresponding to a field type of the field and an input component in the preset component correspondence table;
a field value determination module configured to present an input component to the user and receive a field value corresponding to the field selected by the user based on the input component;
a query statement generation module configured to generate a query statement based on the field type, a field operator corresponding to the field, and the field value.
According to a third aspect of embodiments herein, there is provided a computing device comprising:
a memory and a processor;
the memory is to store computer-executable instructions, and the processor is to execute the computer-executable instructions to:
receiving a field selection instruction of a user, and selecting a corresponding field on a query statement target editing interface based on the field selection instruction;
inquiring a preset component corresponding table, wherein the preset component corresponding table comprises corresponding relations of field types, field operators and input components;
determining a field operator and an input component corresponding to the field type of the field in the preset component corresponding table;
displaying the input component to the user, and receiving a field value corresponding to the field selected by the user based on the input component;
generating a query statement based on the field type, a field operator to which the field corresponds, and the field value.
According to a fourth aspect of embodiments herein, there is provided a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the query statement generation method.
One embodiment of the specification provides a query statement generation method and a query statement generation device, wherein the method comprises the steps of receiving a field selection instruction of a user, and selecting a corresponding field on a query statement target editing interface based on the field selection instruction; inquiring a preset component corresponding table, wherein the preset component corresponding table comprises corresponding relations of field types, field operators and input components; determining a field operator and an input component corresponding to the field type of the field in the preset component corresponding table; displaying the input component to the user, and receiving a field value corresponding to the field selected by the user based on the input component; generating a query statement based on the field type, a field operator corresponding to the field, and the field value; the query statement generation method realizes the visual generation of the query statement through the operation of a user on a query statement target editing interface, and can determine different value input modes according to the relationship between the field and the preset component corresponding table, thereby enhancing the user experience.
Drawings
FIG. 1 is a flow diagram of a query statement generation method provided by an embodiment of the present specification;
FIG. 2 is a diagram illustrating an example of an interface for initial editing of a query statement, according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating a specific application of a query statement generation method according to an embodiment of the present specification;
fig. 4 is a schematic structural diagram of a query statement generation apparatus according to an embodiment of the present specification;
fig. 5 is a block diagram of a computing device according to an embodiment of the present disclosure.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present description. This description may be embodied in many different forms and should not be construed as limited to the embodiments set forth herein, as those skilled in the art will be able to make and use the present disclosure without departing from the spirit and scope of the present disclosure.
The terminology used in the description of the one or more embodiments is for the purpose of describing the particular embodiments only and is not intended to be limiting of the description of the one or more embodiments. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present specification refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It will be understood that, although the terms first, second, etc. may be used herein in one or more embodiments to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first can also be referred to as a second and, similarly, a second can also be referred to as a first without departing from the scope of one or more embodiments of the present description. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
First, the noun terms to which one or more embodiments of the present specification relate are explained.
SQL: chinese characters are fully called: structured query language, english full name: structured Query Language, is a Structured database Query Language.
Rule: the output result of the visual structure of the single SQL condition is similar to that of the visual structure: a >1, b! 2, etc.
Rule set: multiple SQL conditions accompany the nesting and combination of logical declarations, the output result is similar to: a >1And b! 2.
Front-end analysis: the method refers to directly outputting the spliced SQL Where condition at the front end (browser end).
Back-end analysis: the method is characterized in that a front end outputs a complete json structure, and a rear end (a server) analyzes and outputs a spliced SQL Where condition after being taken.
In the present specification, a query statement generation method is provided, and the present specification relates to a query statement generation apparatus, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
Referring to fig. 1, fig. 1 shows a flowchart of a query statement generation method provided according to an embodiment of the present specification, including steps 102 to 110.
Step 102: receiving a field selection instruction of a user, and selecting a corresponding field in a query statement target editing interface based on the field selection instruction.
The field selection instruction includes, but is not limited to, a field selection instruction implemented based on a click operation of the user, a field selection instruction implemented based on voice information of the user, and the like.
Specifically, when the field selection instruction includes a field selection instruction implemented based on a click operation of a user, selecting a corresponding field on the query statement target editing interface based on the field selection instruction, which may be understood as determining, based on the click operation, the field corresponding to the click operation selected by the user on the query statement target editing interface after receiving the click operation of the user on the query statement target editing interface;
under the condition that the field selection instruction comprises a field selection instruction realized based on voice information of a user, selecting a corresponding field on the query statement target editing interface based on the field selection instruction, wherein the field selection instruction can be understood as receiving the voice information of the user aiming at the query statement target editing interface, and analyzing the voice information by using the existing voice analysis method to determine the field on the query statement target editing interface corresponding to the voice information.
In practice, we call each row in each table of the database a "record," and each record contains all the information in this row. And fields are smaller units than records, with a collection of fields making up a record, each field describing a certain characteristic of the document.
In a specific implementation, before receiving the field selection instruction of the user, the method further includes:
receiving a query statement generation instruction sent by the user, and determining a query statement initial editing interface based on the query statement generation instruction;
and responding to the operation of the user on the query statement initial editing interface based on the query information to obtain a query statement target editing interface.
The query statement generation instruction includes, but is not limited to, a query statement generation instruction implemented based on a click operation of a user and a query statement generation instruction implemented based on voice information of the user, and a specific implementation manner may refer to the description of the field selection instruction, which is not described herein again.
The query statement generation method provided by one or more embodiments of the present specification may be applied to any cloud service product such as a public cloud and a private cloud, for example, in a certain bill management system of the public cloud, after clicking a "query statement generation" field in a home page of the bill management system, an initial editing interface of the visual query statement of fig. 2 is displayed, and a user may generate a query statement based on the initial editing interface of the visual query statement.
Referring to fig. 2, fig. 2 is an exemplary diagram illustrating an initial editing interface of a visual query statement provided in an embodiment of the present specification, where the initial editing interface of the visual query statement of fig. 2 includes a rule group, and the rule group includes two rules and a sub-rule group, where the sub-rule group includes three rules. In practical application, the initial editing interface of the visual query statement may be set according to practical application, and only the overall structure of the rule group needs to be represented, and is not limited to the mode in fig. 2, for example, the initial editing interface of the visual query statement may also include only one rule group and one rule under one rule group, or may include only one or more rules, and the like.
In practical application, the structure of the rule set is as follows: logical selection (add/Or/Not) + rule set operation (add, delete) + rule list, where the logical selection corresponds to "And/Or" in fig. 2, the rule set operation corresponds to "add" in fig. 2, And the rule list corresponds to a list composed of a rule arranged at the lower level of each rule set in fig. 2; specifically, the logic of the rule group may further include "Not", the rule group operation may further include "delete", and the like, and the next level structure of each rule group may be an individual rule or an individual sub-rule group, or a combination of a rule and a sub-rule group, and the like;
the structure of the rule is: the field selection + field operator selection + value input + rule operation, where the field selection corresponds to the "demand name, priority" option in fig. 2, the field operator selection corresponds to the "include" option in fig. 2, the value input corresponds to the "please enter" option in fig. 2, and the rule operation corresponds to the plus and minus signs in fig. 2.
In this embodiment of the present specification, after determining the query statement initial editing interface, the responding to the operation of the user on the query statement initial editing interface based on the query information to obtain the query statement target editing interface specifically includes:
and responding to a creating instruction of the user for the query statement initial editing interface based on the query information, creating a rule group corresponding to the query information on the query statement initial editing interface, and obtaining a query statement target editing interface, wherein the rule group comprises one or more rules and/or one or more rule groups.
The query information is information for generating an SQL condition based on the query information by the user, and for example, the query information is: (a >1And b ═ 2) or (c >4And d ═ 3).
For example, if the query information is: (a >1And b ═ 2) or (c >4And d ═ 3), in response to a creation instruction of the user to the query sentence initial editing interface based on query information, creating a rule group corresponding to the query information on the query sentence initial editing interface, And obtaining a query sentence target editing interface, including:
the user can determine to generate a rule group one (a >1And b ═ 2) And a rule group two (c >4And d ═ 3) based on the query information, wherein the logical relationship between the rule group one And the rule group two is "or", the rule group one comprises two rules a >1And b ═ 2, And the logical relationship between the rules is "sum"; the rule group two comprises two rules c >4, d ═ 3, and the logical relationship between the rules is "and"; and the user realizes a creation instruction aiming at the query statement initial editing interface through clicking operation based on the query information, and creates a rule group and a rule corresponding to the query information on the query statement initial editing interface to obtain a query statement target editing interface which consists of a rule group I, a rule group II, two rules at the first lower level of the rule group and two rules at the second lower level of the rule group.
In addition, after the obtaining of the query statement target editing interface, the method further includes:
and modifying the query statement target editing interface based on the modification instruction of the user, wherein the modification instruction comprises an adding instruction and/or a deleting instruction.
It can be known from the above embodiments that the query statement target editing interface is composed of a plurality of rule groups and rules, and each rule group and rule can be added or deleted, so that the query statement target editing interface can be modified based on the modification instruction of the user.
Specifically, the modifying the query statement target editing interface based on the modification instruction of the user includes:
adding and/or deleting the rule group or the rule in the query statement target editing interface based on the modification instruction of the user.
The modification instruction of the user can be referred to the above embodiments, and includes, but is not limited to, a modification instruction implemented based on a click operation of the user or a modification instruction implemented based on voice information of the user.
In practical application, based on the modification instruction of the user, adding and/or deleting the rules in the rule group in the query statement target editing interface can be realized through a rule group and an adding and deleting button or a plus and minus button behind the rules.
In another embodiment of the present specification, in a case that the query statement target editing interface is composed of a rule group and a rule, the receiving a field selection instruction of a user, and selecting a corresponding field in the query statement target editing interface based on the field selection instruction includes:
and receiving a field selection instruction of the user, and selecting a corresponding field in the rules of the rule group of the query statement target editing interface based on the field selection instruction.
Wherein the rule is composed of a field, a field operator corresponding to the field and an input component.
In the embodiment of the specification, a target editing interface of a visual query statement is obtained by responding to the operation of the user on the initial editing interface of the visual query statement based on the query information, so that the subsequent visual generation of the query statement based on the target editing interface is realized, and the user experience is enhanced; in addition, the target editing interface of the visual query statement is composed of a rule group and rules, and can assist in generating complex nested query statements, so that the nested logic is clear.
Step 104: and querying a preset component corresponding table, wherein the preset component corresponding table comprises the corresponding relation of the field type, the field operator and the input component.
Wherein, the field type includes but is not limited to character string type, numerical type and date type; the preset component correspondence table includes the correspondence between field types, field operators, and input components, as shown in table 1.
TABLE 1
Figure BDA0002456070820000101
Here, table 1 is only referred to as an example, and in an actual application, the correspondence between the field type, the field operator, and the input component in the preset component correspondence table may be set according to the actual application, which is not limited herein.
Specifically, querying the preset component correspondence table may be understood as querying the preset component correspondence table based on the field type of the field, and obtaining a field operator and an input component in the preset component correspondence table corresponding to the field type of the field.
Step 106: and determining field operators and input components corresponding to the field types of the fields in the preset component corresponding table.
In specific implementation, if a field operator and an input component corresponding to a field type of a field can be queried in a preset component correspondence table, determining the field operator and the input component corresponding to the field type of the field in the preset component correspondence table;
and if the field type of the field cannot be inquired in the preset component corresponding table, providing a calling interface of the input component corresponding to the field type of the field, and calling the corresponding input component for the field based on the calling interface.
Step 108: and displaying an input component to the user, and receiving a field value corresponding to the field selected by the user based on the input component.
Specifically, the input component is the value input component in table 1, the field type of the field may be queried in the preset component correspondence table, then a field operator and an input component corresponding to the field type of the field are determined in the preset component correspondence table, and then the input component may be used to input the field value corresponding to the field, for example, if the field type is a date type, the field type corresponds to a date input component such as DatePicker, and the field value corresponding to the field may be directly selected by the input component, that is, the date, without manual input by a user, thereby improving user experience.
In this embodiment of the present specification, if the field type of the selected field is in the preset component correspondence table, a field operator and an input component corresponding to the field type may be directly selected based on the preset component correspondence table, so that a user may select a field value corresponding to the field through the input component; if the field type of the selected field is not in the preset component corresponding table, the input component corresponding to the field type can be directly called through the calling interface of the input component corresponding to the field type, deep customization of the input component by a user is realized through the two modes, various requirements of the user are met through customizing field operators of different field types and the corresponding input components, user experience is greatly improved, and the expansibility of the query statement generating method is strong.
Step 110: generating a query statement based on the field type, a field operator to which the field corresponds, and the field value.
Specifically, after the corresponding input component is determined based on the field type of the field, the field value corresponding to the field selected by the user based on the input component may be received without manual filling by the user, and the query statement may be generated based on the field type, the field operator corresponding to the field, and the field value.
In specific implementation, there are two ways to generate the query statement, which are specifically as follows:
the generating a query statement based on the field type, a field operator corresponding to the field, and the field value comprises:
and splicing the field type, the field operator corresponding to the field and the field value to generate the spliced query statement.
In practical application, under the condition of receiving a generation instruction sent by the user, the field type, the field operator corresponding to the field and the field value are spliced to generate the spliced query statement.
The generating instruction includes, but is not limited to, a generating instruction implemented based on a click operation of a user and a generating instruction implemented based on voice information of the user.
Specifically, under the condition of receiving the generation instruction sent by the user, the field type, the field operator corresponding to the field, and the field value are directly spliced through front-end analysis to generate the spliced query statement.
In order to ensure the security of data under the condition that the query condition includes sensitive information such as a password and a certificate number, the query statement may be generated by adopting a back-end analysis, which is specifically implemented as follows:
the generating a query statement based on the field type, a field operator corresponding to the field, and the field value comprises:
and converting the field type, the field operator corresponding to the field and the field value into a json character string and sending the json character string to a server so as to generate the query statement.
In practical application, under the condition of receiving a generation instruction sent by a user, the field type, a field operator corresponding to the field and a field value are converted into a json character string and sent to a server side to generate the query statement.
Specifically, the back-end analysis is that the front end converts the field type, the field operator corresponding to the field, and the field value into a complete character string of a json structure and directly sends the complete character string of the json structure to the server, and the server analyzes the character string of the json structure and generates a corresponding query statement; in practical application, the query statement generated at the front end is in a natural language form which can be understood by a user, and the query statement generated at the rear end is in a machine language form, so that a privacy effect is ensured.
In an embodiment of the present specification, the query statement generation method includes receiving a field selection instruction of a user, and selecting a corresponding field in a query statement target editing interface based on the field selection instruction; inquiring a preset component corresponding table, wherein the preset component corresponding table comprises corresponding relations of field types, field operators and input components; determining a field operator and an input component corresponding to the field type of the field in the preset component corresponding table; displaying the input component to the user, and receiving a field value corresponding to the field selected by the user based on the input component; generating a query statement based on the field type, a field operator corresponding to the field, and the field value; the query statement generation method realizes the visual generation of the query statement through the operation of a user on a query statement target editing interface, and can determine different value input modes according to the relationship between the field and the preset component corresponding table, thereby enhancing the user experience.
Referring to fig. 3, fig. 3 is a schematic diagram illustrating a specific application of a query statement generation method according to an embodiment of the present specification, including step 302 to step 328.
Step 302: and querying a statement initial editing interface.
Specifically, the query statement initial editing interface receives a query statement generation instruction sent by a user, and determines the query statement initial editing interface based on the query statement generation instruction.
Step 304: and establishing a new rule group.
Specifically, a rule set is newly created, that is, a rule set creation instruction of the user for the query statement initial editing interface based on the query information is received, and a rule set corresponding to the query information is created on the query statement initial editing interface.
Step 306: and (5) newly establishing a rule.
Specifically, a rule is newly created, that is, a rule creation instruction of the user for the rule group based on the query information is received, and a rule corresponding to the query information is created under the rule group of the query statement initial editing interface, so that a query statement target editing interface is obtained.
Step 308: a field is selected.
Specifically, selecting a field, that is, receiving a field selection instruction of the user, and selecting a corresponding field in a query statement target editing interface based on the field selection instruction.
Step 310: a field operator is selected.
Specifically, a field operator is selected, that is, a field operator and an input component corresponding to the field type are determined based on the field type of the field.
Step 312: a field value is input.
Specifically, inputting a field value, that is, receiving a field value corresponding to the field selected by the user based on the input component, and completing the establishment of the rule.
Step 314: and deleting the rule.
Specifically, the rule is deleted, that is, the established rule is deleted in the case of receiving the modification instruction of the user.
Step 316: selecting a logical operation of the current rule set.
Specifically, the logic operation of the current rule group is selected, that is, the establishment of the current rule group is completed based on the established rules, and the logic of the current rule group is selected.
Step 318: the rule set is deleted.
Specifically, the rule set is deleted, that is, the established rule set is deleted in the case of receiving the modification instruction of the user.
In practice, the steps 314 and 318 are not necessarily executed, and are executed only when receiving the modification instruction from the user. In practical applications, step 316 may be directly executed after step 312 is executed, and step 320 is executed sequentially, and the specific execution sequence may be set according to practical applications, which is not limited herein.
Step 320: selecting a logical operation of the current rule set.
Specifically, the logic operation of the current rule set is selected, that is, the generation instruction sent by the user is received, and the newly-created rule and the rule set are submitted to the front end.
Step 322: front-end parsing.
Specifically, the front-end analysis determines whether to perform the front-end analysis, if so, step 324 is executed, and if not, step 326 is executed.
Step 324: outputting the Where condition.
Specifically, the Where condition is output, that is, the query statement after concatenation is generated based on the field, the field operator corresponding to the field, and the field value.
Step 326: and outputting a finished json structure.
Specifically, the json structure is output and completed, that is, the field operator corresponding to the field, and the field value are converted into a json character string and sent to the server.
Step 328: and (5) back-end analysis.
Specifically, the back-end parsing, that is, the server parses the json character string to generate the query statement, and ends the query statement generation flow.
Specifically, the query statement is a Where condition output by the front end.
In the embodiment of the present specification, the query statement generation method provides a scheme for editing a visual query statement, which can not only implement customizing a corresponding value input component based on a field type, so that a user experiences different field value input modes, but also implement two schemes of generating a query statement for front-end analysis and back-end analysis for the user to select, thereby enhancing the user experience.
Corresponding to the above method embodiment, the present specification further provides an embodiment of a query statement generation apparatus, and fig. 4 shows a schematic structural diagram of the query statement generation apparatus provided in an embodiment of the present specification.
As shown in fig. 4, the apparatus includes:
a field selection module 402 configured to receive a field selection instruction of a user and select a corresponding field in a query statement target editing interface based on the field selection instruction;
a field query module 404 configured to query a preset component correspondence table, where the preset component correspondence table includes a correspondence between field types, field operators, and input components;
a component determination module 406 configured to determine a field operator corresponding to a field type of the field and an input component in the preset component correspondence table;
a field value determination module 408 configured to present an input component to the user and receive a field value corresponding to the field selected by the user based on the input component;
a query statement generation module 410 configured to generate a query statement based on the field type, a field operator to which the field corresponds, and the field value.
Optionally, the apparatus further includes:
and the interface calling module is configured to provide a calling interface of the input component corresponding to the field type of the field if the field type of the field cannot be inquired in the preset component corresponding table, and call the corresponding input component for the field based on the calling interface.
Optionally, the apparatus further includes:
the initial editing interface generating module is configured to receive a query statement generating instruction sent by the user and determine a query statement initial editing interface based on the query statement generating instruction;
and the target editing interface generating module is configured to respond to the operation of the user on the query statement initial editing interface based on the query information to obtain a query statement target editing interface.
Optionally, the target editing interface generating module is further configured to:
and responding to a creating instruction of the user for the query statement initial editing interface based on the query information, creating a rule group corresponding to the query information on the query statement initial editing interface, and obtaining a query statement target editing interface, wherein the rule group comprises one or more rules and/or one or more rule groups.
Optionally, the apparatus further includes:
a modification module configured to modify the query statement target editing interface based on a modification instruction of the user, wherein the modification instruction includes an addition and/or deletion instruction.
Optionally, the modifying module is further configured to:
and adding and/or deleting the rule group in the query statement target editing interface based on the modification instruction of the user.
Optionally, the field selection module 402 is further configured to:
and receiving a field selection instruction of the user, and selecting a corresponding field in the rules of the rule group of the query statement target editing interface based on the field selection instruction.
Optionally, the rule includes a field, a field operator corresponding to the field, and an input component.
Optionally, the query statement generating module 410 is further configured to:
and splicing the field type, the field operator corresponding to the field and the field value to generate the spliced query statement.
Optionally, the query statement generating module 410 is further configured to:
and converting the field type, the field operator corresponding to the field and the field value into a json character string and sending the json character string to a server so as to generate the query statement.
One embodiment of the present specification provides a query statement generation apparatus, which implements visual generation of a query statement by a user operating a query statement target editing interface, and may determine different value input modes according to a relationship between a field and a preset component correspondence table, thereby enhancing user experience.
The above is a schematic scheme of a query statement generating apparatus according to this embodiment. It should be noted that the technical solution of the query statement generation apparatus and the technical solution of the query statement generation method belong to the same concept, and details of the technical solution of the query statement generation apparatus, which are not described in detail, can be referred to the description of the technical solution of the query statement generation method.
FIG. 5 illustrates a block diagram of a computing device 500 provided in accordance with one embodiment of the present description. The components of the computing device 500 include, but are not limited to, a memory 510 and a processor 520. Processor 520 is coupled to memory 510 via bus 530, and database 550 is used to store data.
Computing device 500 also includes access device 540, access device 540 enabling computing device 500 to communicate via one or more networks 560. Examples of such networks include the Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. The access device 540 may include one or more of any type of network interface, e.g., a Network Interface Card (NIC), wired or wireless, such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the present description, the above-described components of computing device 500, as well as other components not shown in FIG. 5, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device architecture shown in FIG. 5 is for purposes of example only and is not limiting as to the scope of the present description. Those skilled in the art may add or replace other components as desired.
Computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), mobile phone (e.g., smartphone), wearable computing device (e.g., smartwatch, smartglasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 500 may also be a mobile or stationary server.
Wherein processor 520 is configured to execute the following computer-executable instructions:
receiving a field selection instruction of a user, and selecting a corresponding field on a query statement target editing interface based on the field selection instruction;
inquiring a preset component corresponding table, wherein the preset component corresponding table comprises corresponding relations of field types, field operators and input components;
determining a field operator and an input component corresponding to the field type of the field in the preset component corresponding table;
displaying the input component to the user, and receiving a field value corresponding to the field selected by the user based on the input component;
generating a query statement based on the field type, a field operator to which the field corresponds, and the field value.
The above is an illustrative scheme of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the query statement generation method belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the query statement generation method.
An embodiment of the present specification also provides a computer-readable storage medium storing computer instructions, which when executed by a processor, implement the steps of the query statement generation method.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium and the technical solution of the query statement generation method belong to the same concept, and details that are not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the query statement generation method.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The computer instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that, for the sake of simplicity, the foregoing method embodiments are described as a series of acts, but those skilled in the art should understand that the present embodiment is not limited by the described acts, because some steps may be performed in other sequences or simultaneously according to the present embodiment. Further, those skilled in the art should also appreciate that the embodiments described in this specification are preferred embodiments and that acts and modules referred to are not necessarily required for an embodiment of the specification.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The preferred embodiments of the present specification disclosed above are intended only to aid in the description of the specification. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the embodiments and the practical application, to thereby enable others skilled in the art to best understand and utilize the embodiments. The specification is limited only by the claims and their full scope and equivalents.

Claims (13)

1. A query statement generation method, comprising:
receiving a field selection instruction of a user, and selecting a corresponding field on a query statement target editing interface based on the field selection instruction;
inquiring a preset component corresponding table, wherein the preset component corresponding table comprises corresponding relations of field types, field operators and input components;
determining a field operator and an input component corresponding to the field type of the field in the preset component corresponding table;
displaying the input component to the user, and receiving a field value corresponding to the field selected by the user based on the input component;
generating a query statement based on the field type, a field operator to which the field corresponds, and the field value.
2. The query statement generation method according to claim 1, further comprising:
and if the field type of the field cannot be inquired in the preset component corresponding table, providing a calling interface of the input component corresponding to the field type of the field, and calling the corresponding input component for the field based on the calling interface.
3. The query statement generation method according to claim 1, further comprising, before receiving a field selection instruction of a user:
receiving a query statement generation instruction sent by the user, and determining a query statement initial editing interface based on the query statement generation instruction;
and responding to the operation of the user on the query statement initial editing interface based on the query information to obtain a query statement target editing interface.
4. The query statement generation method according to claim 3, wherein the obtaining of the query statement target editing interface in response to the user operating the query statement initial editing interface based on the query information includes:
and responding to a creating instruction of the user for the query statement initial editing interface based on the query information, creating a rule group corresponding to the query information on the query statement initial editing interface, and obtaining a query statement target editing interface, wherein the rule group comprises one or more rules and/or one or more rule groups.
5. The query statement generation method according to claim 4, further comprising, after the obtaining of the query statement target editing interface:
and modifying the query statement target editing interface based on the modification instruction of the user, wherein the modification instruction comprises an adding instruction and/or a deleting instruction.
6. The query statement generation method according to claim 5, wherein the modifying the query statement target editing interface based on the modification instruction of the user includes:
and adding and/or deleting the rule group in the query statement target editing interface based on the modification instruction of the user.
7. The query statement generation method according to claim 4, wherein the receiving a field selection instruction of a user and selecting a corresponding field in a query statement target editing interface based on the field selection instruction comprises:
and receiving a field selection instruction of the user, and selecting a corresponding field in the rules of the rule group of the query statement target editing interface based on the field selection instruction.
8. The query statement generation method according to claim 7, wherein the rule includes a field, a field operator corresponding to the field, and an input component.
9. The query statement generation method according to claim 1, wherein the generating a query statement based on the field type, a field operator corresponding to the field, and the field value comprises:
and splicing the field type, the field operator corresponding to the field and the field value to generate the spliced query statement.
10. The query statement generation method according to claim 1, wherein the generating a query statement based on the field type, a field operator corresponding to the field, and the field value comprises:
and converting the field type, the field operator corresponding to the field and the field value into a json character string and sending the json character string to a server so as to generate the query statement.
11. A query statement generation apparatus comprising:
the field selection module is configured to receive a field selection instruction of a user and select a corresponding field on a query statement target editing interface based on the field selection instruction;
the field query module is configured to query a preset component corresponding table, wherein the preset component corresponding table comprises corresponding relations of field types, field operators and input components;
a component determination module configured to determine a field operator corresponding to a field type of the field and an input component in the preset component correspondence table;
a field value determination module configured to present an input component to the user and receive a field value corresponding to the field selected by the user based on the input component;
a query statement generation module configured to generate a query statement based on the field type, a field operator corresponding to the field, and the field value.
12. A computing device, comprising:
a memory and a processor;
the memory is to store computer-executable instructions, and the processor is to execute the computer-executable instructions to:
receiving a field selection instruction of a user, and selecting a corresponding field on a query statement target editing interface based on the field selection instruction;
inquiring a preset component corresponding table, wherein the preset component corresponding table comprises corresponding relations of field types, field operators and input components;
determining a field operator and an input component corresponding to the field type of the field in the preset component corresponding table;
displaying the input component to the user, and receiving a field value corresponding to the field selected by the user based on the input component;
generating a query statement based on the field type, a field operator to which the field corresponds, and the field value.
13. A computer-readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the query statement generation method of any one of claims 1 to 10.
CN202010306797.3A 2020-04-17 2020-04-17 Query statement generation method and device Pending CN113535749A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010306797.3A CN113535749A (en) 2020-04-17 2020-04-17 Query statement generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010306797.3A CN113535749A (en) 2020-04-17 2020-04-17 Query statement generation method and device

Publications (1)

Publication Number Publication Date
CN113535749A true CN113535749A (en) 2021-10-22

Family

ID=78093508

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010306797.3A Pending CN113535749A (en) 2020-04-17 2020-04-17 Query statement generation method and device

Country Status (1)

Country Link
CN (1) CN113535749A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114297443A (en) * 2021-12-29 2022-04-08 卫宁健康科技集团股份有限公司 Processing method, device and equipment for graph data query statement and storage medium
CN115129188A (en) * 2022-06-29 2022-09-30 北京达佳互联信息技术有限公司 Interactive method, device and equipment based on conditional statement and storage medium
CN115357604A (en) * 2022-10-18 2022-11-18 天聚地合(苏州)科技股份有限公司 Data query method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050154756A1 (en) * 2004-01-08 2005-07-14 International Business Machines Corporation Method of generating database transaction statements based on existing queries
CN109992589A (en) * 2019-04-11 2019-07-09 北京启迪区块链科技发展有限公司 Method, apparatus, server and the medium of SQL statement are generated based on visual page
CN110673847A (en) * 2019-09-24 2020-01-10 北京乐我无限科技有限责任公司 Configuration page generation method and device, electronic equipment and readable storage medium
CN110874367A (en) * 2018-09-03 2020-03-10 阿里巴巴集团控股有限公司 Visualization method and device for structured query language statement

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050154756A1 (en) * 2004-01-08 2005-07-14 International Business Machines Corporation Method of generating database transaction statements based on existing queries
CN110874367A (en) * 2018-09-03 2020-03-10 阿里巴巴集团控股有限公司 Visualization method and device for structured query language statement
CN109992589A (en) * 2019-04-11 2019-07-09 北京启迪区块链科技发展有限公司 Method, apparatus, server and the medium of SQL statement are generated based on visual page
CN110673847A (en) * 2019-09-24 2020-01-10 北京乐我无限科技有限责任公司 Configuration page generation method and device, electronic equipment and readable storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114297443A (en) * 2021-12-29 2022-04-08 卫宁健康科技集团股份有限公司 Processing method, device and equipment for graph data query statement and storage medium
CN114297443B (en) * 2021-12-29 2023-11-24 卫宁健康科技集团股份有限公司 Processing method, device, equipment and storage medium of graph data query statement
CN115129188A (en) * 2022-06-29 2022-09-30 北京达佳互联信息技术有限公司 Interactive method, device and equipment based on conditional statement and storage medium
CN115357604A (en) * 2022-10-18 2022-11-18 天聚地合(苏州)科技股份有限公司 Data query method and device

Similar Documents

Publication Publication Date Title
AU2017200426B2 (en) Automatic customization of a software application
CN113535749A (en) Query statement generation method and device
US20130073969A1 (en) Systems and methods for web based application modeling and generation
US20190050376A1 (en) Automatic value formatting based on intrinsic structural semantics
CA3061623C (en) File sending in instant messaging applications
CN111708805A (en) Data query method and device, electronic equipment and storage medium
CN111324343A (en) Code generation method and device
JP7499946B2 (en) Method and device for training sorting model for intelligent recommendation, method and device for intelligent recommendation, electronic device, storage medium, and computer program
CN107908662A (en) The implementation method and realization device of search system
CN110888672B (en) Expression engine implementation method and system based on metadata architecture
CN108959294B (en) Method and device for accessing search engine
JP7309811B2 (en) Data annotation method, apparatus, electronics and storage medium
CN110851343A (en) Test method and device based on decision tree
US11681868B2 (en) Augmented natural language generation platform
CN115840765A (en) Data processing method and device based on rule engine
CN113138760B (en) Page generation method and device, electronic equipment and medium
US8615744B2 (en) Methods and system for managing assets in programming code translation
KR20220024227A (en) Method and related apparatus for data annotation, computer program
US20220004403A1 (en) Methods of providing an integrated interface that includes a virtual mobile device
CN114239501A (en) Contract generation method, apparatus, device and medium
CN112905757A (en) Text processing method and device
CN113297306B (en) Data processing method and device
CN111309884A (en) Robot dialogue method, device, medium, and electronic apparatus
CN114625705B (en) Method and device for automatically generating UI (user interface) resources in development engine
CN110807089B (en) Question answering method and device and electronic equipment

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