Method and system for automatically generating interface based on data model and page layout

Through the automatic generation interface method based on data model and page layout, the problem that low-code platforms are difficult to build pages and generate interfaces in complex business scenarios is solved, and interface definition is automated, and development efficiency and system maintainability are improved.

CN119248244APending Publication Date: 2025-01-03ZHONGKE MEILUO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411103887.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

In complex business scenarios, it is difficult for low-code platforms to build pages and generate interfaces at the same time, resulting in frequent communication between page builders and interface developers, which consumes a lot of time and resources.

Method used

By automatically generating interfaces based on data model and page layout, the entity of the business data model is designed, the fields of page components and target entities are bound, and the interface definition is generated according to the interface specification, manual intervention is reduced, and interface requests are automatically sent to the backend. Generate interface.

Benefits of technology

It realizes automatic generation of interface definitions, reduces communication costs between developers, improves development efficiency and accuracy, reduces system development costs, and improves system maintainability and scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248244A_ABST
    Figure CN119248244A_ABST
Patent Text Reader

Abstract

The invention discloses a method and system for automatically generating an interface based on a data model and page layout, and the method comprises the following steps: designing entities of various business data models based on business information, the entities being a table relation set; binding with a target entity corresponding to the business when the page is established, and mutually binding the component with a field of a required table in the target entity; and based on the established page, obtaining a page layout, a target entity and a predefined interface specification, and generating an interface definition. Through the mapping relation between the data model and the page layout, automatic generation of the interface definition is achieved, the requirement for manual intervention is reduced, and the development efficiency and accuracy are improved; and the communication cost between the page builder and the interface developer is also reduced by automatically generating the interface definition, and the communication error is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of low-code, and in particular relates to a method and system for automatically generating an interface based on a data model and a page layout. Background Art

[0002] A bs (browser-server) architecture system contains two end programs, among which the b (browser) end is mainly responsible for data entry and display, and the s (server) end is responsible for data storage and reading. One of the two ends runs in the user's computer (browser) (front end), and the other runs in the service provider (server) (back end). The two ends are connected through the network, and the data is sent, received and processed through the network. The most commonly used protocol in the bs architecture is the http protocol. The function provider developed based on the http protocol that can interact with data and runs on the server is the interface, and the interface format definition is the description of the interface, such as the interface url (unique interface identifier), request parameters, response parameters, etc. Therefore, to build a system, you need to build both the front-end and back-end programs at the same time. The data exchange between the two programs depends on the interface definition for data format definition.

[0003] There are two modes of low-code platforms. One is to generate interface implementation (backend) while building the page (frontend). The interface format is uniformly defined by the system, and the page builder does not need to care about it. Generally, this method can be used to build simpler pages, but the actual business is complex and changeable. Low-code cannot and does not need to support all business scenarios. Therefore, when it comes to complex business scenarios, it is not possible to build the page and generate the interface implementation at the same time. Therefore, the other is that the low-code platform provides the function of data source management, only builds the page, and does not implement the interface definition. The interface developer provides the interface implementation (usually the developer of the company to which the builder belongs). Because the interface is developed by the interface developer and the page is built through the low-code platform, a data source management function is provided here, which manages the definition of the interface. When building the page, when you need to interact with the backend for data, you need to define the interface in the data source management first, including url, request parameters, response parameters, etc. Then use this interface definition when building the page, and develop the implementation of this interface definition yourself. After the page is built and the interface is developed, the page can call the interface and interact with the backend for data. During this process, page builders and interface developers need to communicate frequently about the interface format, which consumes a lot of communication time, so efficiency is greatly reduced. Summary of the invention

[0004] In view of the above problems, the technical solution adopted by the present invention is: a method for automatically generating an interface based on a data model and a page layout, the method comprising the following steps:

[0005] Design entities of various business data models based on business information, where the entities are sets of table relationships;

[0006] When building a page, bind it to the target entity corresponding to the business, and bind the component to the fields of the required table in the target entity;

[0007] Obtain the page layout, target entity and pre-defined interface specifications based on the constructed page, and generate interface definitions;

[0008] Generate an interface request method according to the interface definition, and send an interface request to the backend application;

[0009] The backend application generates an interface according to the interface definition.

[0010] Optionally, the step of designing entities of various business data models based on the business information specifically includes:

[0011] Classify the data based on the categories of the business information, and create tables within the entity based on the data of each category;

[0012] Establish association relationships between tables, including one-to-one, one-to-many, and many-to-one association relationships.

[0013] Optionally, when building the page, binding with the target entity corresponding to the business and binding the component with the fields of the required table in the target entity specifically includes:

[0014] When building the page, bind it to the target table in the target entity corresponding to the business;

[0015] Determine whether the bound target table has other associated tables;

[0016] If so, bind the components in the page to the required fields, where the field selection range is the target table and other tables associated with the target table.

[0017] Optionally, the method further comprises the following steps:

[0018] Determine whether the scope of the fields bound to the page is a single table;

[0019] If it is a single table, determine whether the table has a generated interface;

[0020] If yes, the current page is automatically bound to the interface and the interface information is updated;

[0021] If not, regenerate the interface and bind it to the table.

[0022] Optionally, the method further comprises the following steps:

[0023] Determine whether the scope of the fields bound to the page is multiple tables;

[0024] If there are multiple tables, determine whether there are generated interfaces for the multiple tables;

[0025] If there is only one, choose to bind to the interface and update the interface information, or regenerate the interface;

[0026] If there are multiple interfaces, you can select one of them to bind and update the interface information, or regenerate the interface;

[0027] If there is no generated interface, regenerate the interface and bind it to the multiple tables.

[0028] Optionally, the step of binding the components in the page with the required fields specifically includes:

[0029] If it is determined that the bound target table has other associated tables, all fields in the target table and other associated tables will be displayed;

[0030] The form components and fields in the table are quickly configured based on the user's selection, and the configuration content includes the form type, component title, and component type.

[0031] Optionally, the method further comprises the following steps:

[0032] Predefine the logos and interface types corresponding to different page layouts;

[0033] When the page is built, the interface type generated by the current page is transmitted to the backend based on the page layout identifier.

[0034] Optionally, the interface specification includes: form type, field request parameters, and field return parameters.

[0035] And, a system for automatically generating an interface based on a data model and a page layout, the system comprising:

[0036] Entity management module: used to design entities of various business data models based on business information, where the entity is a collection of table relationships;

[0037] Page building module: used to drag and drop components to build pages according to requirements, and also used to bind page components to the fields of the required tables in the target entity corresponding to the business;

[0038] Interface generation module: used to obtain the page layout, target entity and pre-defined interface specifications of the page built in the page building module, and generate an interface definition; it is also used to generate an interface request method according to the interface definition and send an interface request to the back-end application, and the back-end application generates an interface according to the interface definition.

[0039] By adopting the above technical scheme, the present invention has the following beneficial effects: through the mapping relationship between the data model and the page layout, the automatic generation of the interface definition is realized, the need for manual intervention is reduced, and the development efficiency and accuracy are improved; the communication cost between the page builder and the interface developer is also reduced by automatically generating the interface definition, the communication error is reduced, the development progress is accelerated, and the development cost of the entire system can be effectively reduced, and human resources and time costs are saved; the interface definition is generated based on a unified data model and page layout, which is beneficial to the overall architecture and maintenance of the system, reduces the complexity of the system, and improves the maintainability and extensibility of the system.

[0040] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0042] Figure 1 A flow chart of a method for automatically generating a page interface according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0044] like Figure 1 As shown, the method for automatically generating an interface based on a data model and a page layout according to an embodiment of the present invention comprises the following steps:

[0045] S1: Design entities of various business data models based on business information, where the entities are sets of table relationships;

[0046] On the configuration page of the data model entity on the front end, users can create and maintain data models by adding entities and tables. Users can classify data based on the categories of the business information, and create tables in the entity based on the data of each category. The information configured for each table includes table name, table display name, category, field name, field display name, field type, association relationship, and query index configuration. Taking the salary entity as an example, data classification can be divided into categories such as employee basic information, social security information, unit information, and salary composition information. Therefore, multiple tables can be created based on the above categories, with table display names such as employee basic information table, social security information table, unit information table, and salary composition information table.

