Query statement generation method and device

By receiving the user's field selection instructions and querying the corresponding tables of the preset component, querying query statements are generated, which solves the problems of inefficient SQL statement writing and frequent errors, and realizes the visual generation of query statements and improves user experience.

CN113535749BActive Publication Date: 2025-02-25ALIBABA GROUP HOLDING LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010306797.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-17
Publication Date
2025-02-25
Estimated Expiration
2040-04-17

AI Technical Summary

Technical Problem

In the prior art, the writing efficiency of SQL statements is inefficient, especially when nested logic is complex, errors are prone to occur.

Method used

It provides a query statement generation method. By receiving the user's field selection instructions, selecting the corresponding fields in the query statement target editing interface, querying the preset component corresponding table, determining the operators and input components corresponding to the field type, displaying the input components to the user and receiving the field value, and generating the query statement.

Benefits of technology

Through the user's operations on the query statement target editing interface, visual generation of query statements is achieved, user experience is enhanced, writing errors are reduced, and writing efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113535749B_ABST
    Figure CN113535749B_ABST
Patent Text Reader

Abstract

The embodiments of the present specification provide a method and device for generating a query statement, wherein the method includes receiving a field selection instruction from a user, and selecting a corresponding field in a query statement target editing interface based on the field selection instruction; querying a preset component correspondence table; determining a field operator and an input component corresponding to a field type of the field in the preset component correspondence 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, the field operator corresponding to the field, and the field value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification relate to the field of computer technology, and more particularly to a method for generating a query statement. One or more embodiments of this specification also relate to a query statement generating apparatus, a computing device, and a computer-readable storage medium. Background Art

[0002] Some existing project management often involves the processing of database data, such as accessing data, querying, updating and managing data. These data processing logics need to be implemented through SQL (Structured Query Language) statements, which not only require manual writing by specialized developers, but also when the nested logic of SQL statements is more complex, it is easy to make errors when directly writing SQL statements, resulting in low efficiency in writing SQL statements. Summary of the invention

[0003] In view of this, the embodiments of this specification provide a query statement generation method. One or more embodiments of this specification also relate to a query statement generation device, a computing device, and a computer-readable storage medium to solve the technical defects existing in the prior art.

[0004] According to a first aspect of an embodiment of this specification, a query statement generation method is provided, including:

[0005] Receive a field selection instruction from a user, and select a corresponding field in a query statement target editing interface based on the field selection instruction;

[0006] Querying a preset component correspondence table, wherein the preset component correspondence table includes a correspondence between field types, field operators, and input components;

[0007] In the preset component correspondence table, determining a field operator and an input component corresponding to the field type of the field;

[0008] 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;

[0009] A query statement is generated based on the field type, the field operator corresponding to the field, and the field value.

[0010] According to a second aspect of an embodiment of this specification, a query statement generating device is provided, including:

[0011] A field selection module is configured to receive a field selection instruction from a user and select a corresponding field in a query statement target editing interface based on the field selection instruction;

[0012] A field query module is configured to query a preset component correspondence table, wherein the preset component correspondence table includes a correspondence between field types, field operators, and input components;

[0013] A component determination module, configured to determine a field operator and an input component corresponding to a field type of the field in the preset component correspondence table;

[0014] 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;

[0015] The query statement generating module is configured to generate a query statement based on the field type, the field operator corresponding to the field, and the field value.

[0016] According to a third aspect of an embodiment of this specification, a computing device is provided, including:

[0017] Memory and processor;

[0018] The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions:

[0019] Receive a field selection instruction from a user, and select a corresponding field in a query statement target editing interface based on the field selection instruction;

[0020] Querying a preset component correspondence table, wherein the preset component correspondence table includes a correspondence between field types, field operators, and input components;

[0021] In the preset component correspondence table, determining a field operator and an input component corresponding to the field type of the field;

[0022] 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;

[0023] A query statement is generated based on the field type, the field operator corresponding to the field, and the field value.

[0024] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the query statement generation method are implemented.

[0025] An embodiment of the present specification provides a query statement generation method and device, wherein the method includes receiving a field selection instruction from a user, and selecting a corresponding field in a query statement target editing interface based on the field selection instruction; querying a preset component correspondence table, wherein the preset component correspondence table includes a correspondence between field types, field operators, and input components; in the preset component correspondence table, determining a field operator and an input component corresponding to the field type of the field; 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, the field operator corresponding to the field, and the field value; the query statement generation method realizes visual generation of query statements through user operations in the query statement target editing interface, and can determine different value input methods according to the relationship between the field and the preset component correspondence table, thereby enhancing the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 is a flow chart of a query statement generation method provided by an embodiment of this specification;

[0027] Figure 2 This is an example diagram of an initial editing interface for a query statement provided by an embodiment of this specification;

[0028] Figure 3 This is a specific application diagram of a query statement generation method provided by an embodiment of this specification;

[0029] Figure 4 It is a structural schematic diagram of a query statement generating device provided by an embodiment of this specification;

[0030] Figure 5 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION

[0031] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.

[0032] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0033] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0034] First, the terms involved in one or more embodiments of this specification are explained.

[0035] SQL: Chinese full name: Structured Query Language, English full name: Structured Query Language, is a structured database query language.

[0036] Rule: An intuitive visual structure of a single SQL condition, with output similar to: a>1, b!=2, etc.

[0037] Rule group: multiple SQL conditions with logical statements are nested and combined, and the output result is similar to: a>1And b!=2.

[0038] Front-end parsing: refers to directly outputting the spliced ​​SQL Where conditions on the front-end (browser side).

[0039] Backend parsing: refers to the front-end outputting a complete JSON structure, which the back-end (server) gets and then parses and outputs the spliced ​​SQL Where conditions.

[0040] In this specification, a query statement generation method is provided. This specification also relates to a query statement generation device, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.

[0041] See also Figure 1 , Figure 1A flowchart of a query statement generation method provided according to an embodiment of the present specification is shown, including steps 102 to 110.

[0042] Step 102: receiving a field selection instruction from a user, and selecting a corresponding field in a query statement target editing interface based on the field selection instruction.

[0043] The field selection instructions include, but are not limited to, field selection instructions implemented based on a user's click operation and field selection instructions implemented based on a user's voice information.

[0044] Specifically, in the case where the field selection instruction includes a field selection instruction implemented based on a click operation of the user, selecting a corresponding field on the query statement target editing interface based on the field instruction can be understood as receiving a click operation of the user on the query statement target editing interface, and determining, based on the click operation, the field selected by the user on the query statement target editing interface and corresponding to the click operation;

[0045] In the case where the field selection instruction includes a field selection instruction implemented based on the user's voice information, selecting the corresponding field on the query statement target editing interface based on the field instruction can be understood as after receiving the user's voice information for the query statement target editing interface, parsing the voice information through the existing voice analysis method to determine the field on the query statement target editing interface corresponding to the voice information.

[0046] In practical applications, we call each row in each table of the database a "record", and each record contains all the information in this row. A field is a smaller unit than a record. A set of fields constitutes a record, and each field describes a certain feature of a document.

[0047] In a specific implementation, before receiving the user's field selection instruction, the process further includes:

[0048] Receiving a query statement generation instruction sent by the user, and determining an initial query statement editing interface based on the query statement generation instruction;

[0049] In response to the user's operation on the query statement initial editing interface based on the query information, a query statement target editing interface is obtained.

[0050] Among them, the query statement generation instruction includes but is not limited to a query statement generation instruction implemented based on a user's click operation and a query statement generation instruction implemented based on a user's voice information. The specific implementation method can be found in the above introduction to the field selection instruction, which will not be repeated here.

[0051] The query statement generation method provided in one or more embodiments of this specification can be applied to any cloud service product such as a public cloud or a private cloud. For example, in a bill management system of a public cloud, after clicking the "Query Statement Generation" field on the homepage of the bill management system, a query statement generation method is displayed. Figure 2 The initial editing interface of the visual query statement is displayed, and the user can generate a query statement based on the initial editing interface of the visual query statement.

[0052] See also Figure 2 , Figure 2 An example diagram of an initial editing interface of a visual query statement provided in an embodiment of this specification is shown. Figure 2 The initial editing interface of the visual query statement includes a rule group, which includes two rules and a sub-rule group, wherein the sub-rule group includes three rules. In actual applications, the initial editing interface of the visual query statement can be set according to the actual application, and only needs to reflect the overall structure of the rule group, and is not limited to Figure 2 For example, the initial editing interface of a visual query statement may include only one rule group and one rule under one rule group, or may include only one or several rules.

