CN109857756B - Database report generation method, device, equipment and readable storage medium - Google Patents

Database report generation method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN109857756B
CN109857756B CN201910032543.4A CN201910032543A CN109857756B CN 109857756 B CN109857756 B CN 109857756B CN 201910032543 A CN201910032543 A CN 201910032543A CN 109857756 B CN109857756 B CN 109857756B
Authority
CN
China
Prior art keywords
data
query
header
sql statement
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910032543.4A
Other languages
Chinese (zh)
Other versions
CN109857756A (en
Inventor
潘禹霖
王吉祥
孟刚
张世富
徐茂红
季月英
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China United Network Communications Group Co Ltd
Original Assignee
China United Network Communications Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China United Network Communications Group Co Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN201910032543.4A priority Critical patent/CN109857756B/en
Publication of CN109857756A publication Critical patent/CN109857756A/en
Application granted granted Critical
Publication of CN109857756B publication Critical patent/CN109857756B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method, a device, equipment and a readable storage medium for generating a database report, wherein the method comprises the following steps: receiving a first query request, wherein the first query request comprises a first SQL statement for generating a dynamic header; determining header data of the target report according to the first SQL statement; receiving a second query request, wherein the second query request comprises a query condition of the table body data, the query condition is a second SQL statement containing a condition variable, and the condition variable is used for representing the storage position of the table head data; acquiring a data structure of first service data corresponding to the header data, wherein the data structure is used for determining the storage position of the first service data; determining the query range of the condition variable in the second SQL statement according to the data structure; analyzing the second query request according to the query range, and determining the table body data corresponding to the table head data; and displaying the target report according to the header data and the body data of the target report. Therefore, the efficiency of generating the report can be improved, and the labor and time cost can be saved.

Description

Database report generation method, device, equipment and readable storage medium
Technical Field
The present invention relates to the field of communications, and in particular, to a method, an apparatus, a device, and a readable storage medium for generating a database report.
Background
The database usually stores all the service data in the service development process, so that when performing service data statistics or service settlement, a Structured Query Language (SQL) can be used to generate a service report with rich content according to actual working requirements. SQL is a database language, and specifically may obtain corresponding database data by inputting an operation command, such as a SELECT statement. SQL has rich, flexible operational commands and thus becomes one of the most efficient ways to generate reports in databases, with almost all databases supporting SQL.
In the prior art, when a business report is generated, a corresponding report template is established first, and a report header in the report template is determined according to a commonly used report requirement. When a report needs to be generated, an operation command is input through an SQL statement, and database data corresponding to a report header is acquired. The SQL statement comprises parameters corresponding to the report header.
However, when the service type is expanded or the service relevance is increased, the complexity of the report header is correspondingly increased. At this time, the existing report template cannot meet diversified report requirements, and the parameters corresponding to the report header included in the report header and the SQL statement in the report template need to be modified again, so that the adjustment of the report header and the SQL statement cannot be completed according to the dynamic changes of the service types or the data, and the accuracy and the efficiency of generating the report are poor.
Therefore, a method and an apparatus for dynamically generating a target report according to real-time changes of service types or data are needed to reduce a large amount of post modification work on report headers and SQL statements, improve the efficiency of generating reports, and save labor and time costs.
Disclosure of Invention
The invention provides a method, a device and equipment for generating a database report and a readable storage medium, which are used for solving the technical problems that the existing report generation method cannot adjust the header and SQL (structured query language) statement of the report according to the service type or the dynamic change of data, so that the accuracy of generating the report is poor and the efficiency is low.
The first aspect of the invention provides a method for generating a database report, which comprises the following steps:
receiving a first query request, wherein the first query request comprises a first SQL statement for generating a dynamic header;
determining header data of the target report according to the first SQL statement;
receiving a second query request, wherein the second query request comprises a query condition of the table body data, the query condition is a second SQL statement containing a condition variable, and the condition variable is used for representing a storage position of the table head data;
acquiring a data structure of first service data corresponding to the header data, wherein the data structure is used for determining the storage position of the first service data;
determining the query range of the condition variable in the second SQL statement according to the data structure of the first business data;
analyzing the second query request according to the query range of the condition variable, and determining the table body data corresponding to the table head data;
and displaying the target report according to the header data of the target report and the table body data corresponding to the header data.
Another aspect of the present invention provides an apparatus for generating a database report, including:
the first query request receiving module is used for receiving a first query request, wherein the first query request comprises a first SQL statement for generating a dynamic header;
the header data determining module is used for determining header data of the target report according to the first SQL statement;
the second query request receiving module is used for receiving a second query request, the second query request comprises a query condition of the table body data, the query condition is a second SQL statement containing a condition variable, and the condition variable is used for representing the storage position of the table head data;
the data structure acquisition module is used for acquiring a data structure of first service data corresponding to the header data, and the data structure is used for determining the storage position of the first service data;
the query range determining module is used for determining the query range of the condition variable in the second SQL statement according to the data structure of the first business data;
the analysis module is used for analyzing the second query request according to the query range of the condition variable and determining the table body data corresponding to the table head data;
and the display module is used for displaying the target report according to the header data of the target report and the table body data corresponding to the header data.
Still another aspect of the present invention provides a generation apparatus of a database report, including: a memory, a processor;
a memory; a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the database report generation method.
Yet another aspect of the present invention is to provide a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, the method for generating a database report as described above is implemented.
According to the method, the device, the equipment and the readable storage medium for generating the database report, provided by the invention, a first query request is received, wherein the first query request comprises a first SQL statement for generating a dynamic header; determining header data of the target report according to the first SQL statement; receiving a second query request, wherein the second query request comprises a query condition of the table body data, the query condition is a second SQL statement containing a condition variable, and the condition variable is used for representing a storage position of the table head data; acquiring a data structure of first service data corresponding to the header data, wherein the data structure is used for determining the storage position of the first service data; determining the query range of the condition variable in the second SQL statement according to the data structure of the first business data; analyzing the second query request according to the query range of the condition variable, and determining the table body data corresponding to the table head data; and displaying the target report according to the header data of the target report and the table body data corresponding to the header data. By the method and the device for dynamically generating the target report according to the real-time change of the business type or the data, a large amount of post modification work on the report header and the SQL statement is reduced, the report generation efficiency is improved, and the labor cost and the time cost are saved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art according to the drawings.
Fig. 1 is a schematic flow chart illustrating a method for generating a database report according to an embodiment of the present invention;
fig. 2 is a schematic flow chart illustrating a method for generating a database report according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a database report generation apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a database report generation device according to a fourth embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other examples obtained based on the examples in the present invention are within the scope of the present invention.
In the prior art, when a business report is generated, a corresponding report template is established first, and a report header in the report template is determined according to a commonly used report requirement. When a report needs to be generated, an operation command is input through an SQL statement, and database data corresponding to a report header is acquired. The SQL statement comprises parameters corresponding to the report header. However, when the service type is expanded or the service relevance is increased, the complexity of the report header is correspondingly increased. At this time, the existing report template cannot meet diversified report requirements, and the parameters corresponding to the report header included in the report header and the SQL statement in the report template need to be modified again, so that the adjustment of the report header and the SQL statement cannot be completed according to the dynamic changes of the service types or the data, and the accuracy and the efficiency of generating the report are poor. In order to solve the technical problem, the invention provides a method, a device, equipment and a readable storage medium for generating a database report. It should be noted that the method, the apparatus, the device and the readable storage medium for generating a database report provided by the present invention can be applied to any report generation scenario.
Fig. 1 is a schematic flowchart of a method for generating a database report according to an embodiment of the present invention, where as shown in fig. 1, the method includes:
step 101, receiving a first query request, wherein the first query request comprises a first SQL statement for generating a dynamic header;
step 102, determining header data of a target report according to a first SQL statement;
103, receiving a second query request, wherein the second query request comprises a query condition of the table body data, the query condition is a second SQL statement comprising a condition variable, and the condition variable is used for representing a storage location of the table head data;
step 104, acquiring a data structure of first service data corresponding to the header data, wherein the data structure is used for determining the storage position of the first service data;
step 105, determining a query range of the condition variable in the second SQL statement according to the data structure of the first business data;
step 106, analyzing the second query request according to the query range of the condition variable, and determining the table body data corresponding to the table head data;
and step 107, displaying the target report according to the header data of the target report and the table body data corresponding to the header data.
In this embodiment, in order to generate the target report, first, a first query request needs to be received, where the first query request includes a first SQL statement for generating a dynamic header, and header data of the target report is determined according to the first SQL statement. Specifically, firstly, the report query condition is abstracted to be a condition variable, the header pseudo SQL statement can be assembled by matching the condition variable with a plurality of business and index attribute tables, and the assembled SQL is abstracted to be the header variable. After determining the header data, a second query request may be received, where the second query request further includes a query condition of the table body data, and the query condition is specifically a second SQL statement that includes a condition variable, where the condition variable is used to characterize a storage location of the header data. The method comprises the steps of obtaining a data structure of first business data corresponding to header data, wherein the data structure is used for representing the storage position of the first business data, determining the query range of a condition variable in a second SQL statement according to the data structure of the first business data, analyzing a second query request according to the query range of the condition variable, determining the body data corresponding to the header data, and generating and displaying a target report according to the header data of the target report and the body data corresponding to the header data. Specifically, when the report is queried, the header SQL sentences are assembled into standard SQL sentences according to the selection of the condition variables, a header result set is obtained, the header result set is circularly acquired, the header variables in the report sentence pseudo SQL are replaced, the standard SQL sentences are analyzed, the query is completed, the header data and the body data are completely corresponded through an analyzer, and a target report is formed and displayed.
In the method for generating a database report provided by this embodiment, a first query request is received, where the first query request includes a first SQL statement for generating a dynamic header; determining header data of the target report according to the first SQL statement; receiving a second query request, wherein the second query request comprises a query condition of the table body data, the query condition is a second SQL statement containing a condition variable, and the condition variable is used for representing a storage position of the table head data; acquiring a data structure of first service data corresponding to the header data, wherein the data structure is used for determining the storage position of the first service data; determining the query range of the condition variable in the second SQL statement according to the data structure of the first business data; analyzing the second query request according to the query range of the condition variable, and determining the table body data corresponding to the table head data; and displaying the target report according to the header data of the target report and the table body data corresponding to the header data. By the method and the device for dynamically generating the target report according to the real-time change of the business type or the data, a large amount of post modification work on the report header and the SQL statement is reduced, the report generation efficiency is improved, and the labor cost and the time cost are saved.
Further, on the basis of the above embodiment, the method further includes:
receiving a first query request, wherein the first query request comprises a first SQL statement for generating a dynamic header;
determining header data of the target report according to the first SQL statement;
receiving a second query request, wherein the second query request comprises a query condition of the table body data, the query condition is a second SQL statement containing a condition variable, and the condition variable is used for representing a storage position of the table head data;
generating a business relation table according to the table name and the identification of the data table in the database; the business relation table is used for expressing the business logic relation of the business data;
acquiring a data structure of the first service data according to the service relation table, wherein the data structure is used for determining the storage position of the first service data;
determining the query range of the condition variable in the second SQL statement according to the data structure of the first business data;
analyzing the second query request according to the query range of the condition variable, and determining the table body data corresponding to the table head data;
and displaying the target report according to the header data of the target report and the table body data corresponding to the header data.
In this embodiment, the table names and identifiers of the multiple data tables are stored in the database, so before the data structure of the first service data corresponding to the header data is obtained, a service relationship table may be first generated according to the table names and identifiers of the multiple data tables stored in the database, where the service relationship table is specifically used to characterize the service logical relationship of the service data. Accordingly, the data structure for acquiring the data structure of the first service data can be implemented according to the service relationship table to determine the storage location of the first service data. Determining the query range of the condition variable in the second SQL statement according to the data structure of the first business data; analyzing the second query request according to the query range of the condition variable, and determining the table body data corresponding to the table head data; and displaying the target report according to the header data of the target report and the table body data corresponding to the header data.
According to the method for generating the database report, a business relation table is generated according to the table name and the identification of the data table in the database; the business relation table is used for expressing the business logic relation of the business data; and acquiring a data structure of the first business data according to the business relation table, wherein the data structure is used for determining the storage position of the first business data, so that a basis is provided for acquiring a subsequent target report, a large amount of post modification work on a report header and SQL (structured query language) statements can be reduced, the report generation efficiency is improved, and the labor and time cost are saved.
Accordingly, on the basis of any of the above embodiments, the method further comprises:
periodically acquiring the generation state of a data table in a database, and judging whether a new data table is generated in a preset period;
and if so, updating the business logic relation of the business data in the business relation table according to the table name and the identification of the new data table.
In this embodiment, since the data structure of the first service data can be obtained according to the service relation table, the data table in the database needs to be updated periodically. Specifically, the generation state of the data table in the database may be periodically obtained, and it is determined whether a new data table is generated in a preset period, and if so, the service logic relationship of the service data in the service relationship table may be updated according to the table name and the identifier of the new data table. Specifically, the period may be set by historical experience.
According to the method for generating the database report, the generation state of the data table in the database is periodically acquired, and whether a new data table is generated in a preset period is judged; and if so, updating the business logic relation of the business data in the business relation table according to the table name and the identification of the new data table. Therefore, the business logic relation of the business data can be periodically updated, a foundation is provided for the acquisition of a subsequent target report, a large amount of post modification work on report headers and SQL statements can be reduced, the report generation efficiency is improved, and the labor and time cost is saved.
Fig. 2 is a schematic flow chart of a method for generating a database report according to a second embodiment of the present invention, where on the basis of any of the above embodiments, the data structure includes an inclusion relationship between service data and a storage location of the service data; the method comprises the following steps:
step 201, receiving a first query request, wherein the first query request comprises a first SQL statement for generating a dynamic header;
step 202, determining header data of a target report according to a first SQL statement;
step 203, receiving a second query request, where the second query request includes a query condition of the table body data, the query condition is a second SQL statement including a condition variable, and the condition variable is used to represent a storage location of the table head data;
step 204, determining the type of second service data contained in the first service data and the storage location of the second service data according to the service relation table, wherein the data structure is used for determining the storage location of the first service data;
step 205, determining a query range of the condition variable in the second SQL statement according to the type of the second service data and the storage position of the second service data;
step 206, analyzing the second query request according to the query range of the condition variable, and determining the table body data corresponding to the table head data;
and step 207, displaying the target report according to the header data of the target report and the table body data corresponding to the header data.
In this embodiment, the data structure specifically includes an inclusion relationship between the service data and a storage location of the service data, so that the second service data included in the first service data can be determined through the service relationship table, and the storage location of the second service data is determined according to the service relationship table. Correspondingly, the query range of the condition variable in the second SQL statement may be determined according to the type of the second service data and the storage location of the second service data. The second query request can be analyzed according to the query range of the condition variable, the form data corresponding to the form head data is determined, and the target report is displayed according to the form head data of the target report and the form body data corresponding to the form head data.
According to the method for generating the database report, the type of the second business data and the storage position of the second business data contained in the first business data are determined according to the business relation table, the data structure is used for determining the storage position of the first business data, and the query range of the condition variable in the second SQL statement is determined according to the type of the second business data and the storage position of the second business data, so that the determination of the query range of the condition scalar in the second SQL statement can be accurately realized, a basis is provided for acquiring a subsequent target report, a large amount of post modification work of a report header and the SQL statement can be reduced, the efficiency of generating the report is improved, and labor and time costs are saved.
Further, on the basis of any of the above embodiments, the method comprises:
receiving a first query request, wherein the first query request comprises a first SQL statement for generating a dynamic header;
determining header data of the target report according to the first SQL statement;
receiving a second query request, wherein the second query request comprises a query condition of the table body data, the query condition is a second SQL statement containing a condition variable, and the condition variable is used for representing a storage position of the table head data;
determining the type of second service data contained in the first service data and the storage position of the second service data according to the service relation table, wherein the data structure is used for determining the storage position of the first service data;
replacing the condition variable with the type and the storage position of the second service data to generate a plurality of standard query conditions;
traversing the corresponding data table according to the plurality of standard query conditions to obtain a query result corresponding to each standard query condition;
summarizing the query result corresponding to each standard query condition, and determining table body data;
and displaying the target report according to the header data of the target report and the table body data corresponding to the header data.
In this embodiment, after determining the type of the second service data and the storage location of the second service data included in the first service data according to the service relationship table, the condition variable may be specifically replaced by the type and the storage location of the second service data, so that a plurality of standard query conditions can be generated, and further, the corresponding data table can be traversed according to the plurality of standard query conditions, and a query result corresponding to each standard query condition is obtained, so that query results corresponding to the plurality of standard query conditions can be summarized, and the table body data is determined. Therefore, the target report can be generated subsequently according to the header data and the body data, and the target list is displayed.
In the method for generating a database report provided by this embodiment, a plurality of standard query conditions are generated by replacing the condition variable with the type and storage location of the second service data; traversing the corresponding data table according to the plurality of standard query conditions to obtain a query result corresponding to each standard query condition; and summarizing the query result corresponding to each standard query condition, and determining the table body data, so that the table body data can be accurately acquired, and a basis is provided for subsequently generating a target report according to the table body data and the table head data.
Fig. 3 is a schematic structural diagram of a database report generation device according to a third embodiment of the present invention, and as shown in fig. 3, the database report generation device includes:
a first query request receiving module 31, configured to receive a first query request, where the first query request includes a first SQL statement that generates a dynamic header;
the header data determining module 32 is configured to determine header data of the target report according to the first SQL statement;
a second query request receiving module 33, configured to receive a second query request, where the second query request includes a query condition of the table body data, the query condition is a second SQL statement that includes a condition variable, and the condition variable is used to indicate a storage location of the table header data;
a data structure obtaining module 34, configured to obtain a data structure of the first service data corresponding to the header data, where the data structure is used to determine a storage location of the first service data;
the query range determining module 35 is configured to determine a query range of the condition variable in the second SQL statement according to the data structure of the first service data;
the analysis module 36 is configured to analyze the second query request according to the query range of the condition variable, and determine the table body data corresponding to the table header data;
and the display module 37 is configured to display the target report according to the header data of the target report and the table body data corresponding to the header data.
The generation apparatus for a database report provided in this embodiment receives a first query request, where the first query request includes a first SQL statement for generating a dynamic header; determining header data of the target report according to the first SQL statement; receiving a second query request, wherein the second query request comprises a query condition of the table body data, the query condition is a second SQL statement containing a condition variable, and the condition variable is used for representing a storage position of the table head data; acquiring a data structure of first service data corresponding to the header data, wherein the data structure is used for determining the storage position of the first service data; determining the query range of the condition variable in the second SQL statement according to the data structure of the first business data; analyzing the second query request according to the query range of the condition variable, and determining the table body data corresponding to the table head data; and displaying the target report according to the header data of the target report and the table body data corresponding to the header data. By the method and the device for dynamically generating the target report according to the real-time change of the business type or the data, a large amount of post modification work on the report header and the SQL statement is reduced, the report generation efficiency is improved, and the labor cost and the time cost are saved.
Further, on the basis of any one of the above embodiments, the apparatus further includes:
the generating module is used for generating a business relation table according to the table name and the identification of the data table in the database; the business relation table is used for expressing the business logic relation of the business data;
correspondingly, the data structure obtaining module includes:
and the data structure acquisition unit is used for acquiring the data structure of the first service data according to the service relation table.
Further, on the basis of any of the above embodiments, the data structure includes an inclusion relationship between the service data and a storage location of the service data;
correspondingly, the data structure obtaining module includes:
the storage position determining unit is used for determining the type of the second service data contained in the first service data and the storage position of the second service data according to the service relation table;
correspondingly, the query range determination module comprises:
and the query range determining unit is used for determining the query range of the condition variable in the second SQL statement according to the type of the second service data and the storage position of the second service data.
Further, on the basis of any of the above embodiments, the query range determining unit is specifically configured to:
replacing the condition variable with the type and the storage position of the second service data to generate a plurality of standard query conditions;
correspondingly, the parsing module comprises:
the query result acquisition unit is used for traversing the corresponding data table according to the plurality of standard query conditions and acquiring the query result corresponding to each standard query condition;
and the summarizing unit is used for summarizing the query result corresponding to each standard query condition and determining the table body data.
Further, on the basis of any one of the above embodiments, the apparatus further includes:
the generation state acquisition module is used for periodically acquiring the generation state of the data table in the database and judging whether a new data table is generated in a preset period;
and the updating module is used for updating the business logic relation of the business data in the business relation table according to the table name and the identification of the new data table if the result is positive.
Fig. 4 is a schematic structural diagram of a database report generation device according to a fourth embodiment of the present invention, and as shown in fig. 4, the database report generation device includes: a memory 41, a processor 42;
a memory 41; a memory 41 for storing instructions executable by the processor 42;
wherein the processor 42 is configured to execute the method for generating a database report provided in any one of the above embodiments by the processor 42;
the generation device of the database report further comprises a communication interface 43.
Yet another embodiment of the present invention provides a computer-readable storage medium, in which computer-executable instructions are stored, and the computer-executable instructions are executed by a processor to implement the method for generating a database report according to any one of the above embodiments.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus described above may refer to the corresponding process in the foregoing method embodiment, and is not described herein again.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for generating a database report is characterized by comprising the following steps:
receiving a first query request, wherein the first query request comprises a first SQL statement for generating a dynamic header; the first SQL statement is obtained by assembling a table head pseudo SQL statement by using condition variables to match with a plurality of business and index attribute tables;
determining header data of the target report according to the first SQL statement; the header data is obtained by abstracting the first SQL statement; header data is carried in a header result set;
receiving a second query request, wherein the second query request comprises a query condition of the table body data, the query condition is a second SQL statement containing a condition variable, and the condition variable is used for representing a storage position of the table head data;
acquiring a data structure of first service data corresponding to the header data, wherein the data structure is used for determining the storage position of the first service data;
determining the query range of the condition variable in the second SQL statement according to the data structure of the first business data;
analyzing the second query request according to the query range of the condition variable, and determining the table body data corresponding to the table head data; the table body data is obtained by circularly taking data from a table head result set, replacing the table head data in the pseudo SQL statement and analyzing the table head data into a standard SQL statement;
and displaying the target report according to the header data of the target report and the table body data corresponding to the header data.
2. The method of claim 1, wherein before obtaining the data structure of the first service data corresponding to the header data, the method further comprises:
generating a business relation table according to the table name and the identification of the data table in the database; the business relation table is used for expressing the business logic relation of the business data;
correspondingly, the obtaining of the data structure of the first service data corresponding to the header data includes:
and acquiring a data structure of the first service data according to the service relation table.
3. The method of claim 2, wherein the data structure comprises a containment relationship between the service data and a storage location of the service data;
correspondingly, the obtaining of the data structure of the first service data corresponding to the header data includes:
determining the type of second service data contained in the first service data and the storage position of the second service data according to the service relation table;
correspondingly, the determining the query range of the condition variable in the second SQL statement according to the data structure of the first business data includes:
and determining the query range of the condition variable in the second SQL statement according to the type of the second business data and the storage position of the second business data.
4. The method of claim 3, wherein determining the query range of the condition variable in the second SQL statement according to the type of the second service data and the storage location of the second service data comprises:
replacing the condition variable with the type and the storage position of the second service data to generate a plurality of standard query conditions;
correspondingly, according to the query range of the condition variable, the second query request is analyzed, and the table body data corresponding to the table head data is determined, including:
traversing the corresponding data table according to the plurality of standard query conditions to obtain a query result corresponding to each standard query condition;
and summarizing the query result corresponding to each standard query condition, and determining table body data.
5. The method according to any one of claims 2-4, further comprising:
periodically acquiring the generation state of a data table in a database, and judging whether a new data table is generated in a preset period;
and if so, updating the business logic relation of the business data in the business relation table according to the table name and the identification of the new data table.
6. An apparatus for generating a database report, comprising:
the first query request receiving module is used for receiving a first query request, wherein the first query request comprises a first SQL statement for generating a dynamic header; the first SQL statement is obtained by assembling a table head pseudo SQL statement by using condition variables to match with a plurality of business and index attribute tables;
the header data determining module is used for determining header data of the target report according to the first SQL statement; the header data is obtained by abstracting the first SQL statement; header data is carried in a header result set;
the second query request receiving module is used for receiving a second query request, the second query request comprises a query condition of the table body data, the query condition is a second SQL statement containing a condition variable, and the condition variable is used for representing the storage position of the table head data;
the data structure acquisition module is used for acquiring a data structure of first service data corresponding to the header data, and the data structure is used for determining the storage position of the first service data;
the query range determining module is used for determining the query range of the condition variable in the second SQL statement according to the data structure of the first business data;
the analysis module is used for analyzing the second query request according to the query range of the condition variable and determining the table body data corresponding to the table head data; the table body data is obtained by circularly taking data from a table head result set, replacing the table head data in the pseudo SQL statement and analyzing the table head data into a standard SQL statement;
and the display module is used for displaying the target report according to the header data of the target report and the table body data corresponding to the header data.
7. The apparatus of claim 6, further comprising:
the generating module is used for generating a business relation table according to the table name and the identification of the data table in the database; the business relation table is used for expressing the business logic relation of the business data;
correspondingly, the data structure obtaining module includes:
and the data structure acquisition unit is used for acquiring the data structure of the first service data according to the service relation table.
8. The apparatus of claim 7, wherein the data structure comprises a containment relationship between the service data and a storage location of the service data;
correspondingly, the data structure obtaining module includes:
the storage position determining unit is used for determining the type of the second service data contained in the first service data and the storage position of the second service data according to the service relation table;
correspondingly, the query range determination module comprises:
and the query range determining unit is used for determining the query range of the condition variable in the second SQL statement according to the type of the second service data and the storage position of the second service data.
9. An apparatus for generating a database report, comprising: a memory, a processor;
a memory; a memory for storing the processor-executable instructions;
wherein the processor is configured to perform the method of generating a database report of any of claims 1-5 by the processor.
10. A computer-readable storage medium having stored thereon computer-executable instructions for implementing the method of generating a database report according to any one of claims 1-5 when executed by a processor.
CN201910032543.4A 2019-01-14 2019-01-14 Database report generation method, device, equipment and readable storage medium Active CN109857756B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910032543.4A CN109857756B (en) 2019-01-14 2019-01-14 Database report generation method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910032543.4A CN109857756B (en) 2019-01-14 2019-01-14 Database report generation method, device, equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN109857756A CN109857756A (en) 2019-06-07
CN109857756B true CN109857756B (en) 2021-08-17

Family

ID=66894737

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910032543.4A Active CN109857756B (en) 2019-01-14 2019-01-14 Database report generation method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN109857756B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110489414A (en) * 2019-07-23 2019-11-22 中国平安人寿保险股份有限公司 Report method for pushing and equipment
CN111177231B (en) * 2019-12-20 2023-09-22 中国建设银行股份有限公司 Report generation method and report generation device
CN112699111B (en) * 2020-12-31 2022-06-28 新奥数能科技有限公司 Report generation method and device, electronic equipment and computer readable medium
CN113268500B (en) * 2021-06-08 2023-06-02 中国联合网络通信集团有限公司 Service processing method and device and electronic equipment
CN113486066B (en) * 2021-07-15 2023-03-24 福建博思软件股份有限公司 Method and terminal for hierarchically summarizing report forms
CN113806592B (en) * 2021-09-14 2024-05-28 北京天健源达科技股份有限公司 Processing method of electronic medical record display data

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101667171A (en) * 2009-09-15 2010-03-10 金蝶软件(中国)有限公司 Method for generating report and report generating device
CN104123394A (en) * 2014-08-13 2014-10-29 中国银行股份有限公司 Method for processing report file of database
CN105260476A (en) * 2015-11-06 2016-01-20 上海熙菱信息技术有限公司 Self-defined configuration method and system for reports
KR20170088466A (en) * 2016-01-22 2017-08-02 서울대학교산학협력단 A method of partial matching for graph data

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104346377B (en) * 2013-07-31 2017-08-08 克拉玛依红有软件有限责任公司 A kind of data integration and transfer method based on unique mark

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101667171A (en) * 2009-09-15 2010-03-10 金蝶软件(中国)有限公司 Method for generating report and report generating device
CN104123394A (en) * 2014-08-13 2014-10-29 中国银行股份有限公司 Method for processing report file of database
CN105260476A (en) * 2015-11-06 2016-01-20 上海熙菱信息技术有限公司 Self-defined configuration method and system for reports
KR20170088466A (en) * 2016-01-22 2017-08-02 서울대학교산학협력단 A method of partial matching for graph data

Also Published As

Publication number Publication date
CN109857756A (en) 2019-06-07

Similar Documents

Publication Publication Date Title
CN109857756B (en) Database report generation method, device, equipment and readable storage medium
CN112328489B (en) Test case generation method and device, terminal equipment and storage medium
CN109710220B (en) Relational database query method, relational database query device, relational database query equipment and storage medium
CN114064601B (en) Storage process conversion method, device, equipment and storage medium
CN113360519A (en) Data processing method, device, equipment and storage medium
CN111427784B (en) Data acquisition method, device, equipment and storage medium
CN111026670A (en) Test case generation method, test case generation device, and storage medium
WO2021012861A1 (en) Method and apparatus for evaluating data query time consumption, and computer device and storage medium
CN113806429A (en) Canvas type log analysis method based on large data stream processing framework
CN115237947A (en) SQL database optimization processing method and device, intelligent terminal and medium
CN118467644A (en) SQL SERVER database transaction log analysis DDL operation method, device, equipment and medium
CN110704472A (en) Data query statistical method and device
CN114185791A (en) Method, device and equipment for testing data mapping file and storage medium
CN114168613A (en) Audit analysis method, system, device and medium based on operator combination operation
CN116578585B (en) Data query method, device, electronic equipment and storage medium
CN112948419A (en) Query statement processing method and device
CN117171364A (en) Operation and maintenance knowledge graph updating method and device
CN108399196B (en) Automatic sql execution method and system of database sql statement automatic generation tool
CN115757479A (en) Database query optimization method, machine-readable storage medium and computer device
CN115577085A (en) Processing method and equipment for table question-answering task
CN113268487B (en) Data statistical method, device and computer readable storage medium
CN107622070B (en) Database management method and device
CN112667632B (en) Metadata processing method and device
CN114328572A (en) Data query method, device, system and medium based on SQL parser
CN113064914A (en) Data extraction method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant