Method and device for querying index data based on page configuration

By generating database query language templates and interfaces based on page configuration, the problem of high backend code dependency in indicator data query is solved, enabling rapid changes in business logic and improving development efficiency.

CN115481140BActive Publication Date: 2025-12-23DIGITAL ZHEJIANG TECH OPERATION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211210663.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-30
Publication Date
2025-12-23
Estimated Expiration
2042-09-30

AI Technical Summary

Technical Problem

In existing technologies, changes to the business logic of querying indicator data require modifications to the backend service code, resulting in low code maintainability, low change timeliness, and low development efficiency.

Method used

By generating database query language templates based on page configuration, using the indicator query interface to determine configuration information, generating database query language and returning query results, the dependence on backend code is reduced.

Benefits of technology

It enables rapid changes and maintenance of business logic, improves development efficiency, and reduces dependence on backend code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115481140B_ABST
    Figure CN115481140B_ABST
Patent Text Reader

Abstract

The application provides a method and device for index data query based on page configuration, and relates to the technical field of data processing, and the method comprises the following steps: generating a database query language template based on a pre-acquired page configuration; determining index configuration information through an index query interface; the index configuration information comprises request parameters; generating a database query language according to the request parameters and the database query language template; the database query language is used for completing index data query, and the query result is returned to the index query interface, so that the technical problem of high dependence on back-end code, low business change timeliness and the like is solved, and the technical effect of improving development efficiency is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and in particular to a method and device for querying index data based on page configuration. BACKGROUND

[0002] The existing index data system generally performs index calculation through development of a data processing service (Open Data Processing Service, ODPS) or other big data platforms, and writes index data into a database for implementation. Backend developers encapsulate corresponding query statements and corresponding code logic into interfaces returned to external services, and a series of index data has a series of interfaces. When the business logic changes, the backend needs to modify the corresponding code and publish the backend service to complete the logic modification.

[0003] The business logic of index query is placed in the processing of the backend service. When the business logic changes, the code of the backend service needs to be modified and then published, that is, the backend development needs to maintain a large amount of logic and write more code to complete an interface logic. The code maintainability is not high, and there is a problem of low change timeliness and low development efficiency. SUMMARY

[0004] The purpose of the present application is to provide a method and device for querying index data based on page configuration to alleviate the technical problems of high dependence on backend code and low business change timeliness in the prior art.

[0005] In a first aspect, the embodiments of the present application provide a method for querying index data based on page configuration, including: generating a database query language template based on a pre-acquired page configuration; determining index configuration information through an index query interface; the index configuration information includes a request parameter; generating a database query language according to the request parameter and the database query language template; the database query language is used to complete index data query and return the query result to the index query interface. In some possible implementation manners, generating a database query language template based on a pre-acquired page configuration includes: determining a current index query configuration based on the pre-acquired page configuration; the index query configuration includes a database table to which target query data belongs and an index field returned by query; each index query configuration corresponds to an index code; determining index configuration information according to the index code, the database table and the index field; the index configuration information includes an index aggregation dimension and a limitation condition; generating a database query language template based on the index aggregation dimension and the limitation condition.

[0006] In some possible implementation manners, the current index query configuration is determined based on the pre-acquired page configuration, including: acquiring page index information based on the pre-acquired page configuration; the page index information includes: a database table to which the to-be-queried index data belongs, a target return field of the to-be-queried index data, a query limiting condition, and an aggregation field; and the current index query configuration is determined according to the page index information.

[0007] In some possible implementation manners, the index configuration information is determined through the index query interface, including: storing the index query configuration into a database to generate an index code; and calling the to-be-queried index through the index query interface and inputting the index code corresponding to the to-be-queried index.

[0008] In some possible implementation manners, the method further includes: acquiring a request parameter of the index query interface and a verification EL expression of a current index query interface configuration; and verifying the request parameter by using the verification EL expression to determine whether the request parameter meets the requirements.