[0047] As described above, when configuring the information of the table, an association relationship between the tables can be established, and the association relationship includes one-to-one, one-to-many and many-to-one. Among them, one-to-one refers to the main table and the sub-table associated with the main table, which is used to describe a one-to-one data relationship. For example, a one-to-one relationship can be established between a user table and an ID card information table, and each user corresponds to only one ID card information; one-to-many refers to the main table and the sub-table associated with the main table, which is used to describe a one-to-many data relationship, in which one main table record corresponds to multiple sub-table records. For example, a one-to-many relationship can be established between an order table and an order details table, and one order can correspond to multiple order details; many-to-one refers to a sub-table and its associated main table, which is used to describe the data relationship between multiple sub-table records and one main table record. For example, a many-to-one relationship can be established between an order details table and an order table, and multiple order details correspond to one order.

[0048] In the data model, a table can maintain multiple table relationships of different types to meet the needs of page layout.

[0049] S2: When building the page, bind it to the target entity corresponding to the business, and bind the component to the fields of the required table in the target entity. Specifically, it includes the following steps:

[0050] S201: Binding to a target table in a target entity corresponding to the business when building a page;

[0051] S202: Determine whether the bound target table has other associated tables; if yes, and the current component is a form component, execute step S203;

[0052] S203: Bind the form component in the page with the required fields, where the field selection range is the target table and other tables associated with the target table. In actual applications, all fields in the target table and other associated tables are displayed; based on the user's selection, the form component and the fields in the table are quickly configured, and the configuration content includes the form type, component title, and component type.

[0053] In this embodiment, after selecting the desired target table, the form type of the current page is configured, including adding, editing, details, etc. After the target table and form type configuration are completed, the data field selection configuration is performed, and the fields are displayed in a list with the corresponding table display name as a distinction. When a field in the list is selected, the field display name, component title, and component type corresponding to the field are brought out and configured and bound, thereby completing the quick configuration of the form information. Among them, the component title is the name displayed by the current component on the page, which is generally consistent with the field display name by default, and can be modified on the quick configuration page; the component type is the input method of the field on the page, such as input box, drop-down selection, time and date, etc. The component type is generally configured in advance when designing the field. When the field is selected, it is displayed by default as the previously configured component type, and can be modified on the quick configuration page.

[0054] In some other embodiments, configurations of other components are also included, such as a pie chart component, a bar chart component, etc. in a chart component.

[0055] S3: The interface deduction engine obtains the page layout based on the constructed page, the data model corresponding to the target entity, and the pre-defined interface specifications, and generates the interface definition.

[0056] Page layout refers to the process of designing a page through a low-code tool. Users can configure different components to assemble together and finally display the page structure to the user. In this embodiment, the design of page layout can be divided into the following main categories:

[0057] Form: A form is a combination of fields for inputting and displaying data. It is usually used to submit or edit data. Users can add various input fields in the form, such as text boxes, drop-down boxes, radio buttons, check boxes, etc., so that users can enter or select corresponding data.

[0058] Form + Grouping: This page structure groups related fields to help organize and present data. Users can put related fields in the same group to better organize and present data.

[0059] Form + Tab + Subform: This page structure displays different subforms by switching tabs. It is suitable for situations where there are multiple subforms, each of which can contain different fields and logic.

[0060] Form + Table: This page structure displays data in a table format, making it easy to view and compare multiple data items. Users can display multiple fields in the table and can sort, filter, and perform other operations on the table.

[0061] Form + Tab + Table: This page structure displays different table data by switching tabs. It is suitable for situations where multiple tables are included, and each table can display a different set of data.

[0062] Charts: Charts are used to visualize data and help users understand data information more intuitively. Users can choose different types of charts, such as line charts, bar charts, pie charts, etc., to show the trend and distribution of data.

[0063] Under each category, the page structure can contain other types of components, such as buttons, links, text, etc., to meet the user's needs for the page. By configuring different components and page structures, users can design pages that meet their requirements based on their business logic and data display needs. This can improve development efficiency and enable users to quickly build pages that meet their needs.

[0064] The identifiers and interface types corresponding to different page layouts are pre-defined. When the page is built, the interface type generated by the current page is transmitted to the backend based on the identifier of the page layout, so as to generate backend interface codes of different specifications.

[0065] The interface specification includes the conventional business logic when generating the interface including the above-mentioned form type and field request parameters, field return parameters, request method, etc., so as to generate the actual code.

[0066] S4: Generate an interface request method according to the interface definition, and send an interface request to the backend application.

[0067] S5: The backend application generates an interface according to the interface definition.

[0068] Embodiment 2

[0069] The difference from the first embodiment is that before generating the interface, it is necessary to determine whether there is a page that has used the table bound to the current page to generate the same type of interface, which specifically includes the following steps:

[0070] S01: Determine whether the scope of the fields bound to the page is a single table or multiple tables;

[0071] S02: If it is a single table, determine whether the table has a generated interface; if so, the current page is automatically bound to the interface and the interface information is updated, and in actual application, no pop-up window is required for user confirmation or selection; if not, a new interface is added based on the steps in Example 1 and bound to the table, and no pop-up window is required for user confirmation or selection.

[0072] S03: If there are multiple tables, determine whether there are generated interfaces for the multiple tables; if there is only one, there are two options, one is to bind with the interface and update the interface information, and the other is to regenerate the interface, that is, to add a new interface, and provide the user with a pop-up window for selection; if there are multiple tables, you can choose one of the interfaces to bind and update the interface information, or regenerate the interface; if there is no generated interface, add a new interface and bind it to the multiple tables.

[0073] As mentioned above, when multiple tables are used and interfaces have been generated based on these multiple tables, a window will pop up for the user to select. When multiple interfaces have been generated for the same component on the same page, and the table where the currently selected field is located is different from the table where the previously selected field is located, the optional interface associated with the entity will be displayed in the window based on the bound entity.

[0074] After the interface is generated, the interface needs to be associated with the entity bound to the page to which it belongs. In this embodiment, an interface summary page is provided, and the generated interface automatically enters the page, and the interface is classified and displayed by the associated entity. In each entity, the table to which the field bound to the corresponding component of the interface belongs is classified and displayed. For example, the tables corresponding to the components in all pages of the application salary entity are single tables and multiple tables. There are two types of single tables, namely: employee basic information table, salary composition information table; there are two types of two tables, namely: employee basic information table and social security information table, unit information table and salary composition information table; there is one type of three tables, namely: social security information table, unit information table and salary composition information table. It is divided into 5 categories in the classification display. And the interface under the single table category is generally named according to the component type and form type, such as pie chart interface, new interface 1, new interface 2, query interface, etc.

[0075] Embodiment 3

[0076] The difference between the above embodiments is that in embodiments one and two, the back-end application generates a default interface implementation based on the interface definition data only for some simple scenarios. If the default implementation cannot meet the business scenario, the automatically generated interface code can be modified without modifying the interface definition. In this way, the front-end initiates an interface request, and the back-end receives the request and performs corresponding business processing. There is no need for repeated communication between the page builder and the interface developer about the interface definition, which greatly reduces the time cost involved in the interface definition.

[0077] In this embodiment, a service arrangement button is provided on each automatically generated interface information page, and the user enters the interface editing page by clicking the service arrangement button.

[0078] Embodiment 4

[0079] Based on the above embodiments 1, 2, and 3, an embodiment of the present invention further provides a system for automatically generating an interface based on a data model and a page layout, including:

[0080] Entity management module: used to design entities of various business data models based on business information, and the entity is a collection of table relationships. Specifically, it provides entity creation and table creation buttons, which are displayed as new entity and new table on the page respectively. Users can create entities by clicking the new entity button. On the entity creation page, click the new table to configure the table, and configure the table information such as table name, table display name, category, field name, field display name, field type, association relationship and query index configuration in the form of a table.

[0081] Page building module: used to drag and drop components to build pages according to requirements, and also used to bind page components to the fields of the required tables in the target entity corresponding to the business. After the information configuration of the required entity is completed, the user can design and build the page through the various components provided in the page building module. After dragging the component to the page to be designed, a quick configuration button is provided. Click the quick configuration button and the user needs to complete the binding steps of the current page with the required entity and the table in the entity. The details are as described in the above embodiment one and will not be repeated here.

