A method and apparatus for interface configuration, an electronic device, and a computer readable medium
By automatically parsing interface input parameters to generate target filtering statements, the problem of excessive mechanical and repetitive work in the development of query-type interfaces has been solved, improving development efficiency and reducing error frequency.
Patent Information
- Application Number
- CN202110823685.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-21
- Publication Date
- 2026-03-20
- Estimated Expiration
- 2041-07-21
AI Technical Summary
In the process of software development, the development of query interfaces requires setting different input parameters for different filtering conditions, which leads to a lot of mechanical work, high repetition and easy errors.
By obtaining the set of input parameters from the interface, the target filtering statement is automatically parsed and generated using a preset filtering condition mapping table, enabling zero-code configuration of query conditions.
It improved the development efficiency of query interfaces, reduced the frequency of bugs, and increased the efficiency of backend development.
Smart Images

Figure CN113515270B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automatic programming technology, and in particular to a method, apparatus, electronic device, and computer-readable medium for interface configuration. Background Technology
[0002] In the software development process, the configuration of software interfaces is crucial. Different software interfaces can provide different business services, such as business data query interfaces and business data update interfaces.
[0003] In the development of existing query interfaces, different input parameters are often set for different filtering conditions, and the corresponding filtering fields and query conditions are concatenated separately through code. When there are many filtering conditions, the development process of query interfaces involves a lot of mechanical and repetitive work and is prone to errors. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method, apparatus, electronic device, and computer-readable medium for interface configuration. By identifying the input parameters, the corresponding target filtering statement is automatically parsed and generated. In the development process of query-type interfaces, query conditions can be assembled with zero code, without having to write different code for different filtering fields. This greatly improves the development efficiency of query-type interfaces, thereby improving the efficiency of backend development and reducing the frequency of bugs.
[0005] To achieve the above objectives, according to a first aspect of the present invention, a method for configuring an interface is provided.
[0006] The interface configuration method of this invention includes: obtaining a set of input parameters corresponding to an interface to be configured; the set of input parameters includes one or more input parameters; determining the filtering conditions corresponding to the input parameters according to the one or more input parameters and a preset filtering condition mapping table; generating a target filtering statement corresponding to the interface to be configured according to the filtering conditions; and configuring the interface according to the target filtering statement.
[0007] Optionally, the filter condition mapping table includes: a mapping relationship between filter condition identifiers and filter conditions; determining the filter condition corresponding to the input parameter includes: identifying the filter condition identifier from the input parameter, and determining the filter condition corresponding to the input parameter according to the mapping relationship between the filter condition identifier and the filter condition.
[0008] Optionally, the input parameter includes an input parameter name; before identifying the filter condition identifier from the input parameter, the method further includes: confirming that the input parameter name includes a filter field identifier and a filter field; otherwise, determining that the input parameter does not have a corresponding filter condition.
[0009] Optionally, before determining the filtering condition corresponding to the input parameter according to the mapping relationship between the filtering condition identifier and the filtering condition, the method further comprises: confirming that the filtering field identifier exists in the filtering condition mapping table; otherwise, determining that the input parameter does not have a corresponding filtering condition.
[0010] Optionally, the input parameter further comprises an input parameter value; and the generating the target filtering statement corresponding to the interface to be set according to the filtering condition comprises: generating an intermediate filtering statement corresponding to the input parameter according to the input parameter value and the input parameter name and the filtering condition corresponding to the input parameter; and generating the target filtering statement according to the intermediate filtering statements corresponding to the input parameters in the input parameter set respectively.
[0011] Optionally, the input parameter set comprises one or more sub-sets; and the generating the target filtering statement according to the intermediate filtering statements corresponding to the input parameters in the input parameter set respectively comprises: connecting the intermediate filtering statements corresponding to the input parameters in the same sub-set by using an AND connection symbol to generate the target filtering statement corresponding to the interface to be set according to the connected intermediate filtering statements.
[0012] Optionally, the generating the target filtering statement according to the intermediate filtering statements corresponding to the input parameters in the input parameter set respectively further comprises: connecting the intermediate filtering statements corresponding to the input parameters not belonging to the same sub-set by using an OR connection symbol to generate the target filtering statement corresponding to the interface to be set according to the connected intermediate filtering statements.
[0013] Optionally, in the filtering condition mapping table, the filtering condition identifier and the filtering condition are in one-to-one correspondence.
[0014] Optionally, the method further comprises: periodically updating the filtering condition mapping table.
[0015] Optionally, the method further comprises: receiving a query request through the interface; generating a query statement according to the input parameter of the query request and the target filtering statement corresponding to the interface; and executing the query statement to respond to the query request.
[0016] To achieve the above object, according to a second aspect of an embodiment of the present application, a device for interface configuration is provided.
[0017] The device with the interface configuration of the embodiment comprises: an acquisition module, configured to acquire a parameter set corresponding to an interface to be set; the parameter set comprises one or more parameters; a generation module, configured to determine a filtering condition corresponding to the one or more parameters according to the one or more parameters and a preset filtering condition mapping table; generate a target filtering statement corresponding to the interface to be set according to the filtering condition; and a configuration module, configured to configure the interface according to the target filtering statement.
[0018] Optionally, the filtering condition mapping table comprises a mapping relationship between a filtering condition identifier and a filtering condition; and the determination of the filtering condition corresponding to the parameter comprises: identifying the filtering condition identifier from the parameter, and determining the filtering condition corresponding to the parameter according to the mapping relationship between the filtering condition identifier and the filtering condition.
[0019] Optionally, the parameter comprises a parameter name; and the acquisition module is further configured to: before identifying the filtering condition identifier from the parameter, confirm that the parameter name comprises a filtering field identifier and a filtering field; otherwise, determine that the parameter does not have a corresponding filtering condition.
[0020] Optionally, the acquisition module is further configured to: before determining the filtering condition corresponding to the parameter according to the mapping relationship between the filtering condition identifier and the filtering condition, confirm that the filtering field identifier exists in the filtering condition mapping table; otherwise, determine that the parameter does not have a corresponding filtering condition.
[0021] Optionally, the parameter further comprises a parameter value; and the generation of the target filtering statement corresponding to the interface to be set according to the filtering condition comprises: generating an intermediate filtering statement corresponding to the parameter according to the parameter value and the parameter name, and the filtering condition corresponding to the parameter; and generating the target filtering statement according to the intermediate filtering statements corresponding to the respective parameters in the parameter set.
[0022] Optionally, the parameter set comprises one or more sub-sets; and the generation of the target filtering statement according to the intermediate filtering statements corresponding to the respective parameters in the parameter set comprises: for the parameters in a same sub-set, connecting the intermediate filtering statements corresponding to the respective parameters by using an AND connection symbol, so as to generate the target filtering statement corresponding to the interface to be set according to the connected intermediate filtering statements.
[0023] Optionally, the generation of the target filtering statement according to the intermediate filtering statements corresponding to the respective parameters in the parameter set further comprises: for the parameters not belonging to a same sub-set, connecting the intermediate filtering statements corresponding to the respective parameters by using an OR connection symbol, so as to generate the target filtering statement corresponding to the interface to be set according to the connected intermediate filtering statements.
[0024] Optionally, in the filter condition mapping table, the filter conditions are one-to-one corresponding to filter conditions.
[0025] Optionally, the apparatus further comprises an updating module for periodically updating the filter condition mapping table.
[0026] Optionally, the apparatus further comprises a querying module for receiving a query request through the interface; generating a query statement according to an input parameter of the query request and a target filter statement corresponding to the interface; and executing the query statement to respond to the query request.
[0027] To achieve the above object, according to a third aspect of an embodiment of the present application, an electronic device configured with an interface is provided.
[0028] The electronic device configured with an interface according to the embodiment of the present application comprises one or more processors; a storage system for storing one or more programs; and when the one or more programs are executed by the one or more processors, the one or more processors implement the method for configuring an interface provided in the first aspect.
[0029] To achieve the above object, according to a fourth aspect of an embodiment of the present application, a computer readable medium is provided.
[0030] The computer readable medium according to the embodiment of the present application stores a computer program, and the program is executed by a processor to implement the method for configuring an interface provided in the first aspect.
[0031] The above embodiment of the present application has the following advantages or beneficial effects: in the embodiment of the present application, by identifying the input parameter, the corresponding target filter statement is automatically parsed and generated, so that in the development process of the query interface, the query condition assembly can be implemented without code, and different codes do not need to be written for different filter fields, thereby greatly improving the development efficiency of the query interface, further improving the efficiency of the backend development, and reducing the frequency of BUG occurrence.
[0032] The further effects of the above non-conventional optional mode will be described in the following combined with the specific embodiments. BRIEF DESCRIPTION OF DRAWINGS
[0033] The accompanying drawings are used to better understand the present application, and do not constitute an improper limitation on the present application. Among them:
[0034] Figure 1 is a schematic diagram of the main process of an interface configuration method according to an embodiment of the present application;
[0035] Figure 2 is a schematic diagram of the main process of generating a target filter statement according to an embodiment of the present application;
[0036] Figure 3 FIG. 7 is a schematic diagram of a sub-set interface configuration process according to an embodiment of the present application;
[0037] Figure 4 FIG. 8 is a schematic diagram of a main process of processing a query request after interface configuration according to an embodiment of the present application;
[0038] Figure 5 FIG. 9 is a schematic diagram of main modules of an interface configuration device according to an embodiment of the present application;
[0039] Figure 6 FIG. 10 is a schematic diagram of an exemplary system architecture to which embodiments of the present application can be applied;
[0040] Figure 7 FIG. 11 is a schematic diagram of a computer system structure of a terminal device or a server suitable for implementing embodiments of the present application. DETAILED DESCRIPTION
[0041] Exemplary embodiments of the present application are described herein with reference to the accompanying drawings, which are meant to be exemplary. It should be understood that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the application. Also, for the sake of brevity and clarity, descriptions of well-known functions and constructions are omitted herein.
[0042] According to a first aspect of an embodiment of the present application, there is provided a method of interface configuration applied to a server.
[0043] Figure 1 FIG. 6 is a schematic diagram of a main process of an interface configuration method according to an embodiment of the present application.
[0044] As shown in FIG. 7, the method mainly includes: Figure 1
[0045] Step S101: obtaining a parameter set corresponding to an interface to be set; the parameter set includes one or more parameters;
[0046] Step S102: determining a filtering condition corresponding to the parameters according to the one or more parameters and a preset filtering condition mapping table;
[0047] Step S103: generating a target filtering statement corresponding to the interface to be set according to the filtering condition;
[0048] Step S104: configuring the interface according to the target filtering statement.
[0049] Under normal circumstances, the input parameter set includes multiple input parameters, and each input parameter can correspond to the same or different filtering conditions. The target filtering statement is the filtering statement obtained by using all input parameters as reference conditions.
[0050] In an optional embodiment, the filtering condition mapping table includes: the mapping relationship between the filtering condition identifier and the filtering condition; the specific implementation of the above step S102 may include: identifying the filtering condition identifier from the input parameter, and determining the filtering condition corresponding to the input parameter according to the mapping relationship between the filtering condition identifier and the filtering condition.
[0051] The mapping relationship between the filtering condition identifier and the filtering condition can be preconfigured according to the actual situation. In an optional embodiment, as shown in Table 1. Among them, fuzzy matching can be used for fuzzy search. For example, by fuzzy matching the character "jade", all target objects with the character "jade" can be found within the search range. Left matching means using this item as the beginning of the query condition. For example, through left matching, all names starting with the character "Li" in the name can be found. Similarly, right matching means using this item as the end of the query condition. For example, through right matching, all names ending with the character "Fan" in the name can be found.
[0052] Table 1 Filtering Condition Mapping Table
[0053]
[0054] For the corresponding relationship between the filtering condition identifier and the filtering condition, it can be set as a one-to-one relationship or a many-to-one relationship. In an optional embodiment, in the filtering condition mapping table, the filtering condition identifier and the filtering condition correspond one by one, which can ensure the accuracy of the query.
[0055] In an optional embodiment, the input parameter includes an input parameter name; before identifying the filtering condition identifier from the input parameter, it further includes: confirming that the input parameter name includes a filtering field identifier and a filtering field; otherwise, it is determined that the input parameter does not have a corresponding filtering condition.
[0056] The prerequisite for identifying the filtering condition identifier from the input parameter must be that the input parameter name includes a filtering field identifier. In an optional embodiment, the input parameter name can be composed of two parts: a filtering field and a filtering condition identifier. Among them, a connection symbol is selected to connect between the filtering field and the filtering condition identifier to distinguish the two parts. For example, if the filtering field is id and the filtering condition identifier is eq, then the input parameter name is "id_eq".
[0057] If the input parameter name is not in the format of "filtering field_filtering condition identifier", it cannot be recognized by the system, and it is considered that the input parameter does not have a corresponding filtering condition.
[0058] In an optional embodiment, before determining the filtering condition corresponding to the input parameter according to the mapping relationship between the filtering condition identifier and the filtering condition, the method further includes: confirming that the filtering field identifier exists in the filtering condition mapping table; otherwise, determining that the input parameter does not have a corresponding filtering condition
[0059] When there is a filtering field identifier that does not exist in the filtering condition mapping table, it may be caused by the failure of the filtering condition mapping table to update in time. Therefore, in an optional embodiment, the filtering condition mapping table needs to be updated regularly to ensure the timeliness and accuracy of the filtering condition mapping table.
[0060] The target filtering statement is usually obtained on the basis of multiple input parameters. In an optional embodiment, the input parameter further includes an input parameter value. Therefore, the specific implementation of the step S103 can include the steps as shown in Figure 2
[0061] Step S201: generating an intermediate filtering statement corresponding to the input parameter according to the input parameter value and the input parameter name, and the filtering condition corresponding to the input parameter;
[0062] Step S202: generating a target filtering statement according to the intermediate filtering statements respectively corresponding to the input parameters in the input parameter set.
[0063] Each input parameter corresponds to an intermediate filtering statement. The target filtering statement can be obtained by arranging and combining multiple intermediate filtering statements. In an optional embodiment, the input parameter set includes one or more sub-sets. The target filtering statement is generated according to the intermediate filtering statements respectively corresponding to the input parameters in the input parameter set, including: for the input parameters in the same sub-set, using an AND connection symbol to connect the intermediate filtering statements respectively corresponding to the input parameters, so as to generate a target filtering statement corresponding to the interface to be set according to the connected intermediate filtering statements.
[0064] Each sub-set includes at least one input parameter. In the case where multiple input parameters are included in a sub-set, the intermediate filtering statements respectively corresponding to all the input parameters in the sub-set are connected by using an AND connection symbol to obtain a target filtering statement. At this time, the target filtering statement indicates that the conditions need to be met simultaneously to satisfy all the intermediate filtering statements, and any one of the conditions is missing.
[0065] In another optional embodiment, the target filtering statement is generated according to the intermediate filtering statements respectively corresponding to the input parameters in the input parameter set, further including: for the input parameters not belonging to the same sub-set, using an OR connection symbol to connect the intermediate filtering statements respectively corresponding to the input parameters, so as to generate a target filtering statement corresponding to the interface to be set according to the connected intermediate filtering statements.
[0066] For example, the input parameter set is of the type List <Map <String, Object>> and the sub-set is Map. There can be multiple Maps in a List, and each Map includes at least one input parameter. First, the intermediate filtering statements corresponding to all input parameters in the same Map are connected by an AND connector to obtain a first target filtering statement, and then the first target filtering statements between different Maps are connected by an OR connector to obtain a target filtering statement.
[0067] Figure 3 is a schematic diagram of the sub-set interface configuration process of an embodiment of the present application, as shown in Figure 3 Map A and Map B are included in List one. Map A includes multiple interface input parameters, including input parameter 1, input parameter 2 and input parameter 3, each of which includes an input parameter name and an input parameter value. First, the name of input parameter 1 is judged to determine whether the format of the input parameter name conforms to a preset format rule, for example, the format of "filter field+_+filter condition identifier". If the preset format rule is met, the input parameter name is further parsed to obtain the filter field and the filter field identifier. After obtaining the filter field identifier, it is determined whether the filter field identifier exists in the filter condition mapping table. The corresponding filter condition, filter field and filter value (i.e. input parameter value) are combined to obtain an intermediate filtering statement 1 corresponding to the current input parameter. The same steps can be used to obtain intermediate filtering statements 2 and 3 corresponding to input parameters 2 and 3. The intermediate filtering statements 1, 2 and 3 are connected by AND to obtain a single-set filtering statement 1 corresponding to Map A.
[0068] Each input parameter in Map B is processed in turn to obtain a single-set filtering statement 2 corresponding to Map B. For single-set filtering statements 1 and 2, OR is used to connect the statements to obtain a target filtering statement. If there are other Maps in the List, the same configuration is performed to obtain multiple single-set filtering statements and finally obtain a target filtering statement. Further, executing the generated target filtering statement can obtain data that meets the conditions.
[0069] In an optional embodiment, after obtaining the target filtering statement and configuring the interface according to the target filtering statement, when a query request is received, the target filtering statement corresponding to the query request can be automatically generated to improve the response rate of the query request. Specifically, as shown in Figure 4 the process can include the following steps:
[0070] Step S401: receiving a query request through an interface;
[0071] Step S402: generating a query statement according to the input parameter of the query request and the target filter statement corresponding to the interface;
[0072] Step S403: executing the query statement to respond to the query request.
[0073] According to the interface configuration method provided by the embodiment of the application, the corresponding target filter statement can be automatically parsed and generated through identification of the input parameter name, and the development and management of codes are no longer needed, thereby avoiding the negative effects such as high cost, high error rate and slow response speed caused by manual coding.
[0074] According to the second aspect of the embodiment of the application, an interface configuration device applied to a server is provided.
[0075] Figure 5 is a schematic diagram of main modules of the interface configuration device 500 according to the second aspect of the embodiment of the application. As shown in the figure, the device comprises: an acquisition module 501 configured to acquire an input parameter set corresponding to an interface to be set; the input parameter set comprises one or more input parameters; a generation module 502 configured to determine a filter condition corresponding to the input parameter according to the one or more input parameters and a preset filter condition mapping table, and generate a target filter statement corresponding to the interface to be set according to the filter condition; and a configuration module 503 configured to configure the interface according to the target filter statement. Figure 5
[0076] Optionally, the filter condition mapping table comprises a mapping relationship between a filter condition identifier and a filter condition; and the determination of the filter condition corresponding to the input parameter comprises: identifying the filter condition identifier from the input parameter, and determining the filter condition corresponding to the input parameter according to the mapping relationship between the filter condition identifier and the filter condition.
[0077] Optionally, the input parameter comprises an input parameter name; and the acquisition module is further configured to, before identifying the filter condition identifier from the input parameter, confirm that the input parameter name comprises a filter field identifier and a filter field; otherwise, determine that the input parameter does not have a corresponding filter condition.
[0078] Optionally, the acquisition module 501 is further configured to, before determining the filter condition corresponding to the input parameter according to the mapping relationship between the filter condition identifier and the filter condition, confirm that the filter field identifier exists in the filter condition mapping table; otherwise, determine that the input parameter does not have a corresponding filter condition.
[0079] Optionally, the input parameter further comprises an input parameter value; and the generating the target filter statement corresponding to the interface to be set according to the filter condition comprises: generating an intermediate filter statement corresponding to the input parameter according to the input parameter value and the input parameter name and the filter condition corresponding to the input parameter; and generating the target filter statement according to the intermediate filter statements corresponding to the input parameters in the input parameter set respectively.
[0080] Optionally, the input parameter set comprises one or more sub-sets, and the generating the target filter statement according to the intermediate filter statements corresponding to the input parameters in the input parameter set respectively comprises: connecting the intermediate filter statements corresponding to the input parameters in the same sub-set by using an AND connection symbol to generate the target filter statement corresponding to the interface to be set according to the connected intermediate filter statements.
[0081] Optionally, the generating the target filter statement according to the intermediate filter statements corresponding to the input parameters in the input parameter set respectively further comprises: connecting the intermediate filter statements corresponding to the input parameters not belonging to the same sub-set by using an OR connection symbol to generate the target filter statement corresponding to the interface to be set according to the connected intermediate filter statements.
[0082] Optionally, in the filter condition mapping table, the filter condition identifier and the filter condition are in one-to-one correspondence.
[0083] Optionally, the apparatus further comprises an updating module configured to update the filter condition mapping table periodically.
[0084] Optionally, the apparatus further comprises a querying module configured to receive a query request through the interface; generate a query statement according to the input parameters of the query request and the target filter statement corresponding to the interface; and execute the query statement to respond to the query request.
[0085] The interface configuration apparatus provided by the embodiment of the present application can automatically parse and generate the corresponding target filter statement through the identification of the input parameter name, and no longer needs the development and management of codes, thereby avoiding the negative effects such as high cost, high error rate and slow response speed caused by manual coding.
[0086] Figure 6 An exemplary system architecture 600 of the method or the interface configuration system to which the embodiment of the present application can be applied is shown.
[0087] As Figure 6As shown, the system architecture 600 can include terminal devices 601, 602, 603, a network 604 and a server 605. The network 604 is a medium for providing communication links between the terminal devices 601, 602, 603 and the server 605. The network 604 can include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0088] The user can use the terminal devices 601, 602, 603 to interact with the server 605 through the network 604 to receive or send messages, etc. For example, the terminal devices 601, 602, 603 can send a query request to the server 605 through the network 604, the server 605 can receive the query request through its query interface, and after the server processes the result of the query request, the server can feed back the result of the query request to the terminal 601, 602, 603 through the query interface or other interfaces. Various communication client applications can be installed on the terminal devices 601, 602, 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0089] The terminal devices 601, 602, 603 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers and desktop computers, etc.
[0090] The server 605 can be a server providing various services, such as a background management server supporting a shopping website browsed by the user using the terminal devices 601, 602, 603. The background management server can analyze and process the received product information query request and other data, and feed back the processing result (such as target push information, product information) to the terminal device.
[0091] It should be noted that the method for configuring the interface provided by the first aspect of the embodiment of the present application is generally executed by the server 605, and accordingly, the device for configuring the interface provided by the second aspect of the embodiment of the present application is generally arranged in the server 605.
[0092] It should be understood that, Figure 6 The number of terminal devices, networks and servers in the system architecture 600 is only illustrative. According to the implementation needs, there can be any number of terminal devices, networks and servers.
[0093] The following refers to Figure 7 which shows a structural schematic diagram of a computer system 700 of a terminal device suitable for implementing the embodiment of the present application. Figure 7 The terminal device shown is only an example and should not bring any limitation to the function and use range of the embodiment of the present application.
[0094] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 702 or programs loaded from storage section 708 into random access memory (RAM) 703. The RAM 703 also stores various programs and data required for the operation of the system 700. The CPU 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0095] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 705 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 710 as needed so that computer programs read from it can be installed into the storage section 708 as needed.
[0096] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 709, and / or installed from removable medium 711. When the computer program is executed by central processing unit (CPU) 701, it performs the functions defined above in the system of this invention.
[0097] It should be noted that the computer-readable medium shown in the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, system or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to, electrical connections with one or more conductive wires, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In the present application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system or device. In the present application, the computer-readable signal medium can include a data signal carrying computer-readable program code in a baseband or as part of a carrier wave. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit programs for use by or in conjunction with an instruction execution system, system or device. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination thereof.
[0098] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, program segment or a part of code containing one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different order than that shown in the drawings. For example, two blocks that are shown in succession can actually be executed substantially in parallel, and they can also be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams or flowcharts, and the combination of blocks in the block diagrams or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0099] The modules described in the embodiments of the present application can be implemented in the form of software or hardware. The described modules can also be arranged in a processor, for example, a processor can be described as including an acquisition module, a generation module and a configuration module. In some cases, the names of these modules do not constitute a limitation on the modules themselves, for example, the acquisition module can also be described as "a module that acquires a parameter set corresponding to an interface to be configured".
[0100] As another aspect, the present application also provides a computer readable medium, which can be included in the device described in the above embodiments, or can exist independently without being assembled into the device. The computer readable medium carries one or more programs, which, when executed by the device, cause the device to include:
[0101] acquire a parameter set corresponding to an interface to be configured; the parameter set includes one or more parameters; determine a filter condition corresponding to the parameters according to the one or more parameters and a preset filter condition mapping table; generate a target filter statement corresponding to the interface to be configured according to the filter condition; and configure the interface according to the target filter statement.
[0102] The method and device for interface configuration according to the embodiments of the present application automatically parse and generate a corresponding target filter statement through identification of a parameter name, thereby reducing risks and problems caused by manual coding work, enabling a query interface after configuration to implement query condition assembly with zero code after receiving a query request, greatly improving the efficiency of backend development and reducing the frequency of BUG occurrence.
[0103] The above detailed description does not constitute a limitation on the scope of protection of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims
1. A method for configuring an interface, characterized in that, include: Obtain the set of input parameters corresponding to the interface to be set; the set of input parameters includes one or more input parameters. Based on the one or more input parameters and the preset filtering condition mapping table, determine the filtering conditions corresponding to the input parameters; The filter condition mapping table includes: the mapping relationship between filter condition identifiers and filter conditions; Based on the filtering conditions, generate the target filtering statement corresponding to the interface to be set; Configure the interface according to the target filtering statement; The step of determining the filtering conditions corresponding to the input parameters includes: The filter condition identifier is identified from the input parameters, and the filter condition corresponding to the input parameter is determined according to the mapping relationship between the filter condition identifier and the filter condition. The input parameters include input parameter names; before identifying the filter condition identifier from the input parameters, it also includes: Confirm that the input parameter name includes a filter field identifier and a filter field; otherwise, determine that the input parameter does not have a corresponding filter condition. Before determining the filtering condition corresponding to the input parameter based on the mapping relationship between the filtering condition identifier and the filtering condition, the process includes: Confirm that the filter field identifier exists in the filter condition mapping table; otherwise, determine that the input parameter does not have a corresponding filter condition.
2. The method according to claim 1, characterized in that, The input parameters also include input parameter values; generating the target filtering statement corresponding to the interface to be set according to the filtering conditions includes: Based on the input parameter value and input parameter name, as well as the filtering conditions corresponding to the input parameter, generate the intermediate filtering statement corresponding to the input parameter; The target filtering statement is generated based on the intermediate filtering statements corresponding to each input parameter in the input parameter set.
3. The method according to claim 2, characterized in that, The input parameter set includes one or more subsets. Generating the target filtering statement based on the intermediate filtering statements corresponding to each input parameter in the input parameter set includes: For input parameters of the same subset, the intermediate filtering statements corresponding to each input parameter are connected using the AND operator, so as to generate the target filtering statement corresponding to the interface to be set based on the connected intermediate filtering statements.
4. The method according to claim 3, characterized in that, The step of generating the target filtering statement based on the intermediate filtering statements corresponding to each input parameter in the input parameter set further includes: For input parameters that do not belong to the same subset, the intermediate filtering statements corresponding to each input parameter are connected using the OR operator, so as to generate the target filtering statement corresponding to the interface to be set based on the connected intermediate filtering statements.
5. The method according to claim 1, characterized in that, In the filter condition mapping table, the filter condition identifier and the filter condition correspond one-to-one.
6. The method according to claim 1, characterized in that, The method further includes periodically updating the filter condition mapping table.
7. The method according to claim 1, characterized in that, The method further includes: Receive query requests through the interface; Generate a query statement based on the input parameters of the query request and the target filtering statement corresponding to the interface; Execute the query statement in response to the query request.
8. An interface configuration apparatus, characterized in that, The device includes: The acquisition module is used to acquire the set of input parameters corresponding to the interface to be set; the set of input parameters includes one or more input parameters. The generation module is used to determine the filtering conditions corresponding to the input parameters based on the one or more input parameters and a preset filtering condition mapping table; and to generate the target filtering statement corresponding to the interface to be set based on the filtering conditions; the filtering condition mapping table includes: the mapping relationship between the filtering condition identifier and the filtering condition. A configuration module is used to configure the interface according to the target filtering statement; The generation module is also used to identify the filter condition identifier from the input parameters, and determine the filter condition corresponding to the input parameters according to the mapping relationship between the filter condition identifier and the filter condition. The input parameters include the input parameter names; The generation module is further configured to, before identifying the filter condition identifier from the input parameter, confirm that the input parameter name includes a filter field identifier and a filter field; otherwise, determine that the input parameter does not have a corresponding filter condition; before determining the filter condition corresponding to the input parameter according to the mapping relationship between the filter condition identifier and the filter condition, confirm that the filter field identifier exists in the filter condition mapping table; otherwise, determine that the input parameter does not have a corresponding filter condition.
9. An electronic device with an interface configuration, characterized in that, include: One or more processors; A storage system is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-7.
10. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-7.
Citation Information
Patent Citations
Data processing method and device based on data interface
CN111752964A