[0009] In some possible implementation manners, the database query language is generated according to the request parameter and the database query language template, including: if the request parameter meets the requirements, determining a database query language template according to the request parameter and the index configuration; generating a data quick query language based on the database query language template; calling the data quick query language to complete index data query, and returning a query result to the index query interface.

[0010] In the second aspect, an apparatus for index data query based on page configuration is provided, including: a template generation module, configured to generate a database query language template based on pre-acquired page configuration; a configuration information determination module, configured to determine index configuration information through an index query interface; the index configuration information includes a request parameter; a database query language generation module, configured to generate a database query language according to the request parameter and the database query language template; the database query language is used to complete index data query and return a query result to the index query interface.

[0011] In some possible implementation manners, the template generation module is further configured to: determine a current index query configuration based on pre-acquired page configuration; the index query configuration includes: a database table to which target query data belongs and an index field returned by query; each index query configuration corresponds to an index code; determine index configuration information according to the index code, the database table, and the index field; the index configuration information includes: an index aggregation dimension and a limiting condition; and generate a database query language template based on the index aggregation dimension and the limiting condition.

[0012] In a third aspect, an electronic device is provided, which comprises a memory and a processor, the memory storing a computer program executable on the processor, and the processor implements the steps of the method of any one of the first aspect when executing the computer program.

[0013] In a fourth aspect, a computer readable storage medium is provided, which stores computer executable instructions, and the computer executable instructions, when invoked and executed by a processor, cause the processor to execute the method of any one of the first aspect.

[0014] The application provides a method and device for querying index data based on page configuration, the method comprising: generating a database query language template based on pre-acquired page configuration; determining index configuration information through an index query interface; the index configuration information comprising request parameters; generating a database query language according to the request parameters and the database query language template; the database query language being used to complete index data query and return query results to the index query interface, which solves the technical problems of high dependence on backend code, low timeliness of business changes, and achieves the technical effect of improving development efficiency. BRIEF DESCRIPTION OF DRAWINGS

[0015] In order to more clearly illustrate the specific embodiments of the application or the technical solutions in the prior art, the following will briefly introduce the drawings needed to be used in the specific embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.

[0016] Figure 1 A flowchart of a method for querying index data based on page configuration provided by the embodiment of the application is shown in the figure.

[0017] Figure 2 A flowchart of another method for querying index data based on page configuration provided by the embodiment of the application is shown in the figure.

[0018] Figure 3 A structure diagram of a device for querying index data based on page configuration provided by the embodiment of the application is shown in the figure.

[0019] Figure 4 A structure diagram of an electronic device provided by the embodiment of the application is shown in the figure. DETAILED DESCRIPTION

[0020] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the following will be combined with the accompanying drawings to make a clear and complete description of the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the accompanying drawings can be arranged and designed in various different configurations.

[0021] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative labor are within the scope of protection of the present application.

[0022] It should be noted that similar reference numerals and letters represent similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. Some embodiments of the present application will be described in detail below in combination with the accompanying drawings. The following embodiments and features in the embodiments can be combined with each other without conflict.

[0023] Generally, an index data system performs index calculation through an ODPS or other big data platform, and writes index data into a database. Backend developers encapsulate corresponding query statements and corresponding code logic into interfaces to return to external services, and a series of index data has a series of interfaces. When business logic changes, the backend needs to modify the corresponding code and publish the backend service to complete the logic modification. The business logic of index query is placed in the backend service, and when the business logic changes, the backend service code needs to be modified and published. Disadvantages: there is a certain timeliness from the change of index business logic to online; the backend development needs to maintain a large amount of logic, and the code maintainability is not high; the development efficiency is not high, and more code needs to be written to complete an interface logic.

[0024] Based on this, the embodiments of the present application provide a method and device for querying index data based on page configuration to solve the above problems.

[0025] In order to facilitate the understanding of the present embodiment, first, a method for querying index data based on page configuration disclosed by the embodiments of the present application will be described in detail, referring to Figure 1 The method can be executed by an electronic device, and mainly includes the following steps S101 to S103:

[0026] S110: generating a database query language template based on the pre-acquired page configuration;

[0027] The structured query language (SQL) is a language for operating a database, used for storing, retrieving and modifying data stored in a relational database, including creating a database, deleting a database, querying a record, modifying a record, adding a field, etc.

[0028] S120: Determine the index configuration information through the index query interface; the index configuration information includes the request parameter;

[0029] S130: Generate a database query language according to the request parameter and the database query language template; the database query language is used to complete the index data query and return the query result to the index query interface.

[0030] In an embodiment, referring to FIG. 1, Figure 2 The step S110 of generating the database query language template based on the pre-acquired page configuration includes:

[0031] S21: Determine the current index query configuration based on the pre-acquired page configuration;

[0032] The index query configuration includes the database table to which the target query data belongs and the index field returned by the query; each index query configuration corresponds to an index code.

[0033] The database table is generally a collection of a series of two-dimensional arrays, used to represent and store the relationship between data objects, composed of vertical columns and horizontal rows. The index field can be a related field of the data to be queried in a specific scenario, such as the user_active_table in the user registration active number scenario; the index field can include the number of active users, the number of registered users, the same channel registration active rate, etc.

[0034] In this embodiment, the step specifically includes: first, acquiring page index information based on the pre-acquired page configuration; the page index information includes the database table to which the index data to be queried belongs, the target return field of the index data to be queried, the query limiting condition and the aggregation field; determining the current index query configuration according to the page index information. The database table, the target return field and the query limiting condition are mandatory items, and the aggregation field is an optional item.

[0035] S22: Determine the index configuration information according to the index code, the database table and the index field; the index configuration information includes the index aggregation dimension and the limiting condition;

[0036] The index aggregation dimension can be predefined, such as: the index aggregation dimension in the user registration active number scenario includes: province code, city code, county code, and date. The limiting condition can be predefined according to the actual to-be-queried index, such as: the limiting condition in the user registration active number scenario can include: user type, date, province code, city code, and county code.

[0037] S23: generating a database query language template based on the index aggregation dimension and the limiting condition.

[0038] In an embodiment, the determination of the index configuration information through the index query interface in the above step S120 includes: storing the index query configuration into a database, and generating an index code; calling a to-be-queried index through the index query interface, and inputting the index code corresponding to the to-be-queried index.

[0039] In an embodiment, the above method further includes: obtaining a request parameter of the index query interface and a verification EL expression of a current index query interface configuration; and verifying the request parameter by using the verification EL expression to determine whether the request parameter meets the requirements.

[0040] In an embodiment, the generation of the database query language according to the request parameter and the database query language template in the above step S130 includes: if the request parameter meets the requirements, determining the database query language template according to the request parameter and the index configuration; generating the data fast query language based on the database query language template; calling the data fast query language to complete the index data query, and returning the query result to the index query interface.

[0041] The verification is mainly performed by using the EL expression preset by the database. First, the interface request parameter and the verification EL expression of the current interface configuration are obtained; and then, each expression is executed to perform the verification. The null judgment expression can be: #startDate! = null, indicating that the statDate of the input parameter cannot be null; and the time comparison expression can be: T(java.time.LocalDate).parse(#startDate).isBefore(T(java.time.LocalDate).parse(#endDate)), indicating that the statDate of the input parameter cannot be greater than the endDate of the input parameter.

[0042] As a specific example, the above method can include the following flow:

[0043] 1. The information of the index is configured through a page, such as: the database table to which the query data belongs, the field to be returned by the query, the aggregation field, and the query limiting condition, to complete an index query configuration.

[0044] 2. Store the index query configuration into the database, and automatically generate an index code.

[0045] 3. Provide a unified index query interface, and the query interface is defined as: / index / query / {indexCode}, wherein the indexCode is a dynamic input parameter, and different codes are input according to different indexes called by the calling party.

[0046] 4. Query the index configuration information according to the indexCode, and verify the request input parameter to determine whether the input parameter meets the requirements.