[0082] The interface generation module is used to obtain the page layout, target entity and predefined interface specifications of the page built in the page building module, and generate an interface definition; it is also used to generate an interface request method according to the interface definition, and send an interface request to the back-end application, and the back-end application generates an interface according to the interface definition. The specific steps of the interface generation module to generate the interface are as described in the above-mentioned embodiment 1 and embodiment 2, and will not be repeated here.

[0083] Interface management module: After the interface is generated, it is automatically synchronized to the interface management module. The interface is classified and displayed hierarchically based on the associated entity, table, component type and other information, so that users can query the required interface after the interface is generated. On each interface information page, a service orchestration button is provided, and users can click the service orchestration button to enter the interface editing page.

[0084] The above is only a preferred embodiment of the present invention, and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technician familiar with this profession can make some changes or modifications to equivalent embodiments of equivalent changes using the technical contents disclosed above without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention still fall within the scope of the technical solution of the present invention.

Claims

1. A method for automatically generating an interface based on a data model and a page layout, characterized in that: The method comprises the following steps: Design entities of various business data models based on business information, where the entities are sets of table relationships; When building a page, bind it to the target entity corresponding to the business, and bind the component to the fields of the required table in the target entity; Obtain the page layout, target entity and pre-defined interface specifications based on the constructed page, and generate interface definitions; Generate an interface request method according to the interface definition, and send an interface request to the backend application; The backend application generates an interface according to the interface definition.

2. The method for automatically generating an interface based on a data model and a page layout according to claim 1, characterized in that: The steps of designing entities of various business data models based on business information specifically include: Classify the data based on the categories of the business information, and create tables within the entity based on the data of each category; Establish association relationships between tables, including one-to-one, one-to-many, and many-to-one association relationships.

3. The method for automatically generating an interface based on a data model and a page layout according to claim 1, characterized in that: The steps of binding the target entity corresponding to the business when building the page and binding the component to the fields of the required table in the target entity include: When building the page, bind it to the target table in the target entity corresponding to the business; Determine whether the bound target table has other associated tables; If so, bind the components in the page to the required fields, where the field selection range is the target table and other tables associated with the target table.

4. The method for automatically generating an interface based on a data model and a page layout according to claim 1, characterized in that: The method further comprises the following steps: Determine whether the scope of the fields bound to the page is a single table; If it is a single table, determine whether the table has a generated interface; If yes, the current page is automatically bound to the interface and the interface information is updated; If not, regenerate the interface and bind it to the table.

5. The method for automatically generating an interface based on a data model and a page layout according to claim 1, characterized in that: The method further comprises the following steps: Determine whether the scope of the fields bound to the page is multiple tables; If there are multiple tables, determine whether there are generated interfaces for the multiple tables; If there is only one, choose to bind to the interface and update the interface information, or regenerate the interface; If there are multiple interfaces, you can select one of them to bind and update the interface information, or regenerate the interface; If there is no generated interface, regenerate the interface and bind it to the multiple tables.

6. The method for automatically generating an interface based on a data model and a page layout according to claim 3, characterized in that: The step of binding the components in the page with the required fields specifically includes: If it is determined that the bound target table has other associated tables, all fields in the target table and other associated tables will be displayed; The form components and fields in the table are quickly configured based on the user's selection, and the configuration content includes the form type, component title, and component type.

7. The method for automatically generating an interface based on a data model and a page layout according to claim 1, characterized in that: The method further comprises the following steps: Predefine the logos and interface types corresponding to different page layouts; When the page is built, the interface type generated by the current page is transmitted to the backend based on the page layout identifier.

8. The method for automatically generating an interface based on a data model and a page layout according to claim 1, characterized in that: The interface specification includes: form type, field request parameters, and field return parameters.

9. A system for automatically generating an interface based on a data model and a page layout, characterized in that: The system comprises: Entity management module: used to design entities of various business data models based on business information, where the entity is a collection of table relationships; Page building module: used to drag and drop components to build pages according to requirements, and also used to bind page components to the fields of the required tables in the target entity corresponding to the business; Interface generation module: used to obtain the page layout, target entity and pre-defined interface specifications of the page built in the page building module, and generate an interface definition; it is also used to generate an interface request method according to the interface definition and send an interface request to the back-end application, and the back-end application generates an interface according to the interface definition.