Data query method, device, equipment and storage medium
By obtaining query parameters and business logic, configuring and executing query service scripts, the problem of long parsing and execution of SQL statements is solved, improving the efficiency of data queries and simplifying the implementation difficulty.
Patent Information
- Application Number
- CN202110541726.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-18
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2041-05-18
AI Technical Summary
In the prior art, when performing data query through SQL statements, parsing and execution take a long time, resulting in inefficiency.
By obtaining the query parameters and their corresponding business logic, configuring the query service script, obtaining the target query service script, and executing the script to call the business logic for data query.
It reduces the parsing and execution time of the backend, simplifies the difficulty of the front-end technical implementation, and reduces the complexity of SQL class code writing.
Smart Images

Figure CN113312374B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a data query method, device, equipment and storage medium. Background Art
[0002] In existing businesses, users query data in the database through the database's open API (Application Programming Interface). Specifically, the front end displays the configuration page, and the user selects which table to output data from, which columns to output, and which input parameters to select. If there are related tables, this relationship also needs to be expressed through the page. The back end obtains the data configured by the user in the configuration page through the API interface corresponding to the query service, and converts this data into SQL (Structured Query Language) statements, and then parses and executes the SQL statements to generate the corresponding services and finally output the data.
[0003] The inventors found during the research of the prior art that when the user configures a lot of data on the front-end configuration page, the SQL statements converted by the back-end are often also more complicated, resulting in a long time required for parsing and executing the SQL statements. Summary of the invention
[0004] The present application provides a data query method, apparatus, device and storage medium to solve the problem that parsing and execution take a long time when performing data query through SQL statements.
[0005] In a first aspect, a data query method is provided, comprising:
[0006] Acquire query parameters and business logic corresponding to the query parameters, wherein the business logic is used to indicate query rules corresponding to the query parameters, and the query parameters include input parameters and parameter types reflecting query results corresponding to the input parameters;
[0007] The query service script is configured using the query parameters and the business logic to obtain a target query service script;
[0008] The target query service script is executed so that the target query service script calls the business logic to execute a data query on the query parameter to obtain the query result.
[0009] Optionally, the query service script is configured using the query parameter and the business logic to obtain a target query service script, including:
[0010] Acquire the business logic items in the query service script and the input conversion rules corresponding to the query service script;
[0011] The business logic item is configured using the business logic, and the input parameter is converted into an input expression of the target query service script according to the input conversion rule.
[0012] Optionally, converting the input parameter into an input expression of the target query service script according to the input parameter rule includes:
[0013] Obtain constant input parameters and non-constant input parameters from the input parameters;
[0014] Obtain constant conversion rules and non-constant conversion rules from the input conversion rules;
[0015] Converting the constant input parameter into a constant input expression in the target query service script according to the constant conversion rule, and converting the non-constant input parameter into a non-constant input expression in the target query script according to the non-constant conversion rule;
[0016] The constant input expression and the non-constant input expression are determined as input expressions of the target query service script.
[0017] Optionally, obtaining the business logic corresponding to the query parameter includes:
[0018] Obtain query logic for executing query services on a database;
[0019] Determining the query logic as the business logic;
[0020] or,
[0021] A query logic and an external function for executing a query service on a database are obtained, wherein the external function is used to process data obtained by querying according to the query logic to obtain the query result and / or process the input parameter.
[0022] Optionally, executing the target query service script so that the target query service script calls the business logic to perform a data query on the query parameter to obtain the query result includes:
[0023] Running the script code corresponding to the target query service script so that the script code calls the business logic to execute a data query on the query parameter to obtain a query result expression;
[0024] Get output conversion rules;
[0025] The query result expression is converted according to the output conversion rule to obtain the query result.
[0026] Optionally, before obtaining the query parameters and the business logic corresponding to the query parameters, the method further includes:
[0027] Determine the API interface corresponding to the query service script;
[0028] The query parameters and the business logic indicated by the user are obtained through the API interface.
[0029] In a second aspect, a data query system is provided, comprising:
[0030] Electronic equipment and terminal equipment;
[0031] The terminal device is used to obtain a query parameter input by a user and a business logic corresponding to the query parameter, wherein the business logic is used to indicate a query rule for the query parameter, wherein the query parameter includes an input parameter and a parameter type reflecting a query result corresponding to the input parameter; and send the query parameter and the business logic to the electronic device;
[0032] The electronic device is used to obtain the query parameters and the business logic; configure the query service script using the query parameters and the business logic to obtain a target query service script; execute the target query service script so that the target query service script calls the business logic to execute a data query on the query parameters to obtain the query result.
[0033] Optionally, the system further comprises:
[0034] Front-end equipment and back-end equipment;
[0035] The front-end device is used to obtain a query service script, wherein the query service script includes at least one business logic;
[0036] The backend device is used to parse the query service script and generate source code corresponding to the query service script;
[0037] The electronic device is also used to compile and deploy the source code, obtain the API interface corresponding to the query service script, and obtain the query parameters and the business logic through the API interface.
[0038] Optionally, the backend device is further used for:
[0039] Determining the identifier of the external function that can be called by the query service script;
[0040] It is determined that there is an external function corresponding to the identifier of the external function.
[0041] A third aspect provides a data query device, comprising:
[0042] an acquisition unit, configured to acquire a query parameter and a business logic corresponding to the query parameter, wherein the business logic is used to indicate a query rule for the query parameter, and the query parameter includes an input parameter and a parameter type reflecting a query result corresponding to the input parameter;
[0043] A configuration unit, configured to configure a query service script using the query parameters and the business logic to obtain a target query service script;
[0044] An execution unit is used to execute the target query service script, so that the target query service script calls the business logic to execute a data query on the query parameter to obtain the query result.
[0045] In a fourth aspect, an electronic device is provided, comprising: a processor, a memory and a communication bus, wherein the processor and the memory communicate with each other via the communication bus;
[0046] The memory is used to store computer programs;
[0047] The processor is used to execute the program stored in the memory to implement the data query method described in the first aspect.
[0048] In a fifth aspect, a computer-readable storage medium is provided, storing a computer program, wherein the computer program, when executed by a processor, implements the data query method described in the first aspect.
[0049] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the technical solution provided by the embodiment of the present application obtains query parameters and the business logic corresponding to the query parameters, configures the query service script using the query parameters and the business logic, obtains the target query service script, executes the target query service script, and enables the target query service script to call the business logic to perform a data query on the query parameters to obtain the query results. Since the business logic is obtained at the same time as the query parameters, the data configured by the user at the front end is relatively small, which greatly simplifies the technical implementation difficulty of the front end. Secondly, the back end directly parses the business logic used for the query to perform data query, which reduces the parsing and execution time compared to parsing SQL statements one by one. Finally, compared with the difficulty of writing SQL-type codes, it only needs to write a query service script with simple syntax to achieve it. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0052] Figure 1 A flowchart of a data query method in an embodiment of the present application;
[0053] Figure 2 A flowchart of another data query method in an embodiment of the present application;
[0054] Figure 3 A flowchart of another data query method in an embodiment of the present application;
[0055] Figure 4 This is a schematic diagram of the structure of the data query system in the embodiment of the present application;
[0056] Figure 5 This is a schematic diagram of the structure of a data query device in an embodiment of the present application;
[0057] Figure 6 Schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0059] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0060] An embodiment of the present application provides a data query method, which can be applied to any form of electronic device, for example, in a terminal or a server, where the terminal can be any form such as a mobile phone, a tablet computer, or a computer.
[0061] like Figure 1 As shown in the figure, the data query process mainly includes:
[0062] Step 101: Obtain query parameters and business logic corresponding to the query parameters.
[0063] The business logic is used to indicate the query rules corresponding to the query parameters. The query parameters include input parameters and parameter types that reflect the query results corresponding to the input parameters.
[0064] In a specific embodiment, the business logic is query logic for executing query services on a database, and the query logic includes but is not limited to sequential logic, selection logic, or loop logic.
[0065] Among them, the sequential logic is used to indicate the sequential query rules.
[0066] In one example, the sequential logic can correspond to a specific query scenario, that is, different query scenarios correspond to different sequential logics. At this time, the sequential logic can be set for the queryable fields in the data database. For example, the set sequential logic can be a rule for the scenario of querying the ID card number. In specific applications, when the user wants to query Zhang San’s ID card number, the user indicates that the business logic is the sequential logic for the scenario of querying the ID card number, so that the electronic device can search for Zhang San’s ID card number according to the sequential query rules indicated by the sequential logic.
[0067] In this case, different identifiers may be set for the sequential logic of different query scenarios so that the user can indicate the sequential logic according to needs.
[0068] In another example, the sequential logic may not be related to a specific query scenario, but may be a general query logic, that is, the sequential logic is applicable to any query scenario. For example, the sequential query rule indicated by the general sequential logic may be to first determine the identifier of the input parameter, and then search for the query result corresponding to the parameter type according to the identifier.
[0069] It is understandable that corresponding sequential logic can be set in the electronic device for some query scenarios, and general sequential logic that is not related to the query scenarios can be set at the same time. When the user indicates the sequential logic, priority is given to indicating from the former sequential logic. When the former sequential logic does not exist in the sequential logic corresponding to the query scenario, the general sequential logic is indicated as the business logic.
[0070] Based on the above two sequential logic setting methods, illustratively, this embodiment implements the sequential logic in the query service script through the following sequential statements:
[0071] The sequential statement consists of two parts: variable definition and variable assignment, where:
[0072] Variable definition:
[0073] The variable definition syntax of the sequential statement is: {MAP|STR|NUM|DT} variable name
[0074] For variable definitions of sequential statements, see the example in Table 1:
[0075] Table 1
[0076] Statements illustrate STR pin1 Define variable pin1 as string type MAP userInfo Define the variable userInfo as a dictionary type DT birthday1 Define the variable birthday1 as date type
[0077] Variable assignment:
[0078] The variable assignment syntax of the sequential statement is: variable name = {value | variable}
[0079] For variable assignment in sequential statements, see the example in Table 2:
[0080] Table 2
[0081]
[0082]
[0083] The loop logic is used to instruct to judge each piece of data one by one until a query rule of a query result corresponding to the input parameter is found.
[0084] Still taking the query of Zhang San’s ID number as an example, when using loop logic for query, for any piece of data, determine whether the data includes Zhang San’s ID number. If not, determine whether the next piece of data includes Zhang San’s ID number, until Zhang San’s ID number is found and the query ends.
[0085] Exemplarily, in this embodiment, the loop logic in the query service script is implemented by a loop statement:
[0086] The syntax of the loop statement is: WHILE logical expression THEN {sequential statement | selection | loop} ENDWHILE
[0087] For loop statements, see the examples in Table 3:
[0088] Table 3
[0089]
[0090] The selection logic is used to indicate a query rule for finding a query result corresponding to an input parameter for any piece of data.
[0091] Still taking the query of Zhang San's ID number as an example, when the selection logic is used for query, for any piece of data, it is determined whether the name in the data is Zhang San or whether the identifier in the data is Zhang San's identifier. If so, the ID number in the data is returned to the user as Zhang San's ID number, otherwise a default value is returned. The default value can be empty, indicate wrong data, etc.
[0092] Exemplarily, this embodiment implements the selection logic through a selection statement:
[0093] The syntax of the selection statement is: IF logical expression THEN sequence statement (ELSE sequence statement) ENDIF
[0094] Note: The variable name of the logical expression syntax is {>|<|==|<>|>=|<=}{value|variable}. When the variable type is different, the comparison symbol corresponding to the variable type is also different. Specifically, when the variable type is a string type, the corresponding comparison symbol can be {==|<>}, while for other types of variable types, the corresponding comparison symbol can be {>|<|==|<>|>=|<=}.
[0095] For the select statement, see the example in Table 4:
[0096] Table 4
[0097]
[0098] In this embodiment, the business logic acquired by the electronic device includes but is not limited to the identification of the business logic. Therefore, when the business logic is used to configure the business logic item in the query service script, the business logic identification is used to configure the business logic item.
[0099] In another specific embodiment, when the electronic device implements the query service through the query service script, it can call the external logic through the query service script to process the data in the query process through the external logic.
[0100] In this case, the business logic includes query logic and external functions, and the external functions are used to process data obtained according to the query logic to obtain query results and / or process input parameters.
[0101] Among them, the external function includes but is not limited to the screening function.
[0102] Taking the ID number query scenario as an example, when querying Zhang San’s ID number, the blacklist filtering function is first called to determine whether Zhang San’s name is on the blacklist. If so, the query operation is no longer performed according to the query logic, and a null value or a default value is returned. Otherwise, the query operation is performed according to the query logic to obtain the query result.
[0103] In this case, when the business logic item is configured using the business logic, the business logic item is configured using the identifier of the query logic and the address of the external function.
[0104] The address of the external function includes but is not limited to a URL (Uniform Resource Locator) address. When the external function is called, the external function is accessed through the URL address.
[0105] In this embodiment, the query result and the parameter type have a matching relationship. The query result is the data returned by the electronic device to the user based on the query parameters, and the parameter type reflects the properties of the query result. In practical applications, the parameter type can be the field name of the query result in the database. For example, when the query result is an 18-digit ID card number, the corresponding parameter type can be the string "ID card number" or other expressions that can represent the string "ID card number".
[0106] In this embodiment, the electronic device may obtain the query parameters and business logic configured by the user from the displayed query interface; or, the electronic device may obtain the query parameters and business logic indicated by the user from a script written by the user.
[0107] Among them, the query interface displayed by the electronic device corresponds to the API interface encapsulated by the query service script, that is, the electronic device displays the query interface through the API interface, so that the query parameters and business logic indicated by the user can be obtained through the API interface.
[0108] Step 102: Use query parameters and business logic to configure the query service script to obtain a target query service script.
[0109] In a specific embodiment, the query service script is configured with query parameters and business logic to obtain a target query service script, such as Figure 2 As shown, the specific steps include:
[0110] Step 201: Obtain the business logic items in the query service script and the input conversion rules corresponding to the query service script;
[0111] Step 202: configure the business logic items using the business logic, and convert the input parameters into input expressions of the target query service script according to the input conversion rules.
[0112] When the acquired business logic is an identifier of the business logic, the business logic item is configured using the identifier of the business logic.
[0113] Among them, the input conversion rules include constant conversion rules and non-constant conversion rules. The constant conversion rules are used to convert the constant parameters in the input parameters, and convert the constant parameters into constant input expressions in the target query service script; the non-constant conversion rules are used to convert the non-constant parameters in the input parameters, and convert the non-constant parameters into non-constant input expressions in the target query service script.
[0114] Exemplarily, this embodiment provides the following constant parameter conversion rules and non-constant parameter conversion rules:
[0115] The constant parameter conversion rules can be:
[0116] The syntax is: CONST{STR|NUM|DT} variable name = value
[0117] The constant parameter conversion rules are shown in Table 5. The examples are as follows:
[0118] Table 5
[0119]
[0120] The non-constant parameter conversion rules can be:
[0121] The syntax is: IN{STR|NUM|DT} variable name DEFAULT? default value AS? alias
[0122] Note: When no input parameter is passed, the default value takes effect. That is, when there is no input of non-constant parameter, the default value is used as the input of non-constant parameter.
[0123] At the same time, in order to make the query more flexible, you can also use aliases as input parameters.
[0124] The conversion rules for non-constant parameters are as follows:
[0125] Table 6
[0126]
[0127] Step 103: Execute the target query service script, so that the target query service script calls the business logic to execute data query on the query parameters to obtain the query result.
[0128] In a specific embodiment, the target query service script is executed to obtain the query result, such as Figure 3 As shown, the following steps may be specifically included:
[0129] Step 301: Run the script code corresponding to the target query service script, so that the script code calls the business logic to execute the data query of the query parameter and obtain the query result expression;
[0130] Step 302: Obtain output conversion rules;
[0131] Step 303: convert the query result expression according to the output conversion rule to obtain the query result.
[0132] Exemplarily, the output conversion rule may be:
[0133] The syntax is: OUT{STR|NUM|DT} variable name DEFAULT? initial value AS? alias
[0134] Note: You can use aliases as parameter names.
[0135] See Table 7 for an example:
[0136] Table 7
[0137]
[0138]
[0139] The technical solution provided by the embodiment of the present application obtains query parameters and business logic corresponding to the query parameters, configures the query service script using the query parameters and the business logic, obtains the target query service script, executes the target query service script, and makes the target query service script call the business logic to execute the data query of the query parameters to obtain the query result. Since the business logic is obtained at the same time as the query parameters, the data configured by the user at the front end is less, which greatly simplifies the technical implementation difficulty of the front end. Secondly, the back end directly parses the business logic used for the query to perform data query, which reduces the parsing and execution time compared to parsing SQL statements one by one. Finally, compared with the difficulty of writing SQL-type codes, it only needs to write a query service script with simple syntax to achieve it.
[0140] Based on the same concept, a data query system is provided in the embodiment of the present application. The specific implementation of the system can be found in the description of the method embodiment part, and the repeated parts will not be repeated. Figure 4 As shown, the system mainly includes:
[0141] Electronic device 401 and terminal device 402;
[0142] The terminal device 402 is used to obtain the query parameters input by the user and the business logic corresponding to the query parameters, where the business logic is used to indicate the query rules of the query parameters, and the query parameters include the input parameters and the parameter type reflecting the query results corresponding to the input parameters; and send the query parameters and the business logic to the electronic device;
[0143] Electronic device 401 is used to obtain query parameters and business logic; configure the query service script using the query parameters and business logic to obtain a target query service script; execute the target query service script so that the target query service script calls the business logic to execute a data query on the query parameters to obtain a query result.
[0144] Optionally, the query system may further include:
[0145] Front-end equipment and back-end equipment;
[0146] A front-end device, used to obtain a query service script, wherein the query service script includes at least one business logic;
[0147] Here, the business logic may be query logic; or the business logic may be query logic and external functions.
[0148] When the query logic includes an external function, the external function may specifically be an identifier of the external function, such as a URL address of the external function.
[0149] A back-end device, used for parsing the query service script and generating source code corresponding to the query service script;
[0150] The back-end device performs syntax analysis on the query service script configured by the front-end to determine whether the query service script conforms to the grammatical rules of the script; when the query service script is bound to a callable external function, the back-end device is also used to determine the identifier of the external function that can be called by the query service script; and determine whether there is an external function corresponding to the identifier of the external function based on the identifier.
[0151] After determining that the script complies with the grammatical rules, the back-end device can translate the script language into JAVA language through ANTLR (open source grammar analyzer) to obtain the source code.
[0152] The electronic device is also used to compile and deploy source code, obtain an API interface corresponding to the query service script, and obtain query parameters and business logic through the API interface.
[0153] During the compilation process, the electronic device can hot compile the JAVA language to obtain binary code, and by deploying the binary code to the local of the electronic device, it can generate API services, obtain API interfaces, and provide services externally through the API interfaces.
[0154] Based on the same concept, a data query device is provided in the embodiment of the present application. The specific implementation of the device can refer to the description of the method embodiment part, and the repeated parts will not be repeated. Figure 5 As shown, the device mainly includes:
[0155] An acquisition unit 501 is used to acquire query parameters and business logic corresponding to the query parameters, where the business logic is used to indicate a query rule for the query parameters, and the query parameters include input parameters and parameter types reflecting query results corresponding to the input parameters;
[0156] A configuration unit 502, configured to configure a query service script using query parameters and business logic to obtain a target query service script;
[0157] The execution unit 503 is used to execute the target query service script, so that the target query service script calls the business logic to execute the data query of the query parameter to obtain the query result.
[0158] Optionally, the configuration unit 502 is used to:
[0159] Obtaining business logic items in the query service script and input conversion rules corresponding to the query service script;
[0160] Business logic items are configured using business logic, and input parameters are converted into input expressions of a target query service script according to input conversion rules.
[0161] Optionally, the configuration unit 502 is used to:
[0162] Get constant input parameters and / or non-constant input parameters in the input parameters;
[0163] Obtain constant conversion rules and / or non-constant conversion rules in the input conversion rules;
[0164] Converting constant input parameters into constant input expressions in the target query service script according to constant conversion rules, and / or converting non-constant input parameters into non-constant input expressions in the target query script according to non-constant conversion rules;
[0165] A constant input expression and / or a non-constant input expression is determined as an input expression of the target query service script.
[0166] Optionally, the acquisition unit 501:
[0167] Obtain query logic for executing query services on a database;
[0168] Identify query logic as business logic;
[0169] or,
[0170] The query logic and external functions for executing query services on the database are obtained, and the external functions are used to process the data obtained according to the query logic to obtain the query results and / or process the input parameters.
[0171] Optionally, the execution unit 503 is used to:
[0172] Running the script code corresponding to the target query service script so that the script code calls the business logic to execute the data query of the query parameter and obtains the query result expression;
[0173] Get output conversion rules;
[0174] The query result expression is converted according to the output conversion rules to obtain the query result.
[0175] Optionally, the system is also used to:
[0176] Determine the API interface corresponding to the query service script before obtaining the query parameters and the business logic corresponding to the query parameters;
[0177] Obtain the query parameters and business logic indicated by the user through the API interface.
[0178] Based on the same concept, an electronic device is also provided in the embodiment of the present application, such as Figure 6 As shown, the electronic device mainly includes: a processor 601, a memory 602 and a communication bus 603, wherein the processor 601 and the memory 602 communicate with each other through the communication bus 603. The memory 602 stores a program executable by the processor 601, and the processor 601 executes the program stored in the memory 602 to implement the following steps:
[0179] Obtain query parameters and business logic corresponding to the query parameters, where the business logic is used to indicate query rules corresponding to the query parameters, and the query parameters include input parameters and parameter types that reflect query results corresponding to the input parameters; configure the query service script using the query parameters and business logic to obtain a target query service script; execute the target query service script so that the target query service script calls the business logic to execute a data query on the query parameters to obtain a query result.
[0180] The communication bus 603 mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus 603 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0181] The memory 602 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the processor 601.
[0182] The above-mentioned processor 601 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc., and can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0183] In another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed on a computer, the computer executes the data query method described in the above embodiment.
[0184] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instruction is transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape, etc.), an optical medium (e.g., a DVD) or a semiconductor medium (e.g., a solid-state hard disk), etc.
[0185] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0186] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A data query method, characterized in that: include: Acquire query parameters and business logic corresponding to the query parameters, wherein the business logic is used to indicate query rules corresponding to the query parameters, and the query rules include: sequential logic, selection logic or loop logic; the sequential logic is used to indicate sequential query rules; the selection logic is used to indicate query rules for finding query results corresponding to input parameters for any data; the loop logic is used to indicate query rules for judging each data piece by piece until finding query results corresponding to the input parameters; the query parameters include input parameters and parameter types reflecting query results corresponding to the input parameters; The query service script is configured using the query parameters and the business logic to obtain a target query service script; The target query service script is executed so that the target query service script calls the business logic to execute a data query on the query parameter to obtain the query result.
2. The method according to claim 1, characterized in that The query service script is configured using the query parameters and the business logic to obtain a target query service script, including: Acquire the business logic items in the query service script and the input conversion rules corresponding to the query service script; The business logic item is configured using the business logic, and the input parameter is converted into an input expression of the target query service script according to the input conversion rule.
3. The method according to claim 2, characterized in that Converting the input parameter into an input expression of the target query service script according to the input conversion rule includes: Obtain constant input parameters and non-constant input parameters from the input parameters; Obtain constant conversion rules and non-constant conversion rules from the input conversion rules; Converting the constant input parameter into a constant input expression in the target query service script according to the constant conversion rule, and converting the non-constant input parameter into a non-constant input expression in the target query script according to the non-constant conversion rule; The constant input expression and the non-constant input expression are determined as input expressions of the target query service script.
4. The method according to claim 1, characterized in that: Obtaining the business logic corresponding to the query parameter includes: Obtain query logic for executing query services on a database; Determining the query logic as the business logic; or, A query logic and an external function for executing a query service on a database are obtained, wherein the external function is used to process data obtained by querying according to the query logic to obtain the query result and / or to process the input parameter.
5. The method according to claim 1, characterized in that Executing the target query service script so that the target query service script calls the business logic to execute a data query on the query parameter to obtain the query result, including: Running the script code corresponding to the target query service script so that the script code calls the business logic to execute a data query on the query parameter to obtain a query result expression; Get output conversion rules; The query result expression is converted according to the output conversion rule to obtain the query result.
6. The method according to claim 1, characterized in that Before obtaining the query parameters and the business logic corresponding to the query parameters, it also includes: Determine the API interface corresponding to the query service script; The query parameters and the business logic indicated by the user are obtained through the API interface.
7. A data query system, characterized in that: include: Electronic equipment and terminal equipment; The terminal device is used to obtain a query parameter input by a user and a business logic corresponding to the query parameter, wherein the business logic is used to indicate a query rule for the query parameter, and the query rule includes: sequential logic, selection logic or loop logic; the sequential logic is used to indicate a sequential query rule; the selection logic is used to indicate a query rule for finding a query result corresponding to the input parameter for any piece of data; the loop logic is used to indicate a query rule for judging each piece of data one by one until a query result corresponding to the input parameter is found; the query parameter includes an input parameter and a parameter type reflecting the query result corresponding to the input parameter; Sending the query parameter and the business logic to the electronic device; The electronic device is used to obtain the query parameters and the business logic; configure the query service script using the query parameters and the business logic to obtain a target query service script; The target query service script is executed so that the target query service script calls the business logic to execute a data query on the query parameter to obtain the query result.
8. The system according to claim 7, characterized in that The system further comprises: Front-end equipment and back-end equipment; The front-end device is used to obtain a query service script, wherein the query service script includes at least one business logic; The backend device is used to parse the query service script and generate source code corresponding to the query service script; The electronic device is also used to compile and deploy the source code, obtain the API interface corresponding to the query service script, and obtain the query parameters and the business logic through the API interface.
9. The system according to claim 8, characterized in that The backend device is also used for: Determining the identifier of the external function that can be called by the query service script; It is determined that there is an external function corresponding to the identifier of the external function.
10. A data query device, characterized in that: include: An acquisition unit, used to acquire query parameters and business logic corresponding to the query parameters, wherein the business logic is used to indicate a query rule for the query parameters, and the query rule includes: sequential logic, selection logic or loop logic; the sequential logic is used to indicate a sequential query rule; the selection logic is used to indicate a query rule for finding a query result corresponding to an input parameter for any piece of data; the loop logic is used to indicate a query rule for judging each piece of data one by one until a query result corresponding to the input parameter is found; the query parameters include input parameters and parameter types reflecting the query result corresponding to the input parameters; A configuration unit, configured to configure a query service script using the query parameters and the business logic to obtain a target query service script; An execution unit is used to execute the target query service script, so that the target query service script calls the business logic to execute a data query on the query parameter to obtain the query result.
11. An electronic device, characterized in that: include: A processor, a memory and a communication bus, wherein the processor and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is used to execute the program stored in the memory to implement the data query method described in any one of claims 1-6.
12. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the data query method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Service processing method, device, electronic equipment and storage medium
CN110825488A
Business processing method and device based on natural language processing and computer equipment
CN112784029A