[0047] 5. Generate an executable SQL according to the pre-execution SQL obtained according to the request input parameter and the index configuration.

[0048] 6. Call the SQL execution engine to complete data query, and return the interface data.

[0049] As a specific example, the process of dynamically querying the index by using the above method can include the following steps:

[0050] S31: Expose the interface uniformly, and take the index code as an interface parameter;

[0051] S32: Obtain the index code in the path, and query the index configuration information;

[0052] S33: Verify the request parameter by using an EL expression;

[0053] S34: Generate an executable SQL statement according to the request parameter and the index SQL template;

[0054] S35: Execute the SQL statement to query data.

[0055] By using the above method of querying index data based on page configuration, the business party can configure the interface query according to the business logic, and the interface can provide data to the outside without the backend development; the index data query definition and logic are unified in one place, which is convenient for subsequent maintenance and modification; the development efficiency is improved, and the backend code does not need to be developed, but only needs to be configured by using the page; the problem that the SQL statement needs to be written in advance in the traditional java web and cannot be dynamically changed is solved. In addition, the embodiment of the application further provides a device for querying index data based on page configuration, as shown in Figure 3 The device includes a template generation module 310 configured to generate a database query language template based on a pre-acquired page configuration;

[0056] A configuration information determination module 320 configured to determine index configuration information through an index query interface; the index configuration information includes a request parameter.

[0057] The database query language generation module 330 is configured to generate a database query language according to the request parameter and a database query language template, wherein the database query language is used to complete the index data query and return the query result to the index query interface.

[0058] In an embodiment, the template generation module is further configured to: determine a current index query configuration based on the pre-acquired page configuration, wherein the index query configuration comprises a database table to which the target query data belongs and an index field returned by the query; each index query configuration corresponds to an index code; determine index configuration information according to the index code, the database table and the index field, wherein the index configuration information comprises an index aggregation dimension and a limitation condition; and generate a database query language template based on the index aggregation dimension and the limitation condition.

[0059] The apparatus for querying index data based on a page configuration provided in the embodiments of the present application can be specific hardware on a device or software or firmware installed on the device, etc. The apparatus provided in the embodiments of the present application has the same implementation principles and technical effects as the foregoing method embodiments. For brevity and conciseness, the apparatus embodiment part is not mentioned in the foregoing description, and the corresponding content in the foregoing method embodiments can be referred to. Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the system, apparatus and unit described above can be referred to the corresponding processes in the foregoing method embodiments, which will not be described herein. The apparatus for querying index data based on a page configuration provided in the embodiments of the present application has the same technical features as the method for querying index data based on a page configuration provided in the foregoing embodiments, and thus can solve the same technical problems and achieve the same technical effects.

[0060] The embodiments of the present application further provide an electronic device, specifically, the electronic device comprises a processor and a storage device; the storage device stores a computer program, and the computer program performs the method according to any one of the embodiments when executed by the processor.

[0061] Figure 4 A structural schematic diagram of an electronic device provided in the embodiments of the present application is shown in FIG. 4. The electronic device 400 comprises a processor 40, a memory 41, a bus 42 and a communication interface 43, wherein the processor 40, the communication interface 43 and the memory 41 are connected through the bus 42; the processor 40 is configured to execute executable modules stored in the memory 41, such as a computer program.

