Script-based report dynamic generation method and device, equipment and storage medium
Through the dynamic generation method of script -based reporting, the problem of insufficient flexibility, lack of real -time, and data repeated storage of existing report systems have been solved, and efficient, flexible and real -time report generation is realized.
Patent Information
- Application Number
- CN202411465191.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-01-24
AI Technical Summary
The existing reporting system has problems such as insufficient flexibility, insufficient real-time and repeated data storage when generating reports, resulting in inefficient report generation.
Adopt a script -based reporting dynamic generation method, by receiving the report query request, determine the structure and target data of the report page, compile the target query script, perform data query and extract, adjust the data structure generating report, and send it to the front -end display.
It improves the flexibility and efficiency of report generation, avoids repeated data storage, ensures data accuracy and consistency, and achieves real-time data reflection.
Smart Images

Figure CN119357189A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a script-based dynamic report generation method, device, equipment and storage medium. Background Art
[0002] Reporting systems are widely used for data display and analysis, providing strong data support for corporate decision-making. Although there are many mature reporting systems on the market that support customization of specified data sources and page display content, they still have some shortcomings:
[0003] 1. Display content depends on underlying data: Current reporting systems usually require that when adding a new report, the corresponding table structure be defined based on the page display content. The BI system then synchronizes the required data to these tables. However, even for similar report pages, different table structures need to be defined, which lacks sufficient flexibility.
[0004] 2. Lack of real-time performance: The underlying data is usually synchronized through the scheduled tasks of the BI system. This method will cause delays in data synchronization and therefore cannot reflect the modified results of the report content in real time.
[0005] 3. Duplicate data storage: Different report pages often contain the same data. The traditional method requires storing this data in different tables, resulting in additional storage space consumption.
[0006] The deficiencies of the existing reporting system result in a large amount of duplicate business data taking up unnecessary storage space, making report generation inefficient.
[0007] Therefore, how to improve the efficiency of report generation has become a technical problem that needs to be solved urgently. Summary of the invention
[0008] The present application provides a script-based dynamic report generation method, device, equipment and medium, aiming to improve report generation efficiency.
[0009] In a first aspect, the present application provides a script-based dynamic report generation method, the script-based dynamic report generation method comprising the following steps:
[0010] When receiving a report query request, determining a report page structure and at least one type of target data based on the report query request;
[0011] Compiling a target query script based on the data query information of each of the target data;
[0012] Based on the target query script, perform data query and data extraction in at least one first business data table in the first database to obtain each of the target data;
[0013] Based on the report page structure, the data structure of each target data is adjusted to generate a target data report, and the target data report is sent to the front-end page for display.
[0014] In a second aspect, the present application further provides a script-based dynamic report generation device, the script-based dynamic report generation device comprising:
[0015] A request parsing module, configured to determine, upon receiving a report query request, a report page structure and at least one type of target data based on the report query request;
[0016] A script compiling module, used for compiling a target query script based on the data query information of each target data;
[0017] A data query module, used to perform data query and data extraction in at least one first business data table in the first database based on the target query script to obtain each target data;
[0018] The report generation module is used to adjust the data structure of each target data based on the report page structure, generate a target data report, and send the target data report to the front-end page for display.
[0019] In a third aspect, the present application also provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the script-based dynamic report generation method as described above are implemented.
[0020] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the script-based dynamic report generation method as described above are implemented.
[0021] The present application provides a method, device, computer equipment and storage medium for dynamically generating reports based on scripts. The method of the present application includes determining the report page structure and at least one type of target data based on the report query request when receiving a report query request; compiling a target query script based on the data query information of each target data; performing data query and data extraction on at least one first business data table in a first database based on the target query script to obtain each target data; adjusting the data structure of each target data based on the report page structure, generating a target data report, and sending the target data report to a front-end page for display. In the above manner, the present application compiles a target query script through data query information, reduces the need for manual intervention, and ensures the accuracy and consistency of data. By storing business data in the first database and managing the stored business data through the first business data table, data duplication storage can be avoided and data redundancy can be reduced. By querying and extracting the target data for constructing a target data report from the first business data table of the first database through the target query script, the accuracy and query efficiency of data query can be improved, and the data structure adjustment can be made more flexible and convenient, avoiding direct operation of the underlying business data, reducing data redundancy, and improving the generation efficiency of the target data report. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0023] Figure 1 A flowchart of a first embodiment of a script-based dynamic report generation method provided by the present application;
[0024] Figure 2 A schematic diagram of a laughter detection process provided in an embodiment of the present application;
[0025] Figure 3 A flowchart of a second embodiment of a script-based dynamic report generation method provided by the present application;
[0026] Figure 4 It is a structural schematic diagram of a first embodiment of a script-based dynamic report generation device provided by the present application;
[0027] Figure 5 It is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application.
[0028] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0029] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0030] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0031] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0032] Please refer to Figure 1 , Figure 1 A flowchart of a first embodiment of a script-based dynamic report generation method provided in the present application.
[0033] like Figure 1 As shown, the script-based dynamic report generation method includes steps S101 to S104.
[0034] S101. When a report query request is received, determine a report page structure and at least one type of target data based on the report query request;
[0035] In one embodiment, when a user needs to query report data or generate a report, the user can initiate a report query request to the server through the user terminal. The user can create query conditions through the user terminal and define query conditions according to report requirements, such as time range, data classification, geographic location, etc. Report requirements can also be defined, such as report purpose and audience, data types and indicators to be displayed, etc. The user terminal generates a corresponding report query request based on the report query conditions defined by the user and sends it to the server.
[0036] In one embodiment, when the server receives a report query request initiated by the client, it analyzes the request to determine information such as query conditions, report format, data range, data type, etc.
[0037] The report page structure may include information such as title, table header, data row, paging, icon, etc. The target data may include information such as data range, data type, and time range of data collection.
[0038] In one embodiment, first table information of each first business data table in the first database is obtained; and a data query table is generated based on the first table information.
[0039] The first table information includes the table number of each of the first business data tables, the name and data type of the data contained in each of the first business data tables, and the data report type applicable to each of the first business data tables.
[0040] In one embodiment, a connection with the first database can be established using a suitable database client or a programming language (such as Python, Java, etc.), and an SQL query statement can be executed to obtain the first table information of each data table in the database. The table number (table name), data name (column name), data type (column data type) and applicable data report type of each data table are extracted from the first table information.
[0041] In one embodiment, a new data query table is created based on the extracted first table information, which may be a new database table or a temporary table, for storing the extracted information. The extracted table information is filled into the newly created data query table, and the data query table is indexed, the query statement is optimized, and other operations are performed to improve the efficiency of data retrieval.
[0042] S102, compiling a target query script based on the data query information of each target data;
[0043] In one embodiment, the query script may vary according to the location of data storage, data type and business requirements. According to actual data query requirements, such as the type of data storage, examples of target data and business logic, target query scripts for different target data can be compiled.
[0044] In one embodiment, the target query script can be compiled according to the data query information each time the target data is queried. The target query script generated by each compilation can also be saved, and script information of each target query script can be created, such as the query data type, query result, query logic, etc., and then the target query script can be directly called for use or modification when the same request is received next time.
[0045] Furthermore, based on the data query information, the data type and data storage address of each target data are determined; based on the data type and the data storage address, at least one target query script is compiled.
[0046] In one embodiment, the table number, data name, data type and data storage address corresponding to each target data are obtained, and the data type of the table column corresponding to each target data is analyzed, such as integer, floating point number, string, date, etc. The physical storage location of each target data is determined, including the table name in the first database, the file path or the resource identifier of other storage systems.
[0047] In one embodiment, SQL statements, file reading scripts, or API calling codes may be written according to the data type and data storage address, query logic may be written, and the query logic may be compiled into a target query script.
[0048] The target query script may be a set of SQL statements; or a script in Python, Java or other programming languages.
[0049] S103, based on the target query script, perform data query and data extraction in at least one first business data table in the first database to obtain each of the target data;
[0050] In one embodiment, a compiled target query script is executed, and corresponding target data is queried from each first business data table in the first database and extracted through the target query script. The extracted target data is integrated according to the report page structure in the request to generate a corresponding data report.
[0051] Furthermore, based on the target query script, each of the first business data tables in the first database is traversed, and the target data matching the data query information is queried in each of the first business data tables in turn; when any of the target data exists in the current first business data table, the target data is extracted from the current first business data table; when any of the target data is not found, the next target data is queried in the next first business data table, until all the target data are queried and extracted.
[0052] The data query information includes data name, data type, data range and data number.
[0053] In one embodiment, the query logic included in the target query script may include the data name, data type, data range and data number of the target data. A list of all first business data tables is obtained, the business data table list is traversed one by one, and the target query script is executed on each first business data table.
[0054] In one embodiment, a target query script is executed in the current first business data table to query whether there is target data matching the data query information in the current first business data table. If any target data exists in the current first business data table, the data is extracted and recorded. If the target data is not found in the current first business data table, the query is continued in the next first business data table.
[0055] In one embodiment, the query results of each first business data table may be recorded, including successfully extracted target data and unqueried target data. If there is still unqueried target data, continue to traverse the remaining first business data tables until all target data are queried and extracted.
[0056] In another embodiment, based on a data query table, at least one first table information corresponding to each target data is queried; based on the correspondence between the first table information and the target data, at least one first business data table storing each target data is determined; based on a target query script, each target data is matched and extracted from each first business data table storing each target data in turn.
[0057] In one embodiment, the data query table may include a mapping relationship between target data and first business data tables. By accessing the data query table, at least one first table information corresponding to each target data is queried, and multiple first business data tables storing the target data are determined based on the queried first table information.
[0058] In one embodiment, a target query script is constructed for each target data, and the script contains necessary query conditions, such as data name, data type, data range, and data number, etc., and then the target query script is executed to query and extract the corresponding target data from multiple first business data tables that are determined to store the target data.
[0059] S104: Based on the report page structure, adjust the data structure of each target data, generate a target data report, and send the target data report to the front-end page for display.
[0060] In one embodiment, the requirements of the report page structure are analyzed, including layout, style, data fields to be displayed, etc. According to the requirements of the report page structure, the structure of the queried target data is adjusted to ensure that the data format matches the report requirements. A report generation tool or library is used to generate a target data report according to the adjusted data structure.
[0061] In one embodiment, the extracted target data may exist in a variety of different data formats, so the target data may be formatted, such as date format, currency format, numerical precision, etc.
[0062] In one embodiment, the target data report can be rendered into formats such as HTML, PDF, Excel, etc., so as to be displayed on the front-end page. The rendered report is integrated into the front-end page and dynamically loaded using JavaScript or a front-end framework.
[0063] The present embodiment provides a method for dynamically generating reports based on scripts. The present application method compiles a target query script through data query information, reduces the need for manual intervention, and ensures the accuracy and consistency of the data. By storing business data in the first database and managing the stored business data through the first business data table, it is possible to avoid duplicate data storage and reduce data redundancy. By querying and extracting target data for constructing a target data report from the first business data table of the first database through the target query script, the accuracy and efficiency of data query can be improved, and the adjustment of data structure can be made more flexible and convenient, avoiding direct operation of the underlying business data, reducing data redundancy, and improving the generation efficiency of the target data report.
[0064] Please refer to Figure 2 , Figure 2 A flowchart of a second embodiment of a script-based dynamic report generation method provided in the present application.
[0065] In this embodiment, Figure 2 As shown, based on the above Figure 1 In the illustrated embodiment, before S101, the following further includes:
[0066] S201. Collect at least one first business data from at least one business database based on a preset data collection cycle;
[0067] In one embodiment, if Figure 3 As shown, Figure 3 A system for dynamically generating reports based on scripts is provided for this application. The system introduces a script layer between the front-end page and the Doris data layer, aiming to dynamically render page data, improve the real-time performance of report display, and reduce duplicate data storage.
[0068] Among them, Doris is the first database.
[0069] In one embodiment, if Figure 3 The system for dynamically generating reports based on scripts shown consists of three core components: Doris stores basic data, scripts dynamically load page data, and front-end display.
[0070] In one embodiment, the basic data required for the report can be regularly summarized into Doris through the Zeus task. The data in Doris is pre-processed, and the data of multiple business databases are integrated into one table, which improves the efficiency of page query and avoids the impact of report display on the query performance of business database. With the help of the script layer, the data in Doris does not need to be completely consistent with the page, thereby avoiding the repeated storage of basic data and saving additional storage space.
[0071] Among them, Doris is a high-performance, real-time analytical database based on the MPP architecture. It is well-known for its extremely fast and easy-to-use features. It can return query results under massive data in sub-second response time. It can not only support high-concurrency point query scenarios, but also support high-throughput complex analysis scenarios. Based on this, Doris can better meet the use scenarios such as report analysis, ad hoc query, unified data warehouse construction, and data lake federated query acceleration.
[0072] In one embodiment, the first database Doris can periodically extract a variety of first business data from multiple underlying business databases, such as organization information, user information, and sales data, etc. Then, the first database Doris pre-processes and stores the collected first business data.
[0073] In one embodiment, the display module of the report page can support binding Groovy scripts. When the page is loaded, the system compiles and executes these scripts, and the scripts query different Doris tables and combine the data in multiple tables into the structure required by the report page; thereby releasing the binding between the report page and the Doris data, and multiple report pages needing the same data do not need to be stored repeatedly.
[0074] For example, Figure 3 The organization sales report and user sales report in the report both rely on user sales data. The traditional method requires binding the page to two Doris tables respectively, so both tables need to save user sales data. The script can dynamically query and assemble the returned data, so only one copy of the user sales data needs to be saved, saving storage space.
[0075] In one embodiment, due to the existence of the script layer, general report page modifications can be implemented through dynamic scripts without updating the underlying Doris data, thereby greatly improving the real-time performance of data updates (Doris data updates are generally T+1, and modifying the script code can change the return results in real time).
[0076] In one embodiment, the system can provide rich and beautiful front-end pages, and can support displaying different types of charts and detailed data lists according to business needs. With the help of the script layer, the returned data can be adjusted according to the front-end needs, which facilitates the front-end development of more general component modules.
[0077] S202: Based on the first database, perform data preprocessing on each of the first business data to generate at least one first business data table.
[0078] In one embodiment, the first database can be used to perform data preprocessing on the collected various first business data, which can include conventional data cleaning steps such as data cleaning, conversion, integration, and normalization.
[0079] In one embodiment, the first database may further integrate the first business data according to report generation requirements, and combine or associate the data for constructing the report to improve data query efficiency and report generation efficiency.
[0080] Furthermore, based on at least one data report type, at least one of the first business data corresponding to each of the data report types is determined; based on the first database, data integration is performed on at least one of the first business data corresponding to each of the data report types to generate at least one of the first business data tables.
[0081] In one embodiment, the data report type can be determined based on the report generation request submitted by the user end, or it can be summarized by collecting all the report data required by the enterprise or related industry through big data. The report data corresponding to each data report type is different, that is, there are a corresponding number of data report types for the number of data report types. For example, financial reports, sales reports, inventory reports, human resources reports, production reports, etc., their corresponding data report types are all different, and even financial reports can be divided into balance sheets, income statements, cash flow statements, etc.
[0082] In one embodiment, the data type of the first business data required for constructing multiple business reports is determined according to the data structure of the data report type.
[0083] For example, inventory reports include inventory levels, inventory turnover, inventory value, etc. These reports need to collect business data such as commodity quantity and commodity flow from the inventory management business database, and then integrate the above different inventory reports according to needs. Human resource reports such as employee performance appraisal, payroll, human resource planning and other reports need to integrate employee information, performance evaluation, salary data, etc. Financial statements such as balance sheets, income statements, cash flow statements, etc. usually need to integrate transaction data, account balances and budget information from the financial system.
[0084] In one embodiment, the first business data is integrated through the first database, which may include but is not limited to data cleaning, conversion and loading processes to ensure the consistency and accuracy of different business data. A data model, such as an entity-relationship diagram, may be designed to determine the scope of the database, the data organization form and implementation method, and reduce data redundancy and errors.
[0085] In one embodiment, a first business data table can be created based on the data model and business data to define fields, data types and constraints. The data structure of the first business data table can be constructed according to actual needs. For example, it can be created according to report type, business data type, report creation requirements, etc.
[0086] Exemplarily, the first business data table may be created according to the report type, such as integrating data related to the financial report type into the same first business data table, and integrating data related to the sales report type into another first business data table, and so on.
[0087] Exemplarily, the first business data table may also be created according to the type of business data, such as user data is counted in one first business data table, sales data is counted in another first business data table, and so on.
[0088] In one embodiment, after the first business data tables are created, indexes may be created for the data structures and data types of the first business data tables, and data partitions may be performed according to data characteristics and query requirements.
[0089] In this embodiment, the basic data stored in Doris does not need to be consistent with the page, which avoids duplicate storage of data and saves storage space; the addition of the script layer makes the modification of the report page more flexible, without the need to frequently adjust the underlying data structure, and the report content can be updated in real time by dynamically loading and processing data through scripts, avoiding the problem of data synchronization delay.
[0090] See also Figure 4 , Figure 4 It is a structural schematic diagram of a first embodiment of a script-based dynamic report generation device provided by the present application. The script-based dynamic report generation device is used to execute the aforementioned script-based dynamic report generation method.
[0091] like Figure 4 As shown, the script-based dynamic report generation device 300 includes: a request parsing module 301 , a script compiling module 302 , a data query module 303 and a report generation module 304 .
[0092] The request parsing module 301 is used to determine the report page structure and at least one type of target data based on the report query request when receiving the report query request;
[0093] A script compiling module 302, used to compile a target query script based on the data query information of each target data;
[0094] A data query module 303 is used to perform data query and data extraction on at least one first business data table in the first database based on the target query script to obtain the target data;
[0095] The report generation module 304 is used to adjust the data structure of each target data based on the report page structure, generate a target data report, and send the target data report to the front-end page for display.
[0096] In one embodiment, the script compiling module 302 includes:
[0097] An information analysis unit, configured to determine a data type and a data storage address of each of the target data based on the data query information;
[0098] A script compiling unit is used to compile at least one of the target query scripts based on the data type and the data storage address.
[0099] In one embodiment, the script-based report dynamic generation device 300 further includes a business data table construction module, including:
[0100] A business data collection unit, configured to collect at least one first business data from at least one business database based on a preset data collection cycle;
[0101] A business data table generating unit is used to perform data preprocessing on each of the first business data based on the first database to generate at least one first business data table.
[0102] In one embodiment, the business data table generating unit includes:
[0103] A business data determination subunit, configured to determine, based on at least one data report type, at least one of the first business data corresponding to each of the data report types;
[0104] The business data table generating subunit is used to perform data integration on at least one of the first business data corresponding to each of the data report types based on the first database to generate at least one of the first business data tables.
[0105] In one embodiment, the script-based report dynamic generation device 300 further includes a query table construction module, including:
[0106] A table information acquisition unit, used to acquire first table information of each of the first business data tables in the first database;
[0107] A query table generating unit, used for generating a data query table based on the first table information;
[0108] The first table information includes the table number of each of the first business data tables, the name and data type of the data contained in each of the first business data tables, and the data report type applicable to each of the first business data tables.
[0109] In one embodiment, the data query module 303 includes:
[0110] A table information query unit, configured to query at least one of the first table information corresponding to each of the target data based on a data query table;
[0111] A business data table determining unit, configured to determine at least one of the first business data tables storing each of the target data based on a correspondence between the first table information and the target data;
[0112] The target data query unit is used to match and extract each target data from each of the first business data tables storing the target data in sequence based on the target query script.
[0113] In one embodiment, the data query module 303 further includes:
[0114] A first data query unit, configured to traverse each of the first business data tables in the first database based on the target query script, and sequentially query each of the first business data tables for the target data matching the data query information;
[0115] A data extraction unit, configured to extract the target data from the current first business data table when any of the target data exists in the current first business data table;
[0116] A second data query unit, configured to query the next target data in the next first business data table when any target data is not found, until all the target data are found and extracted;
[0117] The data query information includes data name, data type, data range and data number.
[0118] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and each module can refer to the corresponding process in the aforementioned script-based report dynamic generation method embodiment, and will not be repeated here.
[0119] The apparatus provided in the above embodiment may be implemented in the form of a computer program. The computer program may be Figure 5 Runs on the computer device shown.
[0120] See also Figure 5 , Figure 5 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server.
[0121] See also Figure 5 The computer device includes a processor, a memory and a network interface connected through a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0122] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any script-based dynamic report generation method.
[0123] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0124] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any script-based dynamic report generation method.
[0125] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0126] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0127] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0128] When receiving a report query request, determining a report page structure and at least one type of target data based on the report query request;
[0129] Compiling a target query script based on the data query information of each of the target data;
[0130] Based on the target query script, perform data query and data extraction in at least one first business data table in the first database to obtain each of the target data;
[0131] Based on the report page structure, the data structure of each target data is adjusted to generate a target data report, and the target data report is sent to the front-end page for display.
[0132] In one embodiment, when implementing the data query information based on each of the target data and compiling the target query script, the processor is used to implement:
[0133] Based on the data query information, determine the data type and data storage address of each of the target data;
[0134] At least one of the target query scripts is compiled based on the data type and the data storage address.
[0135] In one embodiment, before the processor determines the report page structure and at least one type of target data based on the report query request when receiving the report query request, it is further configured to:
[0136] Based on a preset data collection cycle, collecting at least one first business data from at least one business database;
[0137] Based on the first database, data preprocessing is performed on each of the first business data to generate at least one first business data table.
[0138] In one embodiment, when the processor performs data preprocessing on each of the first business data based on the first database to generate at least one first business data table, it is configured to implement:
[0139] Based on at least one data report type, determining at least one first business data corresponding to each data report type;
[0140] Based on the first database, data integration is performed on at least one of the first business data corresponding to each of the data report types to generate at least one first business data table.
[0141] In one embodiment, before implementing the data query information based on each of the target data and compiling the target query script, the processor is further configured to implement:
[0142] Acquire first table information of each of the first business data tables in the first database;
[0143] Based on the first table information, generate a data query table;
[0144] The first table information includes the table number of each of the first business data tables, the name and data type of the data contained in each of the first business data tables, and the data report type applicable to each of the first business data tables.
[0145] In one embodiment, when the processor performs data query and data extraction based on the target query script in at least one first business data table in the first database to obtain each target data, it is used to implement:
[0146] Based on the data query table, query at least one of the first table information corresponding to each of the target data;
[0147] Based on the correspondence between the first table information and the target data, determining at least one first business data table storing each of the target data;
[0148] Based on the target query script, each target data is matched and extracted in turn from each of the first business data tables storing the target data.
[0149] In one embodiment, when the processor performs data query and data extraction based on the target query script in at least one first business data table in the first database to obtain each target data, it is further configured to implement:
[0150] Based on the target query script, traverse each of the first business data tables in the first database, and sequentially query each of the first business data tables for the target data that matches the data query information;
[0151] When any of the target data exists in the current first business data table, extracting the target data from the current first business data table;
[0152] When any of the target data is not found, searching for the next target data in the next first business data table until all the target data are found and extracted;
[0153] The data query information includes data name, data type, data range and data number.
[0154] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement any script-based dynamic report generation method provided in the embodiment of the present application.
[0155] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.
[0156] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A script-based report dynamic generation method, characterized in that: The method comprises: When receiving a report query request, determining a report page structure and at least one type of target data based on the report query request; Compiling a target query script based on the data query information of each of the target data; Based on the target query script, perform data query and data extraction in at least one first business data table in the first database to obtain each of the target data; Based on the report page structure, the data structure of each target data is adjusted to generate a target data report, and the target data report is sent to the front-end page for display.
2. The script-based dynamic report generation method according to claim 1, characterized in that: The step of compiling a target query script based on the data query information of each target data comprises: Based on the data query information, determine the data type and data storage address of each of the target data; At least one of the target query scripts is compiled based on the data type and the data storage address.
3. The script-based dynamic report generation method according to claim 1, characterized in that: When receiving a report query request, before determining the report page structure and at least one type of target data based on the report query request, the method further includes: Based on a preset data collection cycle, collecting at least one first business data from at least one business database; Based on the first database, data preprocessing is performed on each of the first business data to generate at least one first business data table.
4. The script-based dynamic report generation method according to claim 3, characterized in that: The performing data preprocessing on each of the first business data based on the first database to generate at least one first business data table includes: Based on at least one data report type, determining at least one first business data corresponding to each data report type; Based on the first database, data integration is performed on at least one of the first business data corresponding to each of the data report types to generate at least one first business data table.
5. The script-based dynamic report generation method according to claim 1, characterized in that: Before compiling the target query script based on the data query information of each target data, the method further includes: Acquire first table information of each of the first business data tables in the first database; Based on the first table information, generate a data query table; The first table information includes the table number of each of the first business data tables, the name and data type of the data contained in each of the first business data tables, and the data report type applicable to each of the first business data tables.
6. The script-based dynamic report generation method according to claim 5, characterized in that: The step of performing data query and data extraction on at least one first business data table in the first database based on the target query script to obtain each target data includes: Based on the data query table, query at least one of the first table information corresponding to each of the target data; Based on the correspondence between the first table information and the target data, determining at least one first business data table storing each of the target data; Based on the target query script, each target data is matched and extracted in turn from each of the first business data tables storing the target data.
7. The script-based dynamic report generation method according to claim 1, characterized in that: The step of performing data query and data extraction on at least one first business data table in the first database based on the target query script to obtain each target data further includes: Based on the target query script, traverse each of the first business data tables in the first database, and sequentially query each of the first business data tables for the target data that matches the data query information; When any of the target data exists in the current first business data table, extracting the target data from the current first business data table; When any of the target data is not found, searching for the next target data in the next first business data table until all the target data are found and extracted; The data query information includes data name, data type, data range and data number.
8. A script-based report dynamic generation device, characterized in that: The script-based report dynamic generation device comprises: A request parsing module, configured to determine, upon receiving a report query request, a report page structure and at least one type of target data based on the report query request; A script compiling module, used for compiling a target query script based on the data query information of each target data; A data query module, used to perform data query and data extraction in at least one first business data table in the first database based on the target query script to obtain each target data; The report generation module is used to adjust the data structure of each target data based on the report page structure, generate a target data report, and send the target data report to the front-end page for display.
9. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the script-based dynamic report generation method as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the script-based dynamic report generation method according to any one of claims 1 to 7 are implemented.