Dynamic table generation method based on XML format

Through the dynamic table generation method based on XML format, the problems of low development efficiency and poor code reusability of traditional CRUD are solved, and the functions of quickly generating query pages and data export are realized, the development efficiency and code reusability are improved, and the rapid demand changes are adapted to the rapid demands .

CN118939254APending Publication Date: 2024-11-12ZHUHAI XINDEHUI INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410964411.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-18
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

In the development of business systems in the public safety industry, the traditional CRUD development model is inefficient and poor code reusability, resulting in waste of human resources and the inability to respond quickly to changes in demand.

Method used

Adopt dynamic table generation method based on XML format, and configure data sources and generate front-end back-end code with one click through front-end brief table components, back-end brief table XML parsing engine and code generation tools. It supports multiple data sources and custom SQL to achieve fast Generate query pages and data export functions.

Benefits of technology

It simplifies the development process, improves code reuse rate and personnel work efficiency, reduces employment costs, and supports multiple data sources and custom queries to adapt to rapid changes in demand.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939254A_ABST
    Figure CN118939254A_ABST
Patent Text Reader

Abstract

The invention discloses a dynamic table generation method based on an XML (Extensible Markup Language) format, which is based on a front-end simple table component, a rear-end simple table xml (Extensible Markup Language) parsing engine and a code generation tool, and comprises the following steps: S1, configuring a data source in the code generation tool; s2, starting a code generation tool and inputting a table name to be queried; s3, the code generation tool generates front and rear end codes through one key according to the table name; s4, a back-end simple list xml analysis engine quickly generates a query page through xml configuration; s5, calling an xml configuration file analysis interface of a rear-end simple list xml analysis engine by the front-end simple list component, so that the rear-end simple list xml analysis engine reads xml according to the specified simple list id, packages the xml into an object and returns the object to the front-end simple list component; s6, the front-end simple list component performs analysis rendering according to a returned result; and S7, calling a data query interface of the back-end simple table xml analysis engine by the front-end simple table component to obtain the data, and displaying the data. According to the method, the development process is simplified, the code reuse rate is improved, the working efficiency of personnel is improved, and the labor cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of table generation, and in particular to a dynamic table generation method based on XML format. Background Art

[0002] In the public security industry, almost all business systems are inseparable from data query tables. When faced with a variety of business systems, if the traditional development model is followed, at least one front-end and one back-end are required to spend one day to complete the CRUD development of a simple page. The process is boring, the code utilization rate is low, and the efficiency is low. In the case of tight personnel resources, this is undoubtedly a waste of manpower.

[0003] In order to solve this problem, the traditional approach is to write js, css and html according to the requirements on the front end, customize and develop CRUD interfaces on the back end according to the requirements, and then connect the front and back ends to the joint debugging interface. Although this technical means can meet the needs and solve user problems to a certain extent, the design idea of ​​this solution does not consider issues such as efficiency, code reusability, and development costs. It only customizes and develops according to the needs of product managers, which has certain disadvantages: first, the code reuse rate is low, it is not universal, the efficiency is low, and human resources are wasted; second, it is not flexible enough and cannot adapt to changes in demand. Once the demand changes, it has to be hard-coded again, which cannot meet the requirements of rapid response. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a dynamic table generation method based on XML format, which not only simplifies the development process and improves the reuse rate of codes, but also improves the work efficiency of personnel and reduces the employment cost.

[0005] In order to solve the above technical problems, the technical solutions adopted by the present invention are as follows.

[0006] A method for generating a dynamic table based on XML format is based on a front-end simple table component, a back-end simple table XML parsing engine and a code generation tool, and includes the following steps: S1. configuring a data source in the code generation tool; S2. starting the code generation tool and inputting a table name to be queried; S3. the code generation tool generates front-end and back-end codes according to the table name in one click; S4. the back-end simple table XML parsing engine quickly generates a query page through XML configuration; S5. the front-end simple table component calls the XML configuration file parsing interface of the back-end simple table XML parsing engine, so that the back-end simple table XML parsing engine reads XML according to a specified simple table ID and encapsulates it into an object and returns it to the front-end simple table component; S6. the front-end simple table component performs parsing and rendering according to the returned result; S7. the front-end simple table component then calls the data query interface of the back-end simple table XML parsing engine to obtain data and then displays it.

[0007] Preferably, the front-end simple table component encapsulates a table rendering component, and the front-end simple table component also encapsulates a simple table component and a dictionary component based on vue2 and element-ui.

[0008] Preferably, the back-end summary table xml parsing engine adopts jdom technology, based on a tree structure, and utilizes pure JAVA technology to parse, generate, and serialize XML documents.

[0009] Preferably, the code generation tool is based on the freemark template engine to define the front-end and back-end code structure templates; in step S3, the code generation tool generates the front-end and back-end codes in one click according to the table name, including dynamically generating xml configuration files, CRUD interfaces, and front-end view views.