[0062] The memory 41 can include a high-speed random access memory (RAM), and can also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 43 (which can be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network, etc. can be used.

[0063] The bus 42 can be an ISA bus, a PCI bus, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the figure, but it does not mean that there is only one bus or only one type of bus.

[0064] The memory 41 is used to store programs, and the processor 40 executes the programs after receiving execution instructions. The method executed by the device defined by the flow process disclosed in any of the embodiments of the present application can be applied to the processor 40 or implemented by the processor 40.

[0065] The processor 40 can be an integrated circuit chip with signal processing capability. In implementation, each step of the above method can be completed by integrated logic circuit of hardware in the processor 40 or by instructions in the form of software. The processor 40 described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; or can be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. Each method, step and logic block diagram disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware code processor for execution, or a combination of hardware and software modules in the code processor for execution. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium in the memory 41 is read by the processor 40, and the hardware thereof is combined to complete the steps of the above method.

[0066] Corresponding to the above method, the embodiments of the present application also provide a computer readable storage medium, the computer readable storage medium stores machine executable instructions, when the processor calls and runs the computer executable instructions, the computer executable instructions cause the processor to run the steps of the above method.

[0067] In the embodiments provided by the present application, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection can be indirect coupling or communication connection through some communication interface, device or unit, and can be electrical, mechanical or other forms.

[0068] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e. may be located in one place, or may be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0069] In addition, the functional units in the embodiments provided in the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.

[0070] When the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the parts of the present application that essentially contribute to the prior art or the parts of the technical solutions can be embodied in the form of software products. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, an electronic device, or a network device, etc.) to execute all or part of the steps of the method described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various program code storage media.

[0071] It should be noted that: similar reference numbers and letters represent similar items in the drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings, and in addition, the terms "first", "second", "third" and the like are only used to distinguish description, and cannot be understood as indicating or implying relative importance.

[0072] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for querying index data based on page configuration, characterized in that, The method comprises the following steps: determining a current index query configuration based on a pre-acquired page configuration; the index query configuration comprises a database table to which target query data belongs and an index field returned by the query; each index query configuration corresponds to an index code; index configuration information is determined according to the index code, the database table and the index field; the index configuration information comprises index aggregation dimensions and limitation conditions; a database query language template is generated based on the index aggregation dimensions and the limitation conditions; determining index configuration information through an index query interface; the index configuration information comprises request parameters; the index query interface is an interface defined by a unified path and containing a dynamic index code; acquiring the request parameters of the index query interface and a verification EL expression of a current index query interface configuration; the request parameters are verified by using the verification EL expression to determine whether the request parameters meet the requirements; if the request parameters meet the requirements, a database query language is generated according to the request parameters and the database query language template; the database query language is used to complete index data query and return the query result to the index query interface.

2. The method of claim 1, wherein, determining a current index query configuration based on a pre-acquired page configuration, comprising: acquiring page index information based on a pre-acquired page configuration; the page index information comprises a database table to which to-be-queried index data belongs, target return fields of the to-be-queried index data, query limitation conditions and aggregation fields; determining a current index query configuration according to the page index information.

3. The method of claim 2, wherein, determining index configuration information through an index query interface, comprising: storing the index query configuration into a database to generate an index code; calling to-be-queried index through the index query interface and inputting the index code corresponding to the to-be-queried index.

4. An apparatus for querying index data based on page configuration, the apparatus comprising: The method comprises the following steps: a template generation module is configured to determine a current index query configuration based on a pre-acquired page configuration; the index query configuration comprises a database table to which target query data belongs and an index field returned by the query; each index query configuration corresponds to an index code; index configuration information is determined according to the index code, the database table and the index field; the index configuration information comprises index aggregation dimensions and limitation conditions; a database query language template is generated based on the index aggregation dimensions and the limitation conditions; a configuration information determination module is configured to determine index configuration information through an index query interface; the index configuration information comprises request parameters; the index query interface is an interface defined by a unified path and containing a dynamic index code; The verification module is configured to acquire a request parameter of the index query interface and a verification EL expression configured currently for the index query interface, and to verify the request parameter by using the verification EL expression to determine whether the request parameter meets the requirements.

5. An electronic device comprising a memory, a processor, the memory having stored therein a computer program executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the method of any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer executable instructions, and the computer executable instructions, when invoked and executed by the processor, cause the processor to execute the method of any one of claims 1 to 3.

Citation Information

Patent Citations

  • Data query method and device based on configuration information

    CN110019350A

  • Index-based user-defined query interface method and index-based user-defined query interface system

    CN112114802A