[0053] In actual applications, the structure of a rule group is: logical selection (And / Or / Not) + rule group operation (addition, deletion) + rule list, where the logical selection corresponds to Figure 2 In the "and / or" rule group operation corresponds to Figure 2 In "Add", the rule list corresponds to Figure 2 A list of rules arranged at the lower level of each rule group; specifically, the logic of the rule group may also include "Not", and the rule group operation may also include "Delete", etc., and the lower level structure of each rule group may be individual rules or individual sub-rule groups, or a combination of rules and sub-rule groups, etc.;

[0054] The structure of the rule is: field selection + field operator selection + value input + rule operation, where field selection corresponds to Figure 2 In the "Requirement Name, Priority" option, select the corresponding field operator Figure 2 In the "Include" option, the value input corresponds to Figure 2 In the "Please enter" option, the rule operation corresponds to Figure 2 The plus and minus signs in .

[0055] In the embodiment of the specification, after determining the query statement initial editing interface, the response to the user's operation on the query statement initial editing interface based on the query information to obtain the query statement target editing interface specifically includes:

[0056] In response to the user's instruction to create the initial editing interface of the query statement based on the query information, a rule group corresponding to the query information is created in the initial editing interface of the query statement to obtain a query statement target editing interface, wherein the rule group includes one or more rules and / or one or more rule groups.

[0057] The query information is information for generating SQL conditions based on the query information by the user, for example, the query information is: (a>1And b=2)or(c>4And d=3).

[0058] For example, if the query information is: (a>1And b=2) or (c>4And d=3), in response to the user's instruction to create the query statement initial editing interface based on the query information, a rule group corresponding to the query information is created in the query statement initial editing interface, and the query statement target editing interface is obtained, including:

[0059] Based on the query information, the user can determine to generate rule group one (a>1And b=2) and rule group two (c>4And d=3), and the logical relationship between rule group one and rule group two is "or", wherein rule group one includes two rules a>1, b=2, and the logical relationship between the rules is "and"; rule group two includes two rules c>4, d=3, and the logical relationship between the rules is "and"; based on the query information, the user implements the creation instruction for the initial editing interface of the query statement through a click operation, creates a rule group and rules corresponding to the query information in the initial editing interface of the query statement, and obtains a query statement target editing interface consisting of rule group one, rule group two, two rules under the rule group, and two rules under the rule group two.

[0060] In addition, after obtaining the query statement target editing interface, the method further includes:

[0061] The query statement target editing interface is modified based on the user's modification instruction, wherein the modification instruction includes an add and / or delete instruction.

[0062] It can be seen 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 the query statement target editing interface can be modified based on the user's modification instruction.

[0063] Specifically, the modifying the query statement target editing interface based on the user's modification instruction includes:

[0064] Based on the modification instruction of the user, the rule group or the rule in the query statement target editing interface is added and / or deleted.

[0065] The user's modification instructions may refer to the above embodiments, including but not limited to modification instructions based on the user's click operation or modification instructions based on the user's voice information.

[0066] In actual applications, based on the user's modification instructions, the rules in the rule group in the query statement target editing interface can be added and / or deleted through the add, delete buttons or plus, minus buttons after the rule group and the rules.

[0067] In another embodiment of the present specification, when the query statement target editing interface is composed of a rule group and rules, the receiving a field selection instruction of the user and selecting a corresponding field in the query statement target editing interface based on the field selection instruction includes:

[0068] A field selection instruction of the user is received, and a corresponding field is selected from the rule of the rule group in the query statement target editing interface based on the field selection instruction.

[0069] The rule is composed of a field, a field operator corresponding to the field, and an input component.

[0070] In the embodiments of the present specification, by responding to the user's operation on the initial editing interface of the visual query statement based on the query information, a target editing interface of the visual query statement is obtained, and subsequent visualization of the query statement based on the target editing interface is realized, thereby enhancing the user experience; in addition, the target editing interface of the visual query statement is composed of rule groups and rules, which can assist in the generation of complex nested query statements and make the nested logic clear.

[0071] Step 104: querying a preset component correspondence table, wherein the preset component correspondence table includes correspondences among field types, field operators, and input components.

[0072] Among them, the field types include but are not limited to string type, numeric type and date type, etc.; and the preset component correspondence table includes the correspondence between field types, field operators and input components, see Table 1.

