Report data query method and device, equipment and storage medium
By analyzing query statements and statement annotations in the target configuration file, the data structure is generated, and the problem of low efficiency in report data query in the existing technology is solved, and efficient and simple multi-data source query is achieved.
Patent Information
- Application Number
- CN202510226576.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2025-05-30
AI Technical Summary
When obtaining report data, the prior art requires different query statements to query data from different data sources many times, resulting in low query efficiency and cumbersome process.
By obtaining the target configuration file, the configuration file includes a query statement and corresponding statement annotations, parses into a data structure, and uses the query statements and query parameters in the data structure to obtain query results from multiple data sources.
It realizes simple and efficient query of report data, and obtains query results from multiple data sources at once, improving query efficiency and simplifying the process of writing configuration files.
Smart Images

Figure CN120067160A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data query, and particularly to a method, device, equipment and storage medium for querying report data. Background Art
[0002] A report is a data set presented in the form of a table, graph or text. When generating a report, the required data can be obtained through different query statements or from different data sources. For example: obtaining different data from a data source multiple times through different SQL (Structured Query Language) query statements, or obtaining data from different data sources through different SQL query statements. The data sources include: MySQL (My Structured Query Language, relational database management system), IMPALA (big data analysis query engine), ClickHouse (real-time data analysis database), etc. It can be seen that currently, when obtaining data in a report, it is necessary to query data from different data sources multiple times through different query statements, and then summarize the query results of each time and fill them into the report. The data query efficiency is low and the query process is rather cumbersome.
[0003] Therefore, how to simply and efficiently query report data is a problem that needs to be solved by those skilled in the art. Summary of the Invention
[0004] This application provides a method, device, equipment and storage medium for querying report data to simply and efficiently query report data.
[0005] In a first aspect, this application provides a method for querying report data, including:
[0006] Obtaining a target configuration file; the target configuration file includes at least one query statement and a statement annotation corresponding to each query statement; the statement annotation includes query parameters;
[0007] Parsing the query statements and statement annotations in the target configuration file into a first data structure;
[0008] Using each query statement in the first data structure and the query parameters corresponding to each query statement to obtain a query result of report data; wherein, each query statement obtains a query result from at least one data source through at least one data source identifier in the query parameters.
[0009] Optionally, the obtaining of the target configuration file includes:
[0010] Obtaining an initial configuration file;
[0011] Format each query statement in the initial configuration file to obtain a target configuration file.
[0012] Optionally, after obtaining the query result of the report data, it further includes:
[0013] Determine the target report template;
[0014] Modify the values of each variable in the target report template using the query result to obtain a report filling result;
[0015] Render the report according to the report filling result to generate a target report.
[0016] Optionally, modifying the values of each variable in the target report template using the query result includes:
[0017] Encapsulate the query result into a second data structure;
[0018] Modify the values of each variable in the target report template according to the query result in the second data structure.
[0019] Optionally, parsing the query statement and statement annotation in the target configuration file into a first data structure includes:
[0020] Read the query statement and statement annotation in the target configuration file;
[0021] Parse the query parameters in each statement annotation;
[0022] Encapsulate each query statement and its corresponding query parameters into a first data structure.
[0023] Optionally, encapsulating each query statement and its corresponding query parameters into a first data structure includes:
[0024] Encapsulate each query statement and its corresponding query parameters into a query request object;
[0025] Generate a list of query request objects based on each query request object.
[0026] Optionally, parsing the query parameters in each statement annotation includes:
[0027] Parse the data source identifier, query result identifier, and custom query control identifier in each statement annotation.
[0028] In a second aspect, the present application provides a report data query device, including:
[0029] An acquisition module for acquiring a target configuration file; the target configuration file includes at least one query statement and a statement annotation corresponding to each query statement; the statement annotation includes query parameters.
[0030] A parsing module for parsing the query statements and statement annotations in the target configuration file into a first data structure.
[0031] A query module for obtaining a query result of report data by using each query statement in the first data structure and the query parameters corresponding to each query statement; wherein, each query statement obtains a query result from at least one data source through at least one data source identifier in the query parameters.
[0032] In a third aspect, the present application provides an electronic device, including:
[0033] A processor, a memory, and a computer program stored on the memory and executable on the processor, and the processor executes the steps of the above-mentioned report data query method of the present application through the computer program.
[0034] In a fourth aspect, the present application further provides a computer storage medium, which stores computer executable instructions for executing the steps of the above-mentioned report data query method of the present application.
[0035] The above technical solutions provided by the embodiments of the present application have the following advantages compared with the prior art: The present application discloses a method, device, equipment, and storage medium for querying report data. When querying report data in the present application, first, a target configuration file needs to be acquired. The target configuration file includes at least one query statement and a corresponding statement annotation, and the statement annotation includes query parameters; the query statements and statement annotations in the target configuration file are parsed into a first data structure, and a query result of report data is obtained by using each query statement in the first data structure and the query parameters corresponding to each query statement; wherein, each query statement obtains a query result from at least one data source through at least one data source identifier in the query parameters. It can be seen that the present application can obtain query results from multiple data sources at one time through different query statements and different data source identifiers, improving the query efficiency; and, the writing method of the target configuration file is relatively convenient, thus realizing simple and efficient query of report data. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings here are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present invention and used together with the specification to explain the principles of the present invention.
[0037] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0038] One or more embodiments are exemplarily illustrated by the pictures in the corresponding drawings. These exemplary illustrations do not limit the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements. Unless otherwise stated, the drawings in the figures do not constitute a proportional limitation.
[0039] Figure 1 It is a schematic flowchart of a method for querying report data provided by an embodiment of the present application;
[0040] Figure 2 It is a schematic flowchart of another method for querying report data provided by an embodiment of the present application;
[0041] Figure 3 It is a schematic flowchart of another method for querying report data provided by an embodiment of the present application;
[0042] Figure 4 It is a schematic flowchart of another method for querying report data provided by an embodiment of the present application;
[0043] Figure 5 It is a schematic structural diagram of a device for querying report data provided by an embodiment of the present application;
[0044] Figure 6 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0045] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts belong to the scope of protection of the present application.
[0046] The following disclosure provides many different embodiments or examples for implementing different structures of the present invention. To simplify the disclosure of the present invention, the components and settings of specific examples are described below. Of course, they are only examples and are not intended to limit the present invention. In addition, the present invention may repeat reference numerals and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0047] The embodiments of the present application provide a method, device, equipment and storage medium for querying report data, so as to query report data simply and efficiently.
[0048] See Figure 1 , which is a schematic flowchart of a method for querying report data provided by the embodiments of the present application. The method for querying report data includes the following steps:
[0049] S101. Obtain a target configuration file; the target configuration file includes at least one query statement and a statement annotation corresponding to each query statement; the statement annotation includes query parameters;
[0050] In the present application, the configuration file is a configuration file written according to actual data query requirements, and the present application uses the format of an SQL file to save the configuration content. For this configuration file, the present application proposes a content format of the configuration file, which includes: multiple query statements and a statement annotation corresponding to each query statement, and the statement annotation includes at least one query parameter corresponding to the query statement. The query parameter may include at least one data source identifier, and the data source identifier is a string or code used to uniquely identify and distinguish different data sources. It may be the name of the data source, the address of the data source, etc., which is not specifically limited herein as long as the query statement in the present application can obtain a query result from the corresponding data source through the data source identifier. Through this design of the content format, the present application can make the format of the configuration file intuitive and clear, facilitate report developers to write, and improve the readability of the displayed SQL.
[0051] When querying report data, the configuration file can be simply and quickly written according to the content format of the configuration file. Multiple query statements, specifically SQL query statements, are written in the configuration file; and in the configuration file, defined query parameters are added using SQL comments (statement annotations). The query parameters are used to specify the data sources used by different SQL query statements, the identifiers of query results, and other control query parameters. Therefore, through this configuration file, all query logics can be provided, thereby realizing unified query of multiple data sources. In the present application, for the sake of distinction, the configuration file obtained this time is called the target configuration file.
[0052] S102. Parse the query statements and statement annotations in the target configuration file into a first data structure;
[0053] In this application, in order to facilitate the unified query of multiple query statements and multiple data sources, it is necessary to parse the target configuration file into a specific data structure. Specifically, in this parsing process, the query statements and statement annotations in the target configuration file are stored through the data structure. This data structure is a format for data organization, management, and storage. By parsing the target configuration file into the first data structure, this application can improve the execution efficiency of query statements, and during the parsing process, it can ensure the correctness of the query statements in the configuration file and the correctness of the query parameters recorded in the statement annotations in the configuration file, thereby generating an effective data structure and avoiding errors during the execution of query statements. In this application, for the sake of distinction, the data structure parsed from the target configuration file is referred to as the first data structure.
[0054] S103. Use each query statement in the first data structure and the query parameters corresponding to each query statement to obtain the query result of the report data; wherein, each query statement obtains the query result from at least one data source through at least one data source identifier in the query parameters.
[0055] In this embodiment, after determining the first data structure according to the target configuration file, the first data structure will be used for data query to obtain the query result of the report data. The first data structure includes each query statement and the query parameters corresponding to each query statement. Therefore, when querying data, it is necessary to execute the corresponding query statement using the query parameters in the first data structure; moreover, in this application, each query parameter corresponding to each query statement includes at least one data source identifier. Therefore, when executing the query statement, the query statement can obtain the query result from the corresponding at least one data source through at least one data source identifier.
[0056] For example: The first data structure records: query statement 1, data source identifiers 11 and 12 of query statement 1, query statement 2, and data source identifier 21 of query statement 2. Then, when executing query statement 1, it is necessary to query the report data from data source 11 using the data source identifier 11 and query the report data from data source 12 using the data source identifier 12; when executing query statement 2, it is necessary to query the report data from the corresponding data source 21 using the data source identifier 21. In this embodiment, the report data queried from the data source is referred to as the query result.
[0057] In summary, when querying report data in this application, it is first necessary to obtain a target configuration file. Multiple query statements and corresponding annotations are set in the target configuration file. The annotations include the query parameters of each query statement. Then, after parsing the target configuration file into a first data structure, the query results can be obtained from each data source through the query statements in the first data structure and at least one data source identifier corresponding to each query statement. It can be seen that in this application, query results can be obtained from multiple data sources at one time through different query statements and different data source identifiers, improving the query efficiency. Moreover, the writing method of the target configuration file is relatively convenient, thus realizing simple and efficient query of report data.
[0058] See Figure 2 , which is a schematic flowchart of another method for querying report data provided by an embodiment of this application. The method for querying report data includes the following steps:
[0059] S201. Obtain an initial configuration file;
[0060] S202. Perform formatting processing on each query statement in the initial configuration file to obtain a target configuration file. Among them, the target configuration file includes at least one query statement and a statement annotation corresponding to each query statement. The statement annotation includes query parameters;
[0061] S203. Parse the query statements and statement annotations in the target configuration file into a first data structure;
[0062] S204. Use each query statement in the first data structure and the query parameters corresponding to each query statement to obtain the query results of the report data. Among them, each query statement obtains the query results from at least one data source through at least one data source identifier in the query parameters.
[0063] In this application, the query statements in the target configuration file are formatted query statements. Among them, SQL formatting refers to typesetting and organizing SQL statements according to certain specifications to make them easier to read and understand. This includes using appropriate indentation, spaces, and line breaks, and performing unified typesetting on keywords, table names, field names, etc.
[0064] In this application, the target configuration file can be generated in two ways. The first way is to format the original query statements and then generate the target configuration file according to a predetermined content format. The second way is to generate the initial configuration file according to a predetermined memory format for the original query statements and then perform formatting processing on the query statements in the initial configuration file through an initialization tool.
[0065] In summary, by formatting the query statements in the target configuration file, this application can improve the readability of the query statements, making them easier to read and understand, reduce query statement errors, and improve the maintainability of the query statements. Using this standard SQL file format in this application facilitates report developers to write and format SQL content.
[0066] See Figure 3 , which is a schematic flow diagram of another report data query method provided by an embodiment of this application. The report data query method includes the following steps:
[0067] S301. Obtain the target configuration file; the target configuration file includes at least one query statement and a statement annotation corresponding to each query statement; the statement annotation includes query parameters;
[0068] S302. Read the query statements and statement annotations in the target configuration file;
[0069] S303. Parse the query parameters in each statement annotation;
[0070] S304. Package each query statement and the corresponding query parameters into a first data structure;
[0071] S305. Use each query statement in the first data structure and the query parameters corresponding to each query statement to obtain the query result of the report data; among them, each query statement obtains the query result from at least one data source through at least one data source identifier in the query parameters.
[0072] In this application, when parsing the target configuration file, the configuration file can be parsed into the first data structure through a specific parsing algorithm. The specific parsing process is: read the query statements and statement annotations in the target configuration file, parse the query parameters in each statement annotation, and package each query statement and the corresponding query parameters into the first data structure.
[0073] In another embodiment of this application, when parsing the query parameters in each statement annotation, it is specifically necessary to parse the data source identifier, query result identifier, and custom query control identifier in each statement annotation; when packaging each query statement and the corresponding query parameters into the first data structure, it is specifically necessary to package each query statement and the corresponding query parameters into a query request object; generate a query request object list according to each query request object.
[0074] Here, the target configuration file is described through a specific embodiment. The target configuration file includes the following content:
[0075] --@datasource:sr1, sr2
[0076] --@name:olap_data1
[0077] --@translations:type
[0078] select type,count(1)as cnt from table1 group by type
[0079] --@datasource:ck1,ck2
[0080] --@name:olap_data2
[0081] select count(1)as cnt from table2
[0082] Among them, the first to the third lines are the statement comments of the first query statement, the fourth line is the first query statement, the fifth and sixth lines are the statement comments of the second query statement, and the seventh line is the second query statement; in this embodiment, only the case where two query statements are included in the target configuration file is taken as an example for illustration. In actual applications, the number of query statements can be set according to actual needs.
[0083] In the statement comments, datasource is the data source identifier used by the query statement. This data source identifier can specify multiple redundancies of the same type of data source. If data cannot be obtained from one of the data sources, it will be obtained from another redundant data source; name is the query result identifier, which is the identifier of the query result and is used as a key to mark the query results of each query statement when encapsulating the query results; translations is a custom query control identifier, which is a custom parameter for other control queries and can be set according to actual needs.
[0084] Each query in the above target configuration file can be parsed into a specific data structure. In this embodiment, it is shown in Java code. The configuration file can be parsed into a Java bean object, and multiple queries are an array or a List. In this embodiment, multiple query statements can be parsed into a List <queryrequest>(Query request object list), the data structure of a single query request object in the query request object list is as follows:
[0085]
[0086] Among them, the fields in the data structure correspond one by one to the query parameters in the statement comment of a single SQL query statement in the configuration file, that is: dataSource, name, and translations in the data structure correspond to the data source identifier, query result identifier, and custom query control identifier in the target configuration file respectively, and sql in the data structure is the SQL query statement in the target configuration file.
[0087] In this embodiment, a specific algorithm code for parsing the configuration file is as follows:
[0088]
[0089]
[0090]
[0091] Through this parsing algorithm, this application can parse each query statement in the target configuration file and the query parameters corresponding to each query statement into a List <queryrequest>in such a form, so as to achieve unified query of multi-query SQL and multiple data sources.
[0092] In summary, when parsing the target configuration file in this application, the query statements and statement annotations in the target configuration file can be specifically read, and each parsed query parameter can be obtained. The parsed query parameters and query statements are encapsulated into the first data structure together, which is convenient for unified query of multiple queries and multiple data sources and improves the query speed. Moreover, the first data structure in this application is specifically a query request object corresponding to each query statement. For multiple query statements, a corresponding list of query request objects can be generated. Furthermore, based on this list of query request objects, data query of multiple data sources can be quickly achieved. Further, when parsing the query parameters in this application, the data source identifier, query result identifier, and custom query control identifier in the statement annotation can be specifically parsed. Through the above parameters, the data source, query result, and other parameters for controlling the query of each query statement can be effectively specified, which is convenient for expansion and improves the flexibility of data query.
[0093] See Figure 4 , which is a schematic flow diagram of another report data query method provided by an embodiment of this application. The report data query method includes the following steps:
[0094] S401. Obtain the target configuration file; the target configuration file includes at least one query statement and the statement annotation corresponding to each query statement; the statement annotation includes query parameters;
[0095] S402. Parse the query statements and statement annotations in the target configuration file into the first data structure;
[0096] S403. Use each query statement in the first data structure and the query parameters corresponding to each query statement to obtain the query result of the report data; wherein, each query statement obtains the query result from at least one data source through at least one data source identifier in the query parameters;
[0097] S404. Determine the target report template;
[0098] S405. Use the query result to modify the values of each variable in the target report template to obtain the report filling result;
[0099] S406. Render the report according to the report filling result to generate the target report.
[0100] In this application, when generating a report, first, a target configuration file needs to be set. The target configuration file can specify multiple query statements and other parameters such as the data source corresponding to each query statement. Finally, queries are performed according to this configuration file to obtain multiple query results to fill the data report, and then it is pushed to the specified recipient.
[0101] Moreover, this application parses the target configuration file into a specific first data structure, and implements unified query of multiple queries and multiple data sources according to the first data structure. After obtaining the query result of the report data, in another embodiment of this application, in order to improve the report filling speed, the query result can be encapsulated into a second data structure, and according to the query result in the second data structure, the values of each variable in the target report template are modified, so as to realize the filling of the report content, and rendering is performed according to the filling result. Among them, the second data structure can be in json format. Therefore, after this application obtains multiple query results, the multiple query results can be encapsulated into json format, and the query results in this format can more conveniently fill and render the data report.
[0102] In this embodiment, after parsing the above target configuration file into the first data structure, an example of the obtained query result is as follows:
[0103]
[0104] Among them, olap_data1 is the query result identifier of the first query statement, 10000 is the query result of the first query statement, olap_data2 is the query result identifier of the first query statement, and 5678 is the query result of the first query statement.
[0105] After obtaining the query result, the template of the data report can be filled and rendered through the query result. An example of the report template in this embodiment is as follows:
[0106]
[0107]
[0108] Then, each variable in the report template is filled with the query result to obtain the report filling result, and report rendering is performed according to the report filling result to generate the target report. After obtaining the target report, the target report can be further pushed and displayed; this application can support more variable replacements and renderings in combination with the template language, which is not specifically limited here.
[0109] It can be seen that after this application obtains the query result, the query result can be filled into each variable of the target report template, and the target report is generated after report rendering according to the filling result. Through this method, the target report can be quickly generated, and the report generation speed is improved. After this application obtains the query result, the query result can be encapsulated into a data structure and then the target report template is filled, so as to improve the filling speed of the report data.
[0110] In summary, the present application can implement unified query of multiple data sources and multiple statements based on SQL comments, and complete the writing of report tasks with a single configuration file. This configuration file contains all query logics and is convenient for further expansion. The present application also provides the content format of the configuration file and the parsing algorithm, so as to achieve fast parsing of the configuration file. This content format can also be used in other scenarios, such as: display of multiple queries and multiple results, sequential execution of SQL, special control of each SQL, etc. The present application plays a key role in implementing the data task of pushing custom reports. The present application can set the corresponding configuration file according to the data acquisition task, and report developers can conveniently write the configuration file and the corresponding report template, which plays a great role in quickly implementing the push of data reports.
[0111] See Figure 5 , Figure 5 which is a schematic structural diagram of a report data query device provided by an embodiment of the present application. The device specifically includes:
[0112] An acquisition module 11, configured to acquire a target configuration file; the target configuration file includes at least one query statement and a statement comment corresponding to each query statement; the statement comment includes query parameters;
[0113] A parsing module 12, configured to parse the query statement and the statement comment in the target configuration file into a first data structure;
[0114] A query module 13, configured to use each query statement in the first data structure and the query parameters corresponding to each query statement to obtain a query result of report data; wherein, each query statement obtains a query result from at least one data source through at least one data source identifier in the query parameters.
[0115] As an optional embodiment, the acquisition module includes:
[0116] An acquisition unit, configured to acquire an initial configuration file;
[0117] A processing unit, configured to perform formatting processing on each query statement in the initial configuration file to obtain a target configuration file.
[0118] As an optional embodiment, the report data query device further includes:
[0119] A determination module, configured to determine a target report template;
[0120] A modification module, configured to use the query result to modify the values of each variable in the target report template to obtain a report filling result;
[0121] A rendering module, configured to perform report rendering according to the report filling result to generate a target report.
[0122] As an alternative embodiment, the modification module is specifically configured to: encapsulate the query result into a second data structure; modify the values of the variables in the target report template according to the query result in the second data structure.
[0123] As an alternative embodiment, the parsing module includes:
[0124] A reading unit, configured to read the query statement and statement annotation in the target configuration file;
[0125] A parsing unit, configured to parse the query parameters in each statement annotation;
[0126] An encapsulation unit, configured to encapsulate each query statement and the corresponding query parameter into a first data structure.
[0127] As an alternative embodiment, the encapsulation unit is specifically configured to: encapsulate each query statement and the corresponding query parameter into a query request object; generate a query request object list according to each query request object.
[0128] As an alternative embodiment, the parsing unit is specifically configured to: parse the data source identifier, query result identifier, and custom query control identifier in each statement annotation.
[0129] Regarding the device in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated herein.
[0130] See Figure 6 , Figure 6 which is a schematic structural diagram of an electronic device provided by an embodiment of the present application. The electronic device specifically includes:
[0131] A processor 21, a memory 22, and a computer program stored on the memory 22 and executable on the processor 21. The processor 21 executes the steps of the report data query method described in any of the above method embodiments through the computer program.
[0132] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor used to process data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may further include an AI (Artificial Intelligence) processor, and the AI processor is used to process computational operations related to machine learning.
[0133] The memory 22 may include one or more computer-readable storage media, and the computer-readable storage media may be non-transitory. The memory 22 may further include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In this embodiment, the memory 22 is at least used to store the following computer program 221. After the computer program is loaded and executed by the processor 21, it can implement the relevant steps in the report data query method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 22 may further include an operating system 222 and data 223, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 222 may include Windows, Unix, Linux, etc.
[0134] In some embodiments, the electronic device may further include a display screen 23, an input / output interface 24, a communication interface 25, a sensor 26, a power supply 27, and a communication bus 28.
[0135] Of course, Figure 6 The structure of the illustrated electronic device does not constitute a limitation on the electronic device in the embodiments of the present application. In practical applications, the electronic device may include more or fewer components than Figure 6 shown, or combine certain components.
[0136] In another exemplary embodiment, a computer storage medium is further provided. When the program instructions are executed by a processor, the steps of the report data query method described in any of the above method embodiments are implemented. Among them, the storage medium may include: various media that can store program codes such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs.
[0137] Optionally, specific examples in this embodiment may refer to the examples described in the above embodiments, and will not be elaborated herein.
[0138] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, as used herein, the singular forms "a", "an", and "the" may also include the plural forms. The terms "comprising", "including", "containing", and "having" are inclusive and thus specify the presence of the stated features, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring them to be executed in the particular order described or illustrated, unless the execution order is explicitly stated. It should also be understood that alternative or additional steps may be used.
[0139] The above description is only the specific implementation manners of the present invention, enabling those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can 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 these embodiments shown herein, but rather to the broadest scope consistent with the principles and novel features claimed herein.< / queryrequest> < / queryrequest>
Claims
1. A report data query method, characterized in that: include: Get the target configuration file; The target configuration file includes at least one query statement and a statement annotation corresponding to each query statement; The statement annotation includes query parameters; Parsing the query statements and statement comments in the target configuration file into a first data structure; Utilize each query statement in the first data structure and the query parameters corresponding to each query statement to obtain the query result of the report data; wherein each query statement obtains the query result from at least one data source through at least one data source identifier in the query parameters.
2. The report data query method according to claim 1, characterized in that: The step of obtaining the target configuration file includes: Get the initial configuration file; Each query statement in the initial configuration file is formatted to obtain a target configuration file.
3. The report data query method according to claim 1, characterized in that: After obtaining the query result of the report data, the method further includes: Determine the target report template; Using the query result to modify the value of each variable in the target report template to obtain a report filling result; The report is rendered according to the report filling result to generate a target report.
4. The report data query method according to claim 3, characterized in that: Using the query result to modify the value of each variable in the target report template includes: Encapsulating the query result into a second data structure; According to the query result in the second data structure, the value of each variable in the target report template is modified.
5. The report data query method according to any one of claims 1 to 4, characterized in that: The step of parsing the query statements and statement comments in the target configuration file into a first data structure includes: Read the query statements and statement comments in the target configuration file; Parse query parameters in each statement annotation; Each query statement and the corresponding query parameters are encapsulated into a first data structure.
6. The report data query method according to claim 5, characterized in that: The step of encapsulating each query statement and the corresponding query parameters into a first data structure includes: Encapsulate each query statement and corresponding query parameters into a query request object; A query request object list is generated according to each query request object.
7. The report data query method according to claim 5, characterized in that: The query parameters in each statement annotation are parsed, including: Parse the data source identifier, query result identifier, and custom query control identifier in each statement comment.
8. A report data query device, characterized in that: include: The acquisition module is used to obtain the target configuration file; The target configuration file includes at least one query statement and a statement annotation corresponding to each query statement; The statement annotation includes query parameters; A parsing module, used for parsing the query statements and statement comments in the target configuration file into a first data structure; The query module is used to obtain query results of report data using each query statement in the first data structure and query parameters corresponding to each query statement; wherein each query statement obtains query results from at least one data source through at least one data source identifier in the query parameters.
9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the steps of the report data query method described in any one of claims 1 to 7 of the present application through the computer program.
10. A computer storage medium, characterized in that: The computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the steps of the report data query method described in any one of claims 1 to 7 of the present application.