Report generation method and system
By inputting the configuration information of the report generation system into the SQL statement template, and automatically generating and executing database query statements, the problem of time and security risks of manually writing SQL statements is solved, and the efficiency of report generation is improved.
Patent Information
- Application Number
- CN202411669155.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-04-18
AI Technical Summary
The existing report design system requires manual writing of SQL statements, which makes processing time-consuming and has the risk of SQL injection security, and it is difficult to achieve unified management and maintenance of query conditions and report pages.
By obtaining the configuration information of the report to be generated, input it into the database language query statement template, and generating database language statements for configuration information does not require manual writing of SQL statements, so as to execute database queries and generate reports.
It shortens the time to obtain database language statements, improves the efficiency of generating reports to be generated, and reduces the security risks of SQL injection.
Smart Images

Figure CN119849458A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technology, and in particular to a report generation method and system. Background Art
[0002] In the related art, the report design system requires manual writing of structured query language (SQL) statements, which not only requires setting placeholders in advance in the SQL statements, but also requires maintaining the query conditions in the report page. When querying data, the variables passed in from the report page are used to replace the placeholders in the SQL statements to obtain the SQL that needs to be executed, thereby achieving data acquisition. However, this method will lead to the problem of time-consuming manual processing. Summary of the invention
[0003] The present disclosure provides a report generation method and system, which can help shorten the time for obtaining the database language statement, thereby improving the efficiency of generating the report to be generated.
[0004] In a first aspect, the present disclosure provides a report generation method, the method comprising: obtaining configuration information corresponding to a report to be generated; determining a position in a database language query statement template corresponding to the configuration information; inputting the configuration information into a corresponding position in the database language query statement template to obtain a database language statement of the configuration information; executing the database language statement to query data associated with the configuration information from a database to generate a report to be generated.
[0005] In some embodiments, the configuration information includes at least one of the following: an identifier of a field; a query attribute of a field; a sorting rule of a field; and a grouping condition of a field.
[0006] In some embodiments, the configuration information is input into a corresponding position in a database language query statement template to obtain a database language statement for the configuration information, including: inputting the identifier of the field into a position corresponding to the identifier in the database language query statement template to generate a select statement; inputting the query attribute of the field into a position corresponding to the query attribute in the database language query statement template to generate a where statement; inputting the sorting rule of the field into a position corresponding to the sorting rule in the database language query statement template to generate an order by statement; inputting the grouping condition of the field into a position corresponding to the grouping condition in the database language query statement template to generate a group by statement; and concatenating the select statement, where statement, order by statement and group by statement to generate a database language statement for the configuration information.
[0007] In some embodiments, obtaining configuration information corresponding to a report to be generated includes: receiving a report generation request in response to a user's touch operation; the report generation request carries an identifier of the report to be generated; and obtaining configuration information corresponding to the report to be generated according to the identifier of the report to be generated based on a pre-configured configuration information table.
[0008] In some embodiments, based on a preset configuration information table, according to the identifier of the report to be generated, obtaining configuration information corresponding to the report to be generated includes: using the identifier corresponding to the report to be generated, reading the configuration information in the configuration information table, and obtaining the configuration information corresponding to the report to be generated.
[0009] In some embodiments, the method further includes: determining a display page according to the page type of the report to be generated; the display page is used to display the report to be generated; wherein the page type includes a report category and a chart category, the display page corresponding to the report category is a report display page, and the display page corresponding to the chart category is a chart display page.
[0010] In some embodiments, the method further includes: executing an interface customization operation in response to a touch operation of a user.
[0011] Among them, the interface customization operation includes display operation and / or jump operation; the display operation is used to display the data corresponding to the control when the user clicks any control in the report to be generated, and the jump operation is used to jump to other pages with the parameters corresponding to the control when the user clicks any control in the report to be generated.
[0012] In a second aspect, a report generating device comprises: an acquisition unit and a processing unit; the acquisition unit is used to acquire configuration information corresponding to the report to be generated; the processing unit is used to determine the position corresponding to the configuration information in the database language query statement template; the processing unit is also used to input the configuration information into the corresponding position in the database language query statement template to obtain a database language statement of the configuration information; the processing unit is also used to execute the database language statement, query the data associated with the configuration information from the database, and generate the report to be generated.
[0013] In some embodiments, the configuration information includes at least one of the following: an identifier of a field; a query attribute of a field; a sorting rule of a field; and a grouping condition of a field.
[0014] In some embodiments, the processing unit is specifically used to input the identifier of the field into the position corresponding to the identifier in the database language query statement template to generate a select statement; input the query attribute of the field into the position corresponding to the query attribute in the database language query statement template to generate a where statement; input the sorting rule of the field into the position corresponding to the sorting rule in the database language query statement template to generate an order by statement; input the grouping condition of the field into the position corresponding to the grouping condition in the database language query statement template to generate a group by statement; and concatenate the select statement, where statement, order by statement and group by statement to generate a database language statement for configuration information.
[0015] In some embodiments, the processing unit is specifically used to receive a report generation request in response to a user's touch operation; the report generation request carries an identifier of the report to be generated; based on a pre-configured configuration information table, the configuration information corresponding to the report to be generated is obtained according to the identifier of the report to be generated.
[0016] In some embodiments, the processing unit is further configured to use an identifier corresponding to the report to be generated to read the configuration information in the configuration information table to obtain the configuration information corresponding to the report to be generated.
[0017] In some embodiments, the processing unit is also used to determine a display page according to the page type of the report to be generated; the display page is used to display the report to be generated; wherein the page type includes a report category and a chart category, the display page corresponding to the report category is a report display page, and the display page corresponding to the chart category is a chart display page.
[0018] In some embodiments, the processing unit is further configured to execute an interface customization operation in response to a user's touch operation;
[0019] Among them, the interface customization operation includes display operation and / or jump operation; the display operation is used to display the data corresponding to the control when the user clicks any control in the report to be generated, and the jump operation is used to jump to other pages with the parameters corresponding to the control when the user clicks any control in the report to be generated.
[0020] In a third aspect, the present disclosure provides a report generation system, the system comprising: a memory and a processor; the memory is used to store computer instructions; the processor is used to implement any optional report generation method in the above-mentioned first aspect when executing the computer instructions.
[0021] In a fourth aspect, the present disclosure provides a computer-readable storage medium, in which a computer program or instruction is stored. When the computer program or instruction is executed by a processing device, any optional report generation method in the first aspect is implemented.
[0022] In a fifth aspect, the present disclosure provides a computer program product, including a computer program or instructions, which, when executed by a processing device, implements any optional report generation method in the first aspect.
[0023] The report generation method provided by the present disclosure can input the configuration information corresponding to the report to be generated into a database language query statement template to generate a database language statement for the configuration information without manually writing the database language statement, which is more conducive to shortening the time for obtaining the database language statement, and obtains data associated with the configuration information according to the database language statement query to generate the report to be generated, thereby improving the efficiency of generating the report to be generated. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0025] Figure 1 A schematic diagram of a system architecture of a report generation method provided by an embodiment of the present disclosure;
[0026] Figure 2 A schematic diagram of the composition of an electronic device provided in an embodiment of the present disclosure;
[0027] Figure 3 A method flow chart of a report generation method provided by an embodiment of the present disclosure;
[0028] Figure 4 A method flow chart of another report generation method provided by an embodiment of the present disclosure;
[0029] Figure 5 A method flow chart of another report generation method provided by an embodiment of the present disclosure;
[0030] Figure 6 A schematic diagram of a report to be generated provided in an embodiment of the present disclosure;
[0031] Figure 7 A schematic diagram of another report to be generated provided by an embodiment of the present disclosure;
[0032] Figure 8 A schematic block diagram of an electronic device provided in accordance with an embodiment of the present disclosure. DETAILED DESCRIPTION
[0033] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0034] In the description of the present disclosure, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present disclosure. In addition, the terms "first", "second", and "third" are used only for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first", "second", and "third" may explicitly or implicitly include one or more features. In the description of the present disclosure, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0035] In the description of the present disclosure, the word "exemplary" is used to mean "used as an example, illustration, or illustration". Any embodiment described in the present disclosure as "exemplary" is not necessarily to be construed as being preferred or advantageous over other embodiments. The following description is given to enable any technician in the field to implement and use the present disclosure. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present disclosure can be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid obscuring the description of the present disclosure with unnecessary details. Therefore, the present disclosure is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in the present disclosure.
[0036] The relatively mature visualization reporting system in the current market can provide enterprises and organizations with powerful data analysis capabilities. This visualization reporting system can help users efficiently extract valuable information from huge data sets and convert it into intuitive and easy-to-understand charts.
[0037] However, the existing system has significant deficiencies in the report design process, which is manifested in the complex and cumbersome design process, and even requires users to have certain programming knowledge. At the same time, business logic and report processing are intertwined, leading to the dilemma of "simple requirements, complex design, and difficult maintenance."
[0038] In most existing report design systems, data queries rely on manually written SQL statements. For scenarios with query conditions, not only do you need to pre-set placeholders in the SQL statement, but you also need to maintain them in the query condition section of the report page. When executing a query operation, the system will use the variables passed in from the report page to replace the preset placeholders in the SQL statement to generate the final executed SQL statement. This SQL definition method is essentially a string concatenation operation, which has potential SQL injection security risks and is time-consuming to manually process.
[0039] In addition, since SQL statements and query conditions are maintained separately, errors are likely to occur, making it difficult to achieve unified management and maintenance of the two.
[0040] Based on the above technical problems, an embodiment of the present disclosure provides a report generation method, which can input the configuration information corresponding to the report to be generated into a database language query statement template to generate a database language statement for the configuration information. There is no need to manually write the database language statement, which is conducive to shortening the time for obtaining the database language statement, and obtaining data associated with the configuration information according to the database language statement query to generate the report to be generated, thereby improving the efficiency of generating the report to be generated.
[0041] In order to facilitate understanding of the embodiments of the present disclosure, the following points are explained before introducing the embodiments of the present disclosure.
[0042] 1. In the embodiments of the present disclosure, "indication" may include direct indication and indirect indication, and may also include explicit indication and implicit indication. The information indicated by a certain information is called information to be indicated. In the specific implementation process, there are many ways to indicate the information to be indicated, such as but not limited to, directly indicating the information to be indicated, such as the information to be indicated itself or the index of the information to be indicated. The information to be indicated may also be indirectly indicated by indicating other information, wherein the other information is associated with the information to be indicated. It is also possible to indicate only a part of the information to be indicated, while the other parts of the information to be indicated are known or agreed in advance.
[0043] 2. “Pre-setting” can be achieved by pre-saving corresponding codes, tables or other methods that can be used to indicate relevant information in a device (for example, a client device or a server device). The embodiments of the present disclosure do not limit the specific implementation method.
[0044] 3. In the embodiments of the present disclosure, descriptions such as "in the case of ...", "if" and "if" all mean that under certain objective circumstances, the device (such as a client device or a server device) will make corresponding processing, which does not limit the time, nor does it require the device (such as a client device or a server device) to make a judgment action when implementing it, nor does it mean that there are other limitations.
[0045] In addition, the system architecture and business scenarios described in the embodiments of the present disclosure are intended to more clearly illustrate the technical solutions of the embodiments of the present disclosure, and do not constitute a limitation on the technical solutions provided by the embodiments of the present disclosure. A person of ordinary skill in the art can appreciate that with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of the present disclosure are equally applicable to similar technical problems.
[0046] In addition, the actions, terms, etc. involved in the various embodiments of the present disclosure can refer to each other without limitation. The message name or parameter name in the message exchanged between the various devices in the embodiments of the present disclosure is only an example, and other names can also be used in the specific implementation without limitation.
[0047] The following is an exemplary introduction to the system architecture of the embodiments of the present disclosure.
[0048] In some embodiments, the report generation method provided by the embodiments of the present disclosure can be applied to Figure 1 In the system architecture shown. For example, Figure 1 A schematic diagram of the system architecture of a report generation method provided by an embodiment of the present disclosure. Figure 1 , the system architecture may include: a client 101 and a server 102. The client 101 and the server 102 may be in different locations, such as in different cities. The client 101 and the server 102 may communicate through a network 103. The network 103 may be the Internet, or other networks (such as Ethernet). The network 103 may include one or more network devices, such as a network device that may be a router or a switch. A database is created on both the client 101 and the server 102, and the database may be a relational database, a non-relational database, a graph database, a time series database, etc.
[0049] The client 101 may be installed on a client device, such as a terminal device. In some embodiments, the client device is at least one of a smart phone, a smart watch, a printer, a desktop computer, a laptop computer, a virtual reality terminal, an augmented reality terminal, a wireless terminal, and a laptop computer.
[0050] In some embodiments, the client 101 has a communication function and can access a wired network or a wireless network.
[0051] In the disclosed embodiment, the client 101 may be configured to receive a report generation request in response to a user's touch operation, and send the report generation request to the server 102 .
[0052] The report generation request carries an identifier of the report to be generated.
[0053] In some embodiments, the server 102 can be installed on a server device, such as a server. In some embodiments, the server 102 device can be an independent physical server, or a server cluster or distributed file system composed of multiple physical servers, or at least one of the cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks, and big data or artificial intelligence platforms, etc., which are not limited in the embodiments of the present disclosure. Of course, the server 102 can also include other functions to provide more comprehensive and diversified services.
[0054] In the disclosed embodiment, the server 102 is used to use the identifier corresponding to the report to be generated to read the configuration information in the configuration information table, obtain the configuration information corresponding to the report to be generated, and input the configuration information into the corresponding position in the database language query statement template. In this way, the database language statement of the configuration information is obtained without manually writing the database language statement, which is more conducive to shortening the time of obtaining the database language statement. Then, the database language statement is executed to query the data associated with the configuration information from the database to generate the report to be generated, thereby improving the efficiency of generating the report to be generated.
[0055] In addition, the server 102 is also used to determine the display page of the report according to the page type of the report to be generated, and send the generated report to the client.
[0056] In a possible implementation, the relevant functions in the embodiments of the present disclosure may be implemented by one device, or by multiple devices together, or by one or more functional modules in one device, and the embodiments of the present disclosure do not specifically limit this. It is understandable that the above functions may be network elements in hardware devices, or software functions running on dedicated hardware, or a combination of hardware and software, or virtualization functions instantiated on a platform (e.g., a cloud platform).
[0057] When implementing it specifically, Figure 1 The devices shown can be used Figure 2 The structure shown, or including Figure 2 Parts shown. Figure 2The present invention provides a schematic diagram of the composition of an electronic device 200 provided in an embodiment of the present disclosure, wherein the electronic device 200 includes at least one processor 201 and a transceiver 202, and may also include a memory 203. The processor 201, the memory 203 and the transceiver 202 may be connected via a communication line.
[0058] In the disclosed embodiment, the processor 201 may be a chip. The chip may include five categories: logic chip, memory chip, sensor chip, power chip and communication chip. Among them, the processor 201 category mainly undertakes chips for specific calculation and control tasks in the system, such as microcontroller unit (MCU), central processing unit 201 (CPU), graphics processing unit 201 (GPU), neural processing unit (NPU), etc. The storage category mainly undertakes chips for data storage in the system, as well as some storage controller chips, such as dynamic random access memory 203 (DRAM), static random access memory 203 (SRAM), flash eeprom memory (Flash), etc. The sensor category mainly undertakes chips for information collection, presentation and interaction in the system, such as input and output devices, part of the signal processing chip, etc. Communication chips (wired and wireless) mainly undertake communication functions in the system, such as some Ethernet chips, switching chips, wide area and local area networks, point-to-point and ad hoc network chips, as well as filtering, amplification, power and other devices that assist communication can all belong to this category. The commonly known wireless fidelity (WiFi), Bluetooth, fifth generation mobile communication technology (5G) baseband, global positioning system (GPS), narrow band internet of things (NB-IoT), network cards, switches, etc. can all be classified into this category.
[0059] The communication line may include a channel for transmitting information between the above components.
[0060] The memory 203 may be a read-only memory 203 (ROM) or other types of static storage devices that can store static information and instructions, a random access memory 203 (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory 203 (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to include or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.
[0061] In one possible design, the memory 203 can exist independently of the processor 201, that is, the memory 203 can be a memory 203 outside the processor 201. In this case, the memory 203 can be connected to the processor 201 through a communication line to store execution instructions or application code, and the processor 201 controls the execution to implement the network quality determination method provided in the following embodiment of the present disclosure. In another possible design, the memory 203 can also be integrated with the processor 201, that is, the memory 203 can be the internal memory 203 of the processor 201. For example, the memory 203 is a high-speed cache that can be used to temporarily store some data and instruction information.
[0062] As an implementable manner, the processor 201 may include one or more CPUs.
[0063] It should be noted that the electronic device described in the embodiment of the present disclosure is for more clearly illustrating the technical solution of the embodiment of the present disclosure, and does not constitute a limitation on the technical solution provided by the embodiment of the present disclosure. A person skilled in the art can appreciate that with the evolution of the report generating device and the emergence of other report generating devices, the technical solution provided by the embodiment of the present disclosure is also applicable to similar technical problems.
[0064] Combine the following Figure 2 ,by Figure 2 Taking the electronic device in FIG. 1 as an example, the report generating method provided by the embodiment of the present disclosure is described.
[0065] Figure 3 A method flow chart of a report generation method provided by an embodiment of the present disclosure, such as Figure 3 As shown, the method includes:
[0066] S301, obtaining configuration information corresponding to the report to be generated.
[0067] The configuration information includes, but is not limited to: field identifiers, field query attributes, field sorting rules, and field grouping conditions.
[0068] Optionally, the configuration information may also include a report template path, data source information, data processing rules, display format, etc.
[0069] As a possible implementation of step 301, in response to a user's touch operation, a report generation request is received, and configuration information corresponding to the report to be generated is acquired based on a pre-configured configuration information table and an identifier of the report to be generated.
[0070] The report generation request carries the identifier of the report to be generated.
[0071] In some embodiments, after the processor receives the report generation request, it uses the identifier corresponding to the report to be generated to read the configuration information in the configuration information table to obtain the configuration information corresponding to the report to be generated.
[0072] Exemplarily, the processor may determine the identity document (ID) of the report to be generated, and then access a database table storing report configuration information (ie, configuration information table), wherein the configuration information table includes configuration information of multiple reports to be generated, and each configuration information is associated with a specific ID of the report to be generated.
[0073] The determined report identifier to be generated is used as a query condition to perform a query operation in the configuration information table; and configuration information corresponding to the report identifier is extracted from the query result.
[0074] It should be understood that the identifier of the report to be generated may be numbers, letters, or a combination of numbers and letters, which is used to uniquely identify the report in the system, and the embodiments of the present disclosure are not limited to this.
[0075] The query operation is intended to retrieve records that fully match a given report ID.
[0076] It should be understood that the electronic device provided in the embodiment of the present application stores a pre-configured configuration information table. The following is a detailed introduction to the formation method of the configuration information table (the method of maintaining page information).
[0077] In some embodiments, the processor displays and stores the configuration information of the original data resource according to the type of the original data resource. The type of the original data resource may include a data source stored in a database and a data source accessed or operated through an interface, and different types of data sources may obtain corresponding configuration information in different ways.
[0078] For example, for a data source stored in a database, the identifier of the field corresponding to the data source can be obtained through the SHOW FULL COLUMNS function. Taking the student information table as an example, the processor obtains the identifier of the field in the student information table through the SHOW FULL COLUMNS function, and the identifier of the field can be name, age, grade, etc.
[0079] It should be understood that the SHOW FULL COLUMNS function can be used to display detailed information of all columns in a database table, including field names, data types, etc.
[0080] For example, SHOW FULL COLUMNS FROM table_name[FROM database_name][LIKE'pattern'|WHERE expr].
[0081] Furthermore, query conditions are set for the field, even if the field supports query, and the query method can include single selection or multiple selection. The processor obtains the enumeration value of the optional items in the field through the select`column`from`table`GROUP_BY`column` query statement (obtains the unique value of all data in the field). Taking the student information table as an example, if the query method is single-select query, you can query Zhang San through the above query statement to obtain information related to Zhang San. Or, if the query method is multiple-select query, query Zhang San and Li Si through the above query statement to obtain information related to Zhang San and Li Si.
[0082] For example, SELECT column_name;
[0083] FROM table_name;
[0084] GROUP BY column_name.
[0085] It should be understood that optional items refer to all data content included in the field, such as the name field includes: Zhang San, Li Si, Xiao Ming, etc.
[0086] In another example, for a data source that needs to be accessed or operated through an interface, a request can be sent to the interface of the data source, and then a response message of the request is received, and the data content carried in the response message is traversed and processed to determine the identifier of the field corresponding to the data content. Taking the student information table as an example, the data content received by the processor is Zhang San, 20 years old, 98 points, and after traversal processing, the field identifiers obtained are name, age, and score.
[0087] Furthermore, the query URL attribute (interface address) is configured for the field.
[0088] For example, determine the interface address and request method (such as GET or POST), send an HTTP request to the interface address, and after receiving the HTTP request, the interface executes the response logic and feeds back response information to the processor, which carries the enumeration value (unique value) of the query.
[0089] The response information may be in a JSON object, an XML document, or other formats.
[0090] After the processor completes processing the original data resource, it obtains a configuration information table and stores the configuration information table for subsequent use.
[0091] S302: Determine a position in the database language query statement template that corresponds to the configuration information.
[0092] For example, the database language query statement template may refer to the following example:
[0093] SELECT column1, column2, column3
[0094] FROM table_name;
[0095] WHERE column_name comparison_operator value;
[0096] ORDER BY column_name[ASC|DESC];
[0097] GROUP BY column_name1[, column_name2,…].
[0098] It should be understood that since the position of each configuration information in the database language query statement template is fixed, the position of each configuration information can be determined without manually writing an SQL template.
[0099] Combined with the above examples, we can know that the field identifier can be located at the positions of column1, column2, and column3 in the database language query statement template, the query attribute of the field can be located at the position of comparison_operator value in the database language query statement template, the sorting rule of the field can be located at the position of [ASC|DESC] in the database language query statement template, and the grouping condition of the field can be located at the position of column_name1[, column_name2, ...] in the database language query statement template.
[0100] S303: Input the configuration information into the corresponding position in the database language query statement template to obtain the database language statement of the configuration information.
[0101] In some embodiments, the processor inputs the identifier of the field into a position corresponding to the identifier in the database language query statement template to generate a select statement.
[0102] For example, the processor may insert the identifier of the student information table and the identifiers of the fields: name, age, and grade into the corresponding positions in the database language query statement template, and generate the select statement:
[0103] SELECT name,age,score
[0104] FROM student information.
[0105] Correspondingly, the generated select statement will query the data of the three fields of name, age, and score from the student information table.
[0106] Among them, student information is stored in the database.
[0107] As another example, suppose there is a table named employees in the database, and the fields in the configuration information are identified as first name, last name, and email; the processor inserts employees and first name, last name, and email into the database language query statement template, and the generated select statement is:
[0108] SELECT first_name, last_name, email
[0109] FROM employees.
[0110] Accordingly, the generated select statement will query the data of the three fields of first name, last name, and email from the employees table.
[0111] It should be understood that if more fields need to be queried or the queried table is different, the identifiers of the fields and the table can be adaptively adjusted, and this is not limited in the embodiments of the present disclosure.
[0112] In some embodiments, the query attribute of the field is input into a position corresponding to the query attribute in a database language query statement template to generate a where statement.
[0113] The query attributes of the field include but are not limited to the field identifier, comparison operator and corresponding value.
[0114] For example, the field identifier is department, the comparison operator is equal to (=), and the value is sales. The processor inserts department, equal to (=), and sales into the database language query statement template, and the generated where statement is:
[0115] WHERE department = 'Sales';
[0116] Or, if you need to query the records in the department with sales and salary greater than 5000, the generated where statement can be:
[0117] WHERE department='Sales'AND salary>50000.
[0118] In some embodiments, the sorting rule of the field is input into the position corresponding to the sorting rule in the database language query statement template to generate an order by statement.
[0119] The sorting rules of the fields include but are not limited to the identification and sorting direction of the fields.
[0120] For example, the identifier of the field is salary and the sorting direction is descending (DESC). The processor inserts salary (salary) and descending (DESC) into the database language query statement template, and the generated order by statement is:
[0121] ORDER BY salary DESC.
[0122] As another example, when multiple fields need to be sorted, a sorting direction can be specified for each of the multiple fields. For example, when the department field is sorted in ascending order (ASC) and the salary field within each department is sorted in descending order (DESC), the processor can insert department, ascending order (ASC); salary, descending order (DESC) into the database language query statement template, and the generated order by statement can be:
[0123] ORDER BY department ASC, salary DESC.
[0124] In some embodiments, the grouping condition of the field is input into a position corresponding to the grouping condition in a database language query statement template to generate a group by statement.
[0125] For example, take department and total sales amount as an example. The processor can group the sales data according to department to calculate the total sales of each department. For example, the processor inserts department and total sales amount into the database language query statement template, and the generated group by statement is:
[0126] SELECT department,SUM(amount)AS total_sales
[0127] FROM sales
[0128] GROUP BY department.
[0129] Accordingly, the generated group by statement will return the total sales amount for each department.
[0130] In another example, when multiple fields need to be grouped, the processor can insert multiple fields into the database language query statement template. For example, each department (department) is further grouped according to the salesperson's sales (sales_person) to obtain the sales of each salesperson in his or her department. The generated group by statement can be:
[0131] SELECT department, sales_person, SUM(amount)AS total_sales
[0132] FROM sales
[0133] GROUP BY department, sales_person.
[0134] Accordingly, the generated group by statement will return the sales of each salesperson within his or her department.
[0135] In some embodiments, the select statement, where statement, order by statement and group by statement are concatenated to generate a database language statement of the configuration information.
[0136] Exemplarily, the generated where statement, order by statement, and group by statement are appended to the select statement to complete the entire query statement. For example:
[0137] SELECT first_name, last_name, email, department, salary
[0138] FROM employees
[0139] WHERE department='Sales'AND salary>50000;
[0140] GROUP BY department
[0141] ORDER BY total_sales DESC.
[0142] Another example, for example:
[0143] SELECT department,SUM(amount)AS total_sales
[0144] FROM sales
[0145] WHERE sale_date BETWEEN'2023-01-01'AND'2023-12-31'
[0146] GROUP BY department
[0147] ORDER BY total_sales DESC.
[0148] S304, executing database language statements, querying data associated with the configuration information from the database, and generating a report to be generated.
[0149] For example, SELECT department, SUM(amount) AS total_sales
[0150] FROM sales
[0151] WHERE sale_date BETWEEN'2023-01-01'AND'2023-12-31'
[0152] GROUP BY department
[0153] Take ORDER BY total_sales DESC as an example. The processor executes the database language statement to query data from the database to generate a report to be generated about the total sales of each department in 2023, sorted in descending order by sales.
[0154] Based on the above technical solution, the disclosed embodiment can input the configuration information corresponding to the report to be generated into the database language query statement template to generate the database language statement of the configuration information without manually writing the database language statement, which is conducive to shortening the time of obtaining the database language statement, and obtaining the data associated with the configuration information according to the database language statement query and then generating the report to be generated, thereby improving the efficiency of generating the report to be generated.
[0155] A report generation method provided by the embodiment of the present disclosure further includes the following S401: Figure 4 As shown, the method includes:
[0156] S401, determining a display page according to the page type of the report to be generated.
[0157] Among them, the display page is used to display the report to be generated. The page type includes report category and chart category. The display page corresponding to the report category is the report display page, and the display page corresponding to the chart category is the chart display page.
[0158] As a possible implementation of the above step 401, the page type of the report to be generated is determined. When the page type is determined to be a chart type, the parameters of the corresponding chart configuration option (Chart Option) are sorted according to the chart type, and the report to be generated is displayed using the corresponding display page. When the page type is determined to be a chart type, a table component can be used to display the report to be generated.
[0159] In some embodiments, taking the open source visualization library (EChart) as an example, the icon categories include but are not limited to a bar chart, a line chart, and a pie chart. In other words, the report to be generated is displayed through the open source visualization library (EChart) component.
[0160] Exemplarily, for a bar chart, the parameters of the chart configuration options include, but are not limited to: title, tooltip, legend, grid, x-axis, y-axis, and series.
[0161] Among them, the title can be used to set the chart's logo, and the title's text, position, font style, etc. can be configured; the tooltip can be configured with the trigger type (such as mouse hover or click) and the style and content format of the tooltip, for example, when the mouse hovers over a data point in the chart, a tooltip will be displayed to show the detailed information of the data point; the legend can be used to indicate the logo and name of different data series in the chart; the grid can be used to define the chart's drawing area and background, and then configure the grid's position, size, margins, background color, etc.; the x-axis (xAxis) can be used to It is used to define the X-axis in the chart, that is, the horizontal axis, and then you can configure the type of the X-axis (xAxis) (for example, category axis, value axis, time axis, etc.), data, scale labels, scale lines, etc.; the Y-axis (yAxis) is used to define the Y-axis in the chart, that is, the vertical axis. The Y-axis (yAxis) is similar to the X-axis (xAxis), and you can configure the type of the Y-axis, data, scale labels, scale lines, etc.; the series (series) is a set of data in the chart. Each series represents a data type or data series in the chart. The series (series) can be configured with the type of series (for example, line chart, bar chart, pie chart, etc.), data, style, label, etc.
[0162] A report generation method provided by the embodiment of the present disclosure further includes the following S501: Figure 5 As shown, the method includes:
[0163] S501, executing an interface customization operation in response to a touch operation of a user.
[0164] In some embodiments, the interface customization operation includes a display operation and / or a jump operation.
[0165] Among them, the display operation can be used to display the data corresponding to the control when the user clicks any control in the report to be generated; the jump operation can be used to jump to other pages with the parameters corresponding to the control when the user clicks any control in the report to be generated.
[0166] For example, the page type of the report to be generated is a report category. The report to be generated supports the function of report customization, which allows users to customize the click controls of the rows or chart elements in the report. Specifically, the supported operations include but are not limited to viewing details and page jumps, that is, display operations and jump operations.
[0167] In one scenario, when the report to be generated cannot display all the data, the user clicks on the control of any report row in the report to be generated, and the processor can display all the data of the report row. In other words, through the view details function, the report row data can be displayed in depth and clearly. For example Figure 6 As shown, the report to be generated only displays the names of Zhang San, Li Si, and Xiao Ming, but does not display them completely. The user can click the control in the row to display the names of Xiao Qing and Xiao Tian in the report row in full.
[0168] In addition, the jump operation (page jump function) allows users to jump to other pages or other pages in the system with the corresponding parameters of the control when clicking any control in the report to be generated. This function not only enhances the interactivity and usability of the report, but also greatly improves the convenience and flexibility of users in the process of use. Figure 7 As shown, when the user clicks the control, the displayed page jumps from the page displayed in (a) to the page displayed in (b).
[0169] Furthermore, the report customization function provided by the embodiment of the present disclosure can be seamlessly integrated into the existing report system without large-scale modification or reconstruction of the system. At the same time, this function also supports interaction with third-party web pages. Users can directly jump to the third-party web page with relevant parameters by clicking on the report element, thus realizing cross-system data sharing and analysis.
[0170] Figure 8 Schematic block diagram of an example electronic device 600 that can be used to implement the embodiments of the present disclosure is shown. Figure 8 As shown, the electronic device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory 603. In the random access memory (RAM) 603, various programs and data required for the operation of the electronic device 600 can also be stored. The computing unit 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0171] Multiple components in the electronic device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the electronic device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0172] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit, a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors, and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as the data matching method. For example, in one embodiment, the data matching method may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 608. In one embodiment, part or all of the computer program may be loaded and / or installed on the electronic device 600 via ROM 702 and / or a communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the data matching method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the data matching method in any other appropriate manner (e.g., by means of firmware).
[0173] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays, application specific integrated circuits, application specific standard parts (ASSPs), system on chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0174] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0175] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories, read-only memories, erasable programmable read-only memories, optical fibers, portable compact disk read-only memories, optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0176] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user, such as a cathode ray tube (CRT) or a liquid crystal display (LCD) monitor; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and the input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0177] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: Local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
[0178] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0179] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of this disclosure can be achieved, and this document is not limited here.
[0180] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A report generation method, characterized in that: The method comprises: Get the configuration information corresponding to the report to be generated; Determine a position in a database language query statement template corresponding to the configuration information; Input the configuration information into the corresponding position in the database language query statement template to obtain the database language statement of the configuration information; The database language statement is executed to query the data associated with the configuration information from the database and generate the report to be generated.
2. The method according to claim 1, characterized in that The configuration information includes at least one of the following: The identifier of the field; The query properties of the field; The sorting rules of the fields; The grouping condition for the field.
3. The method according to claim 2, characterized in that The step of inputting the configuration information into a corresponding position in the database language query statement template to obtain a database language statement of the configuration information includes: Inputting the identifier of the field into the position corresponding to the identifier in the database language query statement template to generate a select statement; Inputting the query attribute of the field into the position corresponding to the query attribute in the database language query statement template to generate a where statement; Inputting the sorting rule of the field into the position corresponding to the sorting rule in the database language query statement template to generate an order by statement; Inputting the grouping condition of the field into the position corresponding to the grouping condition in the database language query statement template to generate a group by statement; The select statement, the where statement, the order by statement and the group by statement are concatenated to generate a database language statement of the configuration information.
4. The method according to claim 1, characterized in that: The obtaining of configuration information corresponding to the report to be generated includes: In response to a touch operation of a user, receiving a report generation request; the report generation request carries an identifier of the report to be generated; Based on the pre-configured configuration information table and the identifier of the report to be generated, configuration information corresponding to the report to be generated is acquired.
5. The method according to claim 4, characterized in that Based on a preset configuration information table and the identifier of the report to be generated, obtaining configuration information corresponding to the report to be generated includes: The configuration information in the configuration information table is read using the identifier corresponding to the report to be generated, so as to obtain the configuration information corresponding to the report to be generated.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Determine a display page according to the page type of the report to be generated; the display page is used to display the report to be generated; wherein the page type includes a report category and a chart category, the display page corresponding to the report category is a report display page, and the display page corresponding to the chart category is a chart display page.
7. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: In response to a user's touch operation, executing an interface customization operation; Among them, the interface customization operation includes a display operation and / or a jump operation; the display operation is used to display the data corresponding to the control when the user clicks on any control in the report to be generated, and the jump operation is used to jump to other pages with the parameters corresponding to the control when the user clicks on any control in the report to be generated.
8. A report generation system, characterized in that: The system includes a memory and a processor; the memory is used to store computer instructions; when the processor executes the computer instructions, the report generation method according to any one of claims 1 to 7 is implemented.
9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program or instruction. When the computer program or instruction is executed by a processing device, the report generation method according to any one of claims 1 to 7 is implemented.
10. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed on a processing device, the report generation method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Key data and report second-level generation method and system based on incremental view maintenance
CN122616513A