[0073] Table 1

[0074]

[0075] Here, Table 1 is only used as an example reference. In actual applications, the correspondence between the field types, field operators, and input components in the preset component correspondence table can be set according to actual applications, and no limitation is made here.

[0076] Specifically, querying the preset component correspondence table can be understood as querying the preset component correspondence table based on the field type of the field, and obtaining the field operator and input component corresponding to the field type of the field in the preset component correspondence table.

[0077] Step 106: Determine the field operator and input component corresponding to the field type of the field in the preset component correspondence table.

[0078] In a specific implementation, if the field operator and the input component corresponding to the field type of the field can be queried in the preset component corresponding table, the field operator and the input component corresponding to the field type of the field are determined in the preset component corresponding table;

[0079] If the field type of the field cannot be found in the preset component corresponding table, a calling interface of the input component corresponding to the field type of the field is provided, and the corresponding input component is called for the field based on the calling interface.

[0080] Step 108: Display the input component to the user, and receive the field value corresponding to the field selected by the user based on the input component.

[0081] Specifically, the input component is the value input component in Table 1. The field type of the field can be queried in the preset component corresponding table, and then the field operator and input component corresponding to the field type of the field are determined in the preset component corresponding table. The input component can then be used to input the field value corresponding to the field. For example, if the field type is a date type, then the field type corresponds to a date input component such as DatePicker. The field value corresponding to the field, that is, the date, can be directly selected through the above input component without the need for manual input by the user, thereby improving the user experience.

[0082] In the embodiments of the present specification, if the field type of the selected field is in the preset component corresponding table, the field operator and input component corresponding to the field type can be directly selected based on the preset component corresponding table, so that the user can select the 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, it is allowed to directly call the input component corresponding to the field type through the calling interface of the input component corresponding to the field type. Through the above two methods, the user can deeply customize the input component. By customizing the field operators and corresponding input components of different field types to meet various user needs, the user experience is greatly improved, and the query statement generation method has strong scalability.

[0083] Step 110: Generate a query statement based on the field type, the field operator corresponding to the field, and the field value.

[0084] 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 can be received without the user manually filling in the field, and a query statement can be generated based on the field type, the field operator corresponding to the field, and the field value.

[0085] In specific implementation, there are two ways to generate query statements, as shown below:

[0086] Generating a query statement based on the field type, the field operator corresponding to the field, and the field value includes:

[0087] The field type, the field operator corresponding to the field, and the field value are concatenated to generate the concatenated query statement.

[0088] In actual applications, when receiving the generation instruction sent by the user, the field type, the field operator corresponding to the field, and the field value are concatenated to generate the concatenated query statement.

[0089] The generating instruction includes, but is not limited to, a generating instruction implemented based on a user's click operation and a generating instruction implemented based on a user's voice information.

[0090] Specifically, when receiving the generation instruction sent by the user, the front-end is parsed and directly spliced ​​based on the field type, the field operator corresponding to the field and the field value to generate a spliced ​​query statement.

[0091] When the query conditions contain sensitive information such as passwords and ID numbers, in order to ensure data security, backend parsing can be used to generate query statements. The specific implementation is as follows:

[0092] Generating a query statement based on the field type, the field operator corresponding to the field, and the field value includes:

[0093] The field type, the field operator corresponding to the field, and the field value are converted into a JSON string and sent to the server to generate the query statement.

[0094] In actual applications, when receiving a generation instruction sent by a user, the field type, the field operator corresponding to the field, and the field value are converted into a json string and sent to the server to generate the query statement.

[0095] Specifically, the back-end parsing is that the front-end converts the field type, the field operator corresponding to the field, and the field value into a complete json structure string and sends it directly to the server. The server parses the json structure string and generates a corresponding query statement; wherein, the query statement generated by the front-end and the query statement generated by the back-end are in different forms. In actual applications, the query statement generated by the front-end is in the form of natural language understandable to users, while the query statement generated by the back-end is in the form of machine language to ensure confidentiality.

[0096] In an embodiment of the present specification, the query statement generation method includes receiving a field selection instruction from a user, and selecting a corresponding field in a query statement target editing interface based on the field selection instruction; querying a preset component correspondence table, wherein the preset component correspondence table includes a correspondence between field types, field operators, and input components; in the preset component correspondence table, determining a field operator and an input component corresponding to the field type of the field; 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, the field operator corresponding to the field, and the field value; the query statement generation method realizes visual generation of query statements through user operations in the query statement target editing interface, and can determine different value input methods according to the relationship between the field and the preset component correspondence table to enhance the user experience.

