A method, apparatus and electronic device for generating a dynamic report
By receiving and configuring report requirements on the backend server, and creating extended query classes and methods, the problem of low report development efficiency in existing technologies is solved, enabling the rapid generation and flexible adjustment of dynamic reports, thus improving development efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 北京自如信息科技有限公司
- Filing Date
- 2022-08-11
- Publication Date
- 2026-04-21
AI Technical Summary
Existing technologies, when faced with different users' reporting needs, especially when the needs are mostly the same but have minor differences, require configuration from start to finish for each user, resulting in low development efficiency.
By receiving report requests from the backend server, configuring basic information and query logic for common requests, and creating extended query classes and methods for special requests, and adding them to the report information configuration table, the frontend generates dynamic report pages based on this table and uses Java reflection technology to call the extended query classes and methods to perform special queries.
It enables rapid configuration for common needs and flexible adjustment for special needs, significantly improving report development efficiency and reducing repetitive configuration work.
Smart Images

Figure CN115269607B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing, and more specifically to a method, apparatus, and electronic device for generating dynamic reports. Background Technology
[0002] As businesses increase their business items, the demand for customized reports grows. Whenever a report request arises, the front-end and back-end must coordinate. Back-end developers create corresponding SQL queries based on the user's report requirements, run these queries in the database to extract the relevant data, and then send the extracted data back to the front-end developers. The front-end developers then create a display page to render the received data. When multiple users submit different report requests, back-end developers need to develop separate reports for each request, and the report items used in each report may be repeated, resulting in low development efficiency for back-end developers.
[0003] To address this issue, patent document CN105138501B proposes a configurable dynamic report generation method. This method establishes a report configuration table and a report condition table, allowing backend developers to directly input basic information and query conditions for the report to be developed into these tables based on user needs. Frontend developers then use these tables to create a query page. Whenever a user needs report data, they input query parameters on the query page. These parameters, along with information from the report configuration and condition tables, are parsed by the backend server, automatically generating SQL queries and sending them to the database for execution. The database returns the data to the frontend page, and users can simply change the input query parameters to change the displayed data, thus improving the efficiency of backend report development. Building on this, patent document CN109669949A proposes a data model-based dynamic report generation method. This method defines query field schemes, query models, and query reports in multiple configuration tables, allowing the backend server to parse the configured definitions and automatically generate SQL queries. This is equivalent to refining the report configuration table and report condition table in document CN105138501B, providing more configurable information. Different configuration tables are used to configure different categories of information, making the configuration work easier for backend developers.
[0004] While the methods described above can meet multiple data needs simultaneously and significantly improve table development efficiency, there is a scenario where different users have largely the same needs, but each user has different specific query requirements. This results in reports with only minor differences between users. Even with these minor differences, the methods described above still require configuring each user's report from scratch, leading to low development efficiency. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a method, apparatus and electronic device for generating dynamic reports, thereby improving report development efficiency.
[0006] According to a first aspect, embodiments of the present invention provide a method for generating dynamic reports, applied to a backend server. The method includes: receiving a report request and configuring basic information and query logic of the report in a report information configuration table based on general requirements in the report request; creating extended query classes and extended query methods based on special requirements in the report request, and adding the paths and names of the extended query classes and extended query methods to the report information configuration table; sending the report information configuration table to a frontend server, so that the frontend server renders a query page for generating a dynamic report based on the report information configuration table; when the special requirements change, creating new extended query classes and new extended query methods based on the new special requirements, and updating the paths and names in the report information configuration table using the new paths and names of the new extended query classes and new extended query methods.
[0007] Optionally, the report information configuration table includes a definition table, a data source table, a seed library, a list expansion table, and a list condition table. The step of configuring the basic information and query logic of the report in the report information configuration table based on common requirements in the report requirements includes: configuring the basic information of the dynamic report in the definition table based on the common requirements; configuring nested query logic in the data source table based on the common requirements; configuring the basic information of fields in the list expansion table based on the common requirements, where the fields are those included in the dynamic report; saving frequently used information from the basic information of the fields to the seed library; and configuring query conditions in the list condition table based on the common requirements.
[0008] Optionally, the basic information of the dynamic report includes the table name of the dynamic report. The configuration of the basic information of the dynamic report in the definition table based on the general requirements includes: configuring the basic table name and dynamic parameters in the definition table, and combining the basic table name and dynamic parameters into the table name of the dynamic report.
[0009] Optionally, configuring nested query logic in the data source table based on the general requirements includes: splitting the nested query operation in the general requirements into multiple independent query operations and setting aliases for each independent query operation; combining the corresponding aliases into expressions according to the calculation relationship between the independent query operations, and associating the corresponding expressions with the corresponding aliases according to the nesting relationship between the independent query operations to obtain the nested query logic.
[0010] Optionally, configuring query conditions in the list condition table based on the general requirements includes: configuring basic query conditions and dynamic parameters in the list condition table, and combining the basic query conditions and dynamic parameters into query conditions for the dynamic report.
[0011] Optionally, the method further includes configuring merge query logic and default values in the data source table, wherein the default values are used to populate fields for data sources with inconsistent data dimensions when the merge query logic is executed.
[0012] Optionally, the method further includes: pre-setting multiple types of encapsulation objects, so that when querying data, the data extracted from the database according to the field type is encapsulated in the corresponding type of encapsulation object and fed back to the front-end server.
[0013] According to a second aspect, embodiments of the present invention provide an apparatus for generating dynamic reports, applied to a backend server. The apparatus includes: a configuration module, configured to receive report requests and configure basic information and query logic of the report in a report information configuration table based on general requirements in the report requests; an extension module, configured to create extended query classes and extended query methods based on special requirements in the report requests, and add the paths and names of the extended query classes and extended query methods to the report information configuration table; a sending module, configured to send the report information configuration table to a frontend server, so that the frontend server renders a query page for generating dynamic reports based on the report information configuration table; and a modification module, configured to create new extended query classes and new extended query methods based on new special requirements when the special requirements change, and update the paths and names in the report information configuration table using the new paths and names of the new extended query classes and new extended query methods.
[0014] According to a third aspect, embodiments of the present invention provide an electronic device, including: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the method described in the first aspect, or any optional embodiment of the first aspect.
[0015] According to a fourth aspect, embodiments of the present invention provide a computer-readable storage medium storing computer instructions for causing the computer to perform the method described in the first aspect, or any alternative embodiment of the first aspect.
[0016] The technical solution provided in this application has the following advantages:
[0017] The technical solution provided in this application receives report requests through a backend server. These requests include both general and special requirements. The basic information and query logic configured in the report information configuration table are based on commonly used general requirements. When users do not perform special queries, the backend server parses and generates SQL query statements based on the user's input query parameters and report information configuration, then sends the SQL statements to the database for data extraction, thus satisfying the common data query needs of most users. For special requirements proposed by individual users, such as personalized query conditions, separate extended query classes and methods are created, and their paths and names are added to the report information configuration table as extended interfaces. After the frontend renders and generates the query page of the dynamic report based on the report information configuration table, when a user inputs special query parameters to execute a special query, the extended query class and method in the specified path and name are called via Java reflection, thereby running the corresponding SQL query statement to extract the relevant data from the database, achieving decoupling from the general requirement configuration in the report information configuration table. If a user's only change is a specific requirement, or if other users have new specific requirements but their general requirements remain the same as the current user's, it is only necessary to create a new extended query class and a new extended query method based on the new specific requirements, and update the path and name in the report information configuration table using the new path and name of the new extended query class and the new extended query method. This achieves minimal development, and other configuration information in the report information configuration table does not need to be changed, significantly improving report development efficiency. Attached Figure Description
[0018] The features and advantages of the invention will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the invention in any way. In the drawings:
[0019] Figure 1 The diagram illustrates the steps of a method for generating dynamic reports according to one embodiment of the present invention.
[0020] Figure 2 A schematic diagram of a dynamic report query execution process is shown in one embodiment of the present invention;
[0021] Figure 3A schematic diagram of the structure of an apparatus for generating dynamic reports according to one embodiment of the present invention is shown;
[0022] Figure 4 A schematic diagram illustrating the steps of an electronic device according to one embodiment of the present invention is shown. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0024] Please see Figure 1 In one implementation, a method for generating dynamic reports, applied to a backend server, specifically includes the following steps:
[0025] Step S101: Receive report requirements and configure the basic information and query logic of the report in the report information configuration table based on the general requirements in the report requirements.
[0026] Step S102: Create extended query classes and extended query methods based on the special requirements in the report requirements, and add the paths and names of the extended query classes and extended query methods to the report information configuration table.
[0027] Step S103: Send the report information configuration table to the front-end server so that the front-end server can render and generate a query page for dynamic reports based on the report information configuration table.
[0028] Step S104: When special requirements change, create new extended query classes and new extended query methods based on the new special requirements, and update the path and name in the report information configuration table using the new path and new name of the new extended query classes and new extended query methods.
[0029] Specifically, this embodiment of the invention addresses scenarios where different users have different specific needs. It develops extended query classes and methods tailored to each user's specific requirements, enabling customization of query conditions. Once the extended query classes and methods are developed, the path to the extended query class and the name of the specified extended query method under that path are obtained and added to the report information configuration table. This allows the front-end server to render the query page based on the report information configuration table, thus fulfilling the customization requirements for query conditions. The extended query classes and methods are decoupled from other basic report information and query conditions configured in the report information configuration table. When a user selects a special query dropdown or enters special query parameters, a Java object is generated using Java reflection technology, and the specific logic is implemented through a specified method of a specified class. For ordinary user requests, the system automatically generates SQL query statements based on the user's input query parameters and the information configured in the report information configuration table. These SQL query statements are then sent to the database to extract data, and the backend then feeds the extracted data back to the front-end for display. If a user's only change is a specific requirement, or if other users have new specific requirements but their general requirements remain the same as the current user's, it is only necessary to create a new extended query class and a new extended query method based on the new specific requirements, and update the path and name in the report information configuration table using the new path and name of the new extended query class and the new extended query method. This achieves minimal development, and other configuration information in the report information configuration table does not need to be changed, significantly improving report development efficiency.
[0030] Specifically, in one embodiment, the report information configuration table includes a definition table, a data source table, a seed library, a list extension table, and a list condition table. Step S101 specifically includes the following steps:
[0031] Step 1: Configure the basic information of the dynamic report in the definition table based on common requirements.
[0032] Step 2: Configure nested query logic in the data source table based on common requirements.
[0033] Step 3: Configure basic information for fields in the list extension table based on common requirements. These fields are those included in the dynamic report.
[0034] Step 4: Save the commonly used information from the basic information of the fields to the seed library.
[0035] Step 5: Configure query conditions in the list condition table based on common needs.
[0036] Specifically, this embodiment of the invention uses five configuration tables to configure the basic information and query logic of dynamic reports. This allows the backend server to establish a mapping relationship with various SQL query statements based on the configuration, and parse the corresponding SQL query statement based on the query parameters input by the user. The definition table is used to configure the basic information of the dynamic report, including but not limited to the encoding of the report title, the name of the report title, and whether the report is valid. Its main function is for the frontend to inform the backend which table to query based on the definition table, so that the backend can generate a report with a specified name and format after querying the data. In one embodiment, the definition table is also used to configure whether to perform paginated queries. If pagination is required, it instructs the addition of the "limit value, value" statement to the last executed SQL query statement, for example: Limit 100, 1000 indicates that 1000 result sets are retrieved starting from index 100 for pagination.
[0037] The data source table is used to configure nested query logic. For example, if a user requests the year-on-year growth rate of revenue for a certain year, it is necessary to first extract two types of data sources, then perform the ratio calculation, and finally extract the data from the calculation result. The query operations involved in this process are described in the data source table to facilitate the later parsing of the corresponding SQL query statements. Basic information about the fields is configured in the list extension table, including at least the field's alias code, field alias name, field meaning, formula, formula description, the name of the value table used for retrieval in the database, default value, query order, whether to sum fields, whether to statistically analyze fields, and whether to display the final result. For example, a field 'a' may mean 'model' in report A and 'type' in report B, but both its values originate from the database's project table (p_project). Here, 'model' and 'type' are alias codes; 'pattern' and 'type' are alias names; and 'p_project' is the value table name.
[0038] Furthermore, since many field definitions in the list expansion table remain largely unchanged and can be reused, a seed library is also included in this embodiment. Similar to the list expansion table, the seed library stores frequently used information from the list expansion table and adds it to the cache when the user executes a query. Because the query often involves many fields, rebuilding the query display list for each query would reduce query efficiency. Since the data in the query display list does not change frequently, such as the table header information, this embodiment caches this information during the first query. Subsequent queries retrieve this information directly from the cache and construct a new SQL statement, improving the efficiency of each query.
[0039] The list of conditions is used to configure the query conditions required by the user. It includes the statement type and statement content. The statement type can be a "where" statement (filtering by condition), a "group by" statement (summarizing by field), or an "order by" statement (sorting by field). For example, based on the user's needs, some query statements are configured: wherecity=Beijing -- filter data with the city of Beijing; group by a -- summarize by field a; order by a -- sort by field a in ascending order.
[0040] The five tables above define the basic semantics of queries in detail, and most common query logic can be implemented. After configuring the relevant functions in these five tables according to user requirements, the front-end developers create the query page based on these tables. Users can enter their query parameters on the query page, and the back-end then extracts the corresponding basic information and query logic from the five tables in sequence based on the user's input parameters. This allows the back-end to identify the user's query purpose and automatically parse the corresponding SQL query statement, which is then sent to the database for execution.
[0041] Specifically, in one embodiment, step one above includes the following steps:
[0042] Step 6: Configure the base table name and dynamic parameters in the definition table, and combine the base table name and dynamic parameters into the table name of the dynamic report.
[0043] Specifically, this embodiment supports table name fields containing variables. In many cases, users need table names that are nested within tables. For example, multiple tables might be created based on months, and the table names need to change as the month entered in the query changes, as shown in the example below: dw_xxx_xxx_xxx_202201……dw_xxx_xxx_xxx_202206. This embodiment uses a base table name and dynamic parameters to implement the changing table name, for example: dw_xxx_xxx_xxx_{caliber}_{period}, where dw_xxx_xxx_xxx represents the base table name, and {caliber} and {period} are dynamic parameters representing the accounting interval and report type, respectively. When the user enters query parameters, the generated display list will replace the dynamic parameters in the table name with the user's input query parameters.
[0044] Similarly, in one embodiment, when the table name involves full data or a partitioned table, the query conditions need to support queries with variables. This embodiment configures basic query conditions and dynamic parameters in the list of conditions table, and combines the basic query conditions and dynamic parameters into the query conditions for the dynamic report. For example, if the WHERE condition is "period='{period}'", during actual program execution, the user-input query parameters will replace the dynamic parameters to generate complete query conditions, thereby parsing a complete SQL query statement.
[0045] Specifically, in one embodiment, step two above includes the following steps:
[0046] Step 7: Break down nested query operations in common requirements into multiple independent query operations, and set aliases for each independent query operation.
[0047] Step 8: Combine the corresponding aliases into expressions according to the calculation relationships between independent query operations, and associate the corresponding expressions with the corresponding aliases according to the nesting relationships between the independent query operations to obtain the nested query logic.
[0048] Specifically, this embodiment implements a configuration method for nested query logic. First, nested query operations in typical user needs are broken down into independent query operations, and an alias is assigned to each independent query operation to represent its overall query logic and flow. Finally, expressions are combined according to the nesting relationships between the independent query operations, and associations are created based on the nesting relationships between the aliases. This allows the backend server to directly parse the user's required query logic through these associations, and, in conjunction with information from the list expansion table and list condition table, generate an SQL query statement.
[0049] For example, a user's query operation is to find the year-on-year growth of certain data. Suppose they need to query data source 1 and data source 2, then query data source 3 from data source 1, calculate the ratio of data source 3 to data source 2, and then query data source 4 from the ratio. For the above operations, aliases should be set for each independent query-related operation:
[0050] Query data source 1 (A1), query data source 2 (A2);
[0051] Query data source 3 (AA1) from data source 1;
[0052] Retrieve data source 4 (AAA1) from the ratio.
[0053] Then create the relationship table:
[0054] Table 1. Nested Query Relationship Table
[0055] Alias code A1 A2 AA1 {A1} AAA1 {AA1} / {A2}
[0056] The backend server parses the logic in the table from top to bottom in sequence, and automatically generates SQL query statements by combining it with the basic information in the other four sub-tables.
[0057] Specifically, in one embodiment, the method for generating dynamic reports provided by the present invention further includes the following steps:
[0058] Step 9: Configure the merge query logic and default values in the data source table. The default values are used to populate fields for data sources with inconsistent data dimensions when executing the merge query logic.
[0059] Specifically, in this embodiment, the report information configuration table also supports the configuration of merge queries, specifically implemented in the data source table, supporting "UNION ALL" or "UNION" statements. When querying reports, merge queries are frequently encountered. Pre-configuring merge query statements in the data source table enables dynamic reports to have merge query functionality. In the above implementation, if the fields of the two data sources are inconsistent or not uniform—for example, data source A1 has n columns while A2 has m columns—making UNION and UNION ALL impossible, then the data sources are populated with pre-set default values to resolve the uneven number of fields and ensure consistency between the list items on both sides.
[0060] In addition, this embodiment also supports configuring join queries in the data source table, specifically involving the "LEFT JOIN", "RIGHT JOIN" and "INNER JOIN" statements.
[0061] Specifically, in one embodiment, the method for generating dynamic reports provided by the present invention further includes the following steps:
[0062] Step 10: Pre-set multiple types of encapsulated objects so that when querying data, the data extracted from the database will be encapsulated in the corresponding encapsulated object according to the field type and fed back to the front-end server.
[0063] Suppose backend developers create two sets of reports based on the needs of two different users. Report A, after retrieving data from the database, needs to send parameters aa and bb to the frontend. Report B needs to send parameters cc and dd to the frontend. Existing backend technologies require the backend server to create two separate objects, such as Java objects param1(aa, bb) and param2(cc, dd), to receive the parameter values. This results in inconsistent returns, leading to the creation of many different Java objects for each report, reducing development efficiency. In this embodiment, multiple types of encapsulated objects are pre-defined. During data querying, data retrieved from the database is encapsulated in corresponding encapsulated objects based on field types. This ensures that the parameter passing objects are identical across all reports, eliminating the need to create new objects each time and significantly improving the development efficiency of dynamic reports. For example, if the data retrieved from the database is divided into two categories: titles and actual data, all fields belonging to the title are encapsulated in a title object, and all data outside the title is encapsulated in an actual data object. Regardless of the report, both objects are sent to the frontend for data extraction and list rendering.
[0064] Assumption:
[0065] Report A returns:
[0066] Title [{code:"a",name:"City"},
[0067] {code:"b",name:"amount}]
[0068] Actual data [{a:"Beijing",b:"2.00"}]
[0069] Report B returned:
[0070] Title [{code:"c",name:"Country"},
[0071] {code:"d",name:"Area}]
[0072] Actual data [{c:"China",d:"9.6 million"}]
[0073] Although Report A and Report B return different parameters, they both return the same title object and actual data object.
[0074] Specifically, in one embodiment, such as Figure 2As shown, after the configuration of the above five configuration tables is completed, the front-end sets up the query page. The user enters query parameters on the query page, and the back-end begins parsing the query parameters and report information configuration tables. The front-end informs the back-end which report is being queried by defining tables, and the query process begins. After the process starts, the back-end verifies the validity of the query parameters entered by the user on the query page, and then checks if the cache exists. If the cache exists, it directly retrieves commonly used fields such as table headers from the cache. If it does not exist, it obtains the basic information of the list from the list extension table and stores commonly used information in the seed database, causing the seed database to load commonly used information into the cache. Some commonly used data is also loaded from the database into the cache. Then, the query logic is extracted from the data source table and the list condition table to generate a complete SQL query statement. Next, based on the nested query logic in the data source table, it determines whether there is an outer query. If there is an outer query, it returns to the step of verifying the query parameters, executes the outer query from the beginning, and generates the SQL query statement for the outer query. After all the SQL query statements for each level are generated, it is determined whether pagination is needed based on the defined tables. If pagination is needed, the SQL query statements for each level are assembled into a complete SQL query statement that supports pagination. If pagination is not needed, the SQL query statements for each level are directly assembled into a complete SQL query statement. Finally, the complete SQL query statement is sent to the database for execution, and the database returns data. The data is then returned to the front end, thus completing one dynamic report query process.
[0075] Through the above steps, the technical solution provided in this application receives report requests from a backend server. These requests include both general and special requirements. The basic information and query logic configured in the report information configuration table are based on commonly used general requirements. When users do not perform special queries, the backend server parses and generates SQL query statements based on the user's input query parameters and report information configuration, then sends the SQL statements to the database for data extraction, thus satisfying the common data query needs of most users. For special requirements proposed by individual users, such as personalized query conditions, separate extended query classes and methods are created, and their paths and names are added to the report information configuration table as extended interfaces. After the frontend renders and generates the query page of the dynamic report based on the report information configuration table, when a user inputs special query parameters to execute a special query, the extended query class and method in the path and name are called through Java reflection, thereby running the corresponding SQL query statement to extract the corresponding data from the database, achieving decoupling from the general requirement configuration in the report information configuration table. If a user's only change is a specific requirement, or if other users have new specific requirements but their general requirements remain the same as the current user's, it is only necessary to create a new extended query class and a new extended query method based on the new specific requirements, and update the path and name in the report information configuration table using the new path and name of the new extended query class and the new extended query method. This achieves minimal development, and other configuration information in the report information configuration table does not need to be changed, significantly improving report development efficiency.
[0076] like Figure 3 As shown, this embodiment also provides an apparatus for generating dynamic reports, applied to a backend server. The apparatus includes:
[0077] The configuration module 101 is used to receive report requests and configure the basic information and query logic of the report in the report information configuration table based on the common requirements in the report requests. For details, please refer to the relevant description of step S101 in the above method embodiment, which will not be repeated here.
[0078] Extension module 102 is used to create extended query classes and extended query methods based on specific requirements in the report requirements, and to add the paths and names of the extended query classes and extended query methods to the report information configuration table. For details, please refer to the relevant description of step S102 in the above method embodiment, which will not be repeated here.
[0079] The sending module 103 is used to send the report information configuration table to the front-end server, so that the front-end server can render and generate a query page for dynamic reports based on the report information configuration table. For details, please refer to the relevant description of step S103 in the above method embodiment, which will not be repeated here.
[0080] The modification module 104 is used to create new extended query classes and methods based on the new specific requirements when those requirements change, and to update the paths and names in the report information configuration table using the new paths and names of the new extended query classes and methods. For details, please refer to the relevant description of step S104 in the above method embodiment, which will not be repeated here.
[0081] The apparatus for generating dynamic reports provided in this embodiment of the invention is used to execute the method for generating dynamic reports provided in the above embodiment. Its implementation and principle are the same. For details, please refer to the relevant descriptions of the above method embodiments, which will not be repeated here.
[0082] Through the collaborative efforts of the aforementioned components, the technical solution provided in this application receives report requests via a backend server. These requests include both general and specific requirements. The basic information and query logic configured in the report information configuration table are based on commonly used general requirements. When users do not perform specific queries, the backend server parses and generates SQL query statements based on the user-input query parameters and report information configuration, then sends the SQL statements to the database for data extraction, thereby satisfying the common data query needs of most users. For specific user requests, such as personalized query conditions, separate extended query classes and methods are created, and their paths and names are added to the report information configuration table as extended interfaces. After the frontend renders and generates the dynamic report query page based on the report information configuration table, when a user inputs specific query parameters to execute a specific query, the extended query classes and methods in the specified paths and names are invoked via Java reflection to run the corresponding SQL query statements and extract the relevant data from the database, thus decoupling them from the general requirement configuration in the report information configuration table. If a user's only change is a specific requirement, or if other users have new specific requirements but their general requirements remain the same as the current user's, it is only necessary to create a new extended query class and a new extended query method based on the new specific requirements, and update the path and name in the report information configuration table using the new path and name of the new extended query class and the new extended query method. This achieves minimal development, and other configuration information in the report information configuration table does not need to be changed, significantly improving report development efficiency.
[0083] Figure 4 An electronic device according to an embodiment of the present invention is shown. The device includes a processor 901 and a memory 902, which can be connected via a bus or other means. Figure 4 Taking the example of a connection between China and Israel via a bus.
[0084] Processor 901 can be a Central Processing Unit (CPU). Processor 901 can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations of the above types of chips.
[0085] The memory 902, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the methods in the above method embodiments. The processor 901 executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions, and modules stored in the memory 902, thereby implementing the methods in the above method embodiments.
[0086] The memory 902 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created by the processor 901, etc. Furthermore, the memory 902 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 902 may optionally include memory remotely located relative to the processor 901, and these remote memories may be connected to the processor 901 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0087] One or more modules are stored in memory 902 and, when executed by processor 901, perform the methods described in the above method embodiments.
[0088] The specific details of the aforementioned electronic device can be understood by referring to the relevant descriptions and effects in the above method embodiments, and will not be repeated here.
[0089] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The implemented program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium can also include combinations of the above types of memory.
[0090] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A method for generating dynamic reports, characterized in that, Applied to a backend server, the method includes: Receive report requests and configure the basic information and query logic of the report in the report information configuration table based on the general requirements in the report requests; Based on the specific requirements in the report requirements, create extended query classes and extended query methods, and add the paths and names of the extended query classes and extended query methods to the report information configuration table; The report information configuration table is sent to the front-end server so that the front-end server can render and generate a query page for dynamic reports based on the report information configuration table. When the special requirements change, a new extended query class and a new extended query method are created based on the new special requirements, and the path and name in the report information configuration table are updated using the new path and new name of the new extended query class and the new extended query method. The report information configuration table includes a definition table, a data source table, a seed library, a list expansion table, and a list condition table. The configuration of basic report information and query logic in the report information configuration table based on common requirements in the report requirements includes: Configure the basic information of the dynamic report in the definition table based on the aforementioned common requirements; Configure nested query logic in the data source table based on the aforementioned common requirements; Based on the aforementioned common requirements, the basic information of the fields are configured in the list extension table. These fields are those included in the dynamic report. Save commonly used information from the basic information of the field to the seed library; Configure query conditions in the list condition table based on the aforementioned common requirements; The configuration of nested query logic in the data source table based on the aforementioned common requirements includes: The nested query operations in the aforementioned common requirements are broken down into multiple independent query operations, and aliases are set for each independent query operation; The corresponding aliases are combined into expressions according to the calculation relationship between independent query operations, and the corresponding expressions and corresponding aliases are associated according to the nesting relationship between each independent query operation to obtain the nested query logic.
2. The method according to claim 1, characterized in that, The basic information of the dynamic report includes the table name of the dynamic report. The configuration of the basic information of the dynamic report in the definition table based on the common requirements includes: Configure the base table name and dynamic parameters in the definition table, and combine the base table name and dynamic parameters into the table name of the dynamic report.
3. The method according to claim 1, characterized in that, The configuration of query conditions in the list condition table based on the aforementioned common requirements includes: Configure basic query conditions and dynamic parameters in the list condition table, and combine the basic query conditions and dynamic parameters into query conditions for the dynamic report.
4. The method according to claim 1, characterized in that, The method further includes: Configure merge query logic and default values in the data source table. The default values are used to populate fields for data sources with inconsistent data dimensions when the merge query logic is executed.
5. The method according to claim 1, characterized in that, The method further includes: Multiple types of encapsulation objects are preset so that when data is queried, the data extracted from the database is encapsulated in the corresponding encapsulation object according to the field type and fed back to the front-end server.
6. An apparatus for generating dynamic reports, characterized in that, The device, applied to a backend server, includes: The configuration module is used to receive report requests and configure the basic information and query logic of the report in the report information configuration table based on the common requirements in the report requests. The report information configuration table includes a definition table, a data source table, a seed library, a list expansion table, and a list condition table. The configuration of basic report information and query logic in the report information configuration table based on common requirements in the report requirements includes: Configure the basic information of the dynamic report in the definition table based on the aforementioned common requirements; Configure nested query logic in the data source table based on the aforementioned common requirements; Based on the aforementioned common requirements, the basic information of the fields are configured in the list extension table. These fields are those included in the dynamic report. Save commonly used information from the basic information of the field to the seed library; Configure query conditions in the list condition table based on the aforementioned common requirements; The configuration of nested query logic in the data source table based on the aforementioned common requirements includes: The nested query operations in the aforementioned common requirements are broken down into multiple independent query operations, and aliases are set for each independent query operation; The corresponding aliases are combined into expressions according to the calculation relationship between independent query operations, and the corresponding expressions and corresponding aliases are associated according to the nesting relationship between each independent query operation to obtain the nested query logic; The extension module is used to create extended query classes and extended query methods based on the special requirements in the report requirements, and to add the path and name of the extended query classes and extended query methods to the report information configuration table; The sending module is used to send the report information configuration table to the front-end server, so that the front-end server can render and generate a query page of dynamic reports based on the report information configuration table; The modification module is used to create new extended query classes and new extended query methods based on the new special requirements when the special requirements change, and to update the path and name in the report information configuration table using the new path and name of the new extended query classes and new extended query methods.
7. An electronic device, characterized in that, include: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, the processor executing the computer instructions to perform the method as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the method as described in any one of claims 1-5.
Citation Information
Patent Citations
A configurable dynamic report generation method and system
CN105138501B
A dynamic report generation method and system based on a data model
CN109669949A
Configurable dynamic report generating method and system
CN105138501A
Custom report generation method and device, equipment and storage medium
CN114528299A