[0010] Preferably, in step S4, the back-end simple table xml parsing engine abstractly defines the Mytable object according to the characteristics of the list, parses the Mytable object into an xml file through jdom, and defines a set of general xml configuration file parsing interfaces and data query interfaces; the xml file parsing interface converts the xml file into a java object for rendering the front-end simple table component; the data query interface dynamically parses the data table name tableName and column function configured in xml into SQL and returns the query result.

[0011] Preferably, the tableName supports configuration of table names, supports custom SQL, and supports dynamic acquisition of front-end parameters and built-in parameters; the back-end simple table xml parsing engine will query the database through JDBC according to the configured SQL, and finally return the query results according to the configured fields to complete the display of the data list.

[0012] Preferably, the query page in step S4 includes query conditions, display fields, query statements and data export.

[0013] Preferably, in step S6, table query conditions, display columns, and operation buttons are specifically rendered.

[0014] Due to the adoption of the above technical scheme, the technical progress achieved by the present invention is as follows.

[0015] The present invention is based on XML configuration. Developers only need to input the table name and generate the front-end and back-end codes with one click. Through XML configuration, query pages can be quickly generated, including query conditions, display fields, export functions, etc., which simplifies the development process to a certain extent, improves the code reuse rate, improves personnel work efficiency, reduces employment costs, and has a beautiful interface and unified style.

[0016] The present invention generates XML format configuration files to quickly build data query tables and data export, query and other functions, and supports multiple data source configurations and dictionary cache configurations. It is compatible with mainstream databases (such as Oracle, MySQL, PostgreSQL, etc.), supports list and card style displays, supports custom SQL and ES queries, and supports custom query adapters. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 is a flow chart of the present invention;

[0018] Figure 2 This is a screenshot of the interface of step S1 of the present invention;

[0019] Figure 3 This is a screenshot of the interface for generating front-end and back-end codes with one click in step S3 of the present invention;

[0020] Figure 4 This is a screenshot of the interface for generating an XML configuration file in step S3 of the present invention;

[0021] Figure 5 This is a screenshot of the interface of step S4 of the present invention;

[0022] Figure 6 This is a screenshot of the interface of the table dynamic rendering component of the present invention;

[0023] Figure 7 This is a screenshot of the interface of the result returned by calling the XML configuration file parsing interface in step S5 of the present invention;

[0024] Figure 8 This is a screenshot of the interface for returning the result of calling the data query interface in step S7 of the present invention;

[0025] Fig. 9 This is a screenshot of the interface after rendering and acquiring data of the present invention. DETAILED DESCRIPTION

[0026] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0027] A dynamic table generation method based on XML format, based on the front-end simple table component (simple-crud), the back-end simple table xml parsing engine (xdh-brieflist-engine) and the code generation tool (freemark template engine), wherein the front-end simple table component encapsulates a table rendering component, and the front-end simple table component also encapsulates a simple table component and a dictionary component based on vue2 and element-ui; the code generation tool is based on the freemark template engine, defines the front-end and back-end code structure templates, and dynamically generates xml configuration files, CRUD interfaces, and front-end view views according to the table name; the back-end simple table xml parsing engine mainly adopts jdom technology, based on a tree structure, and uses pure JAVA technology to parse, generate, and serialize XML documents. Combined with Figure 1 As shown, the method comprises the following steps:

[0028] S1. Configure the data source in the code generation tool, such as Figure 2 shown.

[0029] S2. Start the code generation tool and enter the table name to be queried.

[0030] S3. The code generation tool generates front-end and back-end codes based on the table name, such as Figure 3 shown.

[0031] The code generation tool generates front-end and back-end codes according to the table name, including dynamically generating XML configuration files, CRUD interfaces, and front-end view views. The screenshot of the interface for generating XML configuration files is as follows: Figure 4 shown.

[0032] S4. The back-end XML parsing engine quickly generates query pages through XML configuration, including query conditions, display fields, query statements and data export, such as Figure 5 shown.

[0033] The back-end simple table xml parsing engine abstractly defines the Mytable object according to the characteristics of the list, parses the Mytable object into an xml file through jdom, and defines a set of general xml configuration file parsing interfaces and data query interfaces; the xml file parsing interface mainly converts the xml file into a java object for rendering the front-end simple table component; the data query interface dynamically parses the data table name tableName and column function configured in xml into SQL and returns the query results. tableName supports the configuration of table names, supports custom SQL, supports dynamic acquisition of front-end parameters and built-in parameters, and has strong extensibility; the back-end simple table xml parsing engine will query the database through JDBC according to the configured SQL, and finally return the query results according to the configured fields to complete the display of the data list.

[0034] S5. The front-end profile component calls the back-end profile xml parsing engine's xml configuration file parsing interface, so that the back-end profile xml parsing engine reads the xml according to the specified profile id and encapsulates it into an object and returns the front-end profile component, such as Figure 7 shown.

[0035] S6. The front-end simple table component parses and renders according to the returned results.

[0036] Specific rendering table query conditions, display columns, operation buttons, such as Figure 6 shown.

[0037] S7. The front-end simple table component then calls the data query interface of the back-end simple table xml parsing engine to obtain data and then display it.

[0038] The screenshot of the interface that returns the result of calling the data query interface is as follows: Figure 8 As shown; the screenshot of the display interface after rendering and obtaining data is completed, as shown Fig. 9 shown.

[0039] Embodiment 1

[0040] For example, define a target table to be queried in the PostgreSQL database, with the table name SYS_USER, and then use the code generation tool to configure the data source information of the pg library and the code generation module name, author and other information. Start the code generation tool and enter the table name SYS_USER, press Enter to generate an XML configuration file containing the attribute tableName = "SYS_USER" and the table field column. By default, tableName is generated as the input table name, and of course it can also be a custom SQL, such as tableName = "(select username, name, sex, age, birth from sys_user where deleted = '0' and username = ': {user.userid}')". Then, the back-end simple table xml parsing engine will parse it into a SQL statement of select column1, column2...fromtableName according to the configured tableName and column; finally, the back-end simple table xml parsing engine will execute SQL in JDBC mode according to the data source configured before the project is started, encapsulate the query results into a ResultList object and return it to the front-end simple table component, which will then parse and render according to the results to finally complete the display of the query table.

[0041] When the present invention is used, it mainly summarizes the commonly used functions of the data query table, designs unified business components for commonly used functions, such as dictionary components (including drop-down, single-select, multiple-select, tree-shaped, pop-up windows, etc.), simple table (table or card) components, data export excel, etc., and the back-end encapsulates a unified XML parsing engine, configures the display of the page through XML configuration of default display columns, query conditions, custom column formats (such as date format, dictionary translation), and query statements, and uses a code generation tool (using the freemark template engine to generate front-end and back-end codes) to input the specified data table name according to the configured data source, and generate the front-end and back-end codes with one key, and dynamically generate data tables through simple configuration. At the same time, in addition to the default data source, XML also supports custom data sources, custom query adapters, and is compatible with mainstream relational databases (such as Oracle, MySQL, and PostgreSQL).

Claims

1. A method for generating a dynamic table based on XML format, characterized in that: Based on the front-end profile component, the back-end profile XML parsing engine and the code generation tool, the following steps are included: S1. Configure the data source in the code generation tool; S2. Start the code generation tool and enter the table name to be queried; S3. The code generation tool generates front-end and back-end codes based on the table name in one click; S4. The back-end XML parsing engine quickly generates query pages through XML configuration; S5. The front-end profile component calls the back-end profile xml parsing engine's xml configuration file parsing interface, so that the back-end profile xml parsing engine reads the xml according to the specified profile id and encapsulates it into an object and returns the front-end profile component; S6. The front-end table component parses and renders according to the returned results; S7. The front-end simple table component then calls the data query interface of the back-end simple table xml parsing engine to obtain data and then display it.

2. The method for generating a dynamic table based on XML format according to claim 1, characterized in that: The front-end simple table component encapsulates a table rendering component, and the front-end simple table component also encapsulates a simple table component and a dictionary component based on vue2 and element-ui.

3. The method for generating a dynamic table based on XML format according to claim 1, characterized in that: The back-end summary table xml parsing engine adopts jdom technology, based on tree structure, and utilizes pure JAVA technology to parse, generate and serialize XML documents.

4. The method for generating a dynamic table based on XML format according to claim 1, characterized in that: The code generation tool is based on the freemark template engine to define the front-end and back-end code structure templates; in step S3, the code generation tool generates the front-end and back-end codes in one click according to the table name, including dynamically generating XML configuration files, CRUD interfaces, and front-end view views.

5. The method for generating a dynamic table based on XML format according to claim 4, characterized in that: In step S4, the back-end simple table xml parsing engine abstractly defines the Mytable object according to the characteristics of the list, parses the Mytable object into an xml file through jdom, and defines a set of general xml configuration file parsing interfaces and data query interfaces; the xml file parsing interface converts the xml file into a java object for rendering the front-end simple table component; the data query interface dynamically parses the data table name tableName and column function configured in xml into SQL and returns the query result.

6. The method for generating a dynamic table based on XML format according to claim 5, characterized in that: The tableName supports configuring the table name, supporting custom SQL, and supporting dynamic acquisition of front-end parameters and built-in parameters; the back-end simple table xml parsing engine will query the database through JDBC according to the configured SQL, and finally return the query results according to the configured fields to complete the display of the data list.

7. The method for generating a dynamic table based on XML format according to claim 5, characterized in that: The query page in step S4 includes query conditions, display fields, query statements and data export.

8. The method for generating a dynamic table based on XML format according to claim 5, characterized in that: The step S6 specifically renders table query conditions, display columns, and operation buttons.