[0097] See also Figure 3 , Figure 3 A specific application schematic diagram of a query statement generation method provided according to an embodiment of the present specification is shown, including steps 302 to 328.

[0098] Step 302: Initial editing interface for query statements.

[0099] 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.

[0100] Step 304: Create a new rule group.

[0101] Specifically, creating a new rule group includes receiving a rule group creation instruction from the user based on the query information for the query statement initial editing interface, and creating a rule group corresponding to the query information in the query statement initial editing interface.

[0102] Step 306: Create a new rule.

[0103] Specifically, creating a new rule means receiving a rule creation instruction from the user for the rule group based on the query information, creating a rule corresponding to the query information under the rule group in the query statement initial editing interface, and obtaining a query statement target editing interface.

[0104] Step 308: Select fields.

[0105] Specifically, selecting a field means receiving a field selection instruction from the user, and selecting a corresponding field in the query statement target editing interface based on the field selection instruction.

[0106] Step 310: Select a field operator.

[0107] Specifically, the field operator is selected, that is, the field operator and the input component corresponding to the field type are determined based on the field type of the field.

[0108] Step 312: Enter field value.

[0109] Specifically, inputting a field value, that is, receiving a field value corresponding to the field selected by the user based on the input component, completes the establishment of the rule.

[0110] Step 314: Delete the rule.

[0111] Specifically, the rule is deleted, that is, the established rule is deleted when receiving the modification instruction from the user.

[0112] Step 316: Select the logical operation of the current rule group.

[0113] Specifically, the logical 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.

[0114] Step 318: Delete the rule group.

[0115] Specifically, the rule group is deleted, that is, the established rule group is deleted when receiving the modification instruction from the user.

[0116] In specific implementation, the execution of step 314 and step 318 is not necessary, and the step will be executed only when the modification instruction of the user is received. In actual application, step 316 can be directly executed after executing step 312, and step 320 can be executed in sequence. The specific execution order can be set according to the actual application and is not limited here.

[0117] Step 320: Select the logical operation of the current rule group.

[0118] Specifically, the logical operation of the current rule group is selected, that is, the generation instruction sent by the user is received, and the newly created rules and rule groups are submitted to the front end.

[0119] Step 322: front-end analysis.

[0120] Specifically, the front-end analysis is to determine whether to perform the front-end analysis. If so, step 324 is executed; if not, step 326 is executed.

[0121] Step 324: Output the Where condition.

[0122] Specifically, the Where condition is output, that is, the concatenated query statement is generated based on the field, the field operator corresponding to the field, and the field value.

[0123] Step 326: Output the completed JSON structure.

[0124] Specifically, the output completes the json structure, that is, the field, the field operator corresponding to the field, and the field value are converted into a json string and sent to the server.

[0125] Step 328: Backend analysis.

[0126] Specifically, the backend parses, that is, the server parses the JSON string to generate the query statement, and ends the query statement generation process.

[0127] Specifically, the query statement is the Where condition output by the front end.

[0128] In the embodiments of the present specification, the query statement generation method provides a solution for visual query statement editing, which can not only customize the corresponding value input component based on the field type, allowing users to experience different field value input methods, but also realize two query statement generation solutions of front-end parsing and back-end parsing for users to choose from, thereby enhancing the user experience.

[0129] Corresponding to the above method embodiment, this specification also provides a query statement generating device embodiment, Figure 4 A schematic diagram of the structure of a query statement generating device provided by an embodiment of the present specification is shown.

[0130] like Figure 4 As shown, the device comprises:

[0131] The field selection module 402 is configured to receive a field selection instruction from a user and select a corresponding field in the query statement target editing interface based on the field selection instruction;

[0132] The field query module 404 is configured to query a preset component correspondence table, wherein the preset component correspondence table includes a correspondence between a field type, a field operator, and an input component;

[0133] A component determination module 406 is configured to determine a field operator and an input component corresponding to a field type of the field in the preset component correspondence table;

[0134] A field value determination module 408 is configured to display an input component to the user and receive a field value corresponding to the field selected by the user based on the input component;

[0135] The query statement generating module 410 is configured to generate a query statement based on the field type, the field operator corresponding to the field, and the field value.

[0136] Optionally, the device further includes:

[0137] 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 found in the preset component corresponding table, and call the corresponding input component for the field based on the calling interface.

[0138] Optionally, the device further includes:

[0139] An initial editing interface generation module is configured to receive a query statement generation instruction sent by the user, and determine a query statement initial editing interface based on the query statement generation instruction;

[0140] The target editing interface generating module is configured to obtain a query statement target editing interface in response to the user's operation on the query statement initial editing interface based on the query information.

[0141] Optionally, the target editing interface generating module is further configured to:

[0142] In response to the user's instruction to create the initial editing interface of the query statement based on the query information, a rule group corresponding to the query information is created in the initial editing interface of the query statement to obtain a query statement target editing interface, wherein the rule group includes one or more rules and / or one or more rule groups.

[0143] Optionally, the device further includes:

[0144] The modification module is configured to modify the query statement target editing interface based on the user's modification instruction, wherein the modification instruction includes an add and / or delete instruction.

[0145] Optionally, the modification module is further configured to:

[0146] Based on the modification instruction of the user, the rule group in the query statement target editing interface is added and / or deleted.

[0147] Optionally, the field selection module 402 is further configured to:

[0148] A field selection instruction of the user is received, and a corresponding field is selected from the rule of the rule group in the query statement target editing interface based on the field selection instruction.

[0149] Optionally, the rule includes a field, a field operator corresponding to the field, and an input component.

[0150] Optionally, the query statement generating module 410 is further configured to:

[0151] The field type, the field operator corresponding to the field, and the field value are concatenated to generate the concatenated query statement.

[0152] Optionally, the query statement generating module 410 is further configured to:

[0153] The field type, the field operator corresponding to the field, and the field value are converted into a JSON string and sent to the server to generate the query statement.

[0154] An embodiment of the present specification provides a query statement generation device that realizes the visual generation of query statements through user operations in the query statement target editing interface, and can determine different value input methods according to the relationship between the field and the preset component correspondence table to enhance the user experience.

[0155] The above is a schematic scheme of a query statement generation device of this embodiment. It should be noted that the technical scheme of the query statement generation device and the technical scheme of the query statement generation method described above belong to the same concept, and the details not described in detail in the technical scheme of the query statement generation device can be referred to the description of the technical scheme of the query statement generation method described above.

[0156] Figure 5 The structure block diagram of a computing device 500 provided according to an embodiment of the present specification is shown. The components of the computing device 500 include but are not limited to a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and the database 550 is used to store data.

[0157] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include a 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)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide 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 the like.

[0158] In one embodiment of the present specification, the above components of the computing device 500 and Figure 5 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 5 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0159] The computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 500 may also be a mobile or stationary server.

[0160] The processor 520 is used to execute the following computer executable instructions:

[0161] Receive a field selection instruction from a user, and select a corresponding field in a query statement target editing interface based on the field selection instruction;

[0162] Querying a preset component correspondence table, wherein the preset component correspondence table includes a correspondence between field types, field operators, and input components;

[0163] In the preset component correspondence table, determining a field operator and an input component corresponding to the field type of the field;

[0164] 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;

[0165] A query statement is generated based on the field type, the field operator corresponding to the field, and the field value.

[0166] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the query statement generation method described above are of the same concept, and the details not described in detail in the technical scheme of the computing device can be found in the description of the technical scheme of the query statement generation method described above.

[0167] An embodiment of the present specification further provides a computer-readable storage medium storing computer instructions, which implement the steps of the query statement generation method when executed by a processor.

[0168] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the query statement generation method described above are of the same concept, and the details not described in detail in the technical scheme of the storage medium can be found in the description of the technical scheme of the query statement generation method described above.

[0169] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0170] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0171] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.

[0172] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0173] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.

Claims

1. A method for generating a query statement, comprising: Receive a user's field selection instruction, and select a corresponding field in a query statement target editing interface based on the field selection instruction, wherein the query statement target editing interface is responsive to the user's operation based on query information in a query statement initial editing interface, and a rule group corresponding to the query information is created in the query statement initial editing interface, the query information is information for the user to generate SQL conditions based on the query information, the query statement initial editing interface includes a rule group, the rule group includes rules and / or sub-rule groups, the sub-rule group includes multiple rules; the structure of the rule includes field selection, field operator selection, value input, and rule operation; Querying a preset component correspondence table, wherein the preset component correspondence table includes a correspondence between field types, field operators, and input components; In the preset component correspondence table, determining a field operator and an input component corresponding to the field type of the field; 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; A query statement is generated based on the field type, the field operator corresponding to the field, and the field value.

2. The query statement generating method according to claim 1, further comprising: If the field type of the field cannot be found in the preset component corresponding table, a calling interface of the input component corresponding to the field type of the field is provided, and the corresponding input component is called for the field based on the calling interface.

3. The query statement generating method according to claim 1, before receiving the user's field selection instruction, further comprising: Receiving a query statement generation instruction sent by the user, and determining an initial query statement editing interface based on the query statement generation instruction; In response to the user's operation on the query statement initial editing interface based on the query information, a query statement target editing interface is obtained.

4. The query statement generation method according to claim 3, wherein the step of obtaining the query statement target editing interface in response to the user's operation on the query statement initial editing interface based on the query information comprises: In response to the user's instruction to create the query statement initial editing interface based on the query information, a rule group corresponding to the query information is created on the query statement initial editing interface to obtain a query statement target editing interface.

5. The query statement generating method according to claim 4, after obtaining the query statement target editing interface, further comprising: The query statement target editing interface is modified based on the user's modification instruction, wherein the modification instruction includes an add and / or delete instruction.

6. The query statement generating method according to claim 5, wherein the modifying the query statement target editing interface based on the modification instruction of the user comprises: Based on the modification instruction of the user, the rule group in the query statement target editing interface is added and / or deleted.

7. According to the query statement generation method of claim 4, the receiving of a user's field selection instruction and selecting a corresponding field in the query statement target editing interface based on the field selection instruction comprises: A field selection instruction of the user is received, and a corresponding field is selected from the rule of the rule group in the query statement target editing interface based on the field selection instruction.

8. The query statement generating method according to claim 7, wherein the rule comprises a field, a field operator corresponding to the field, and an input component.

9. The query statement generating method according to claim 1, wherein generating the query statement based on the field type, the field operator corresponding to the field, and the field value comprises: The field type, the field operator corresponding to the field, and the field value are concatenated to generate the concatenated query statement.

10. The query statement generating method according to claim 1, wherein generating the query statement based on the field type, the field operator corresponding to the field, and the field value comprises: The field type, the field operator corresponding to the field, and the field value are converted into a JSON string and sent to the server to generate the query statement.

11. A query statement generating device, comprising: A field selection module is configured to receive a user's field selection instruction, and select a corresponding field in a query statement target editing interface based on the field selection instruction, wherein, in response to the user's operation based on query information in the query statement initial editing interface, a rule group corresponding to the query information is created in the query statement initial editing interface, the query information is information for the user to generate SQL conditions based on the query information, the query statement initial editing interface includes a rule group, the rule group includes rules and / or sub-rule groups, the sub-rule group includes multiple rules; the structure of the rule includes field selection, field operator selection, value input and rule operation; A field query module is configured to query a preset component correspondence table, wherein the preset component correspondence table includes a correspondence between field types, field operators, and input components; A component determination module, configured to determine a field operator and an input component corresponding to a field type of the field 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; The query statement generating module is configured to generate a query statement based on the field type, the field operator corresponding to the field, and the field value.

12. A computing device comprising: Memory and processor; The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions: Receive a user's field selection instruction, and select a corresponding field in a query statement target editing interface based on the field selection instruction, wherein, in response to the user's operation based on query information in the query statement initial editing interface, a rule group corresponding to the query information is created in the query statement initial editing interface, the query information is information for the user to generate SQL conditions based on the query information, the query statement initial editing interface includes a rule group, the rule group includes rules and / or sub-rule groups, the sub-rule group includes multiple rules; the structure of the rule includes field selection, field operator selection, value input and rule operation; Querying a preset component correspondence table, wherein the preset component correspondence table includes a correspondence between field types, field operators, and input components; In the preset component correspondence table, determining a field operator and an input component corresponding to the field type of the field; 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; A query statement is generated based on the field type, the field operator corresponding to the field, 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 according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Method and device for generating SQL statement based on visual page, server and medium

    CN109992589A

  • Configuration page generation method and device, electronic device and readable storage medium

    CN110673847A