Application generation method, electronic device, and storage medium
By acquiring business requirements and leveraging Vue.js's component-based and responsive design features, the binding of forms and database information was achieved, solving the scalability and integration issues of the form generation tool and improving form generation efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SICHUAN LVYUANJI TECH CO LTD
- Filing Date
- 2024-12-17
- Publication Date
- 2026-06-19
AI Technical Summary
Existing form generation tools have limitations in terms of flexibility, scalability, and integration with front-end frameworks, resulting in low form development efficiency.
By obtaining the business requirements of the target application, the target form and database information are determined based on the data model. Then, by leveraging the componentization and responsive design features of Vue.js, the target form and database information are bound together to generate the target application.
It improves the efficiency and scalability of form generation, achieves seamless integration with the Vue ecosystem, and solves the scalability and integration issues of form generation tools.
Smart Images

Figure CN122240089A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and more specifically, to a method for generating applications, an electronic device, and a storage medium. Background Technology
[0002] In modern web applications, forms are a crucial method for user input and data collection. Form development involves a significant amount of repetitive work, such as manually writing HTML structures, implementing complex validation logic, and ensuring cross-browser compatibility. Traditional form development methods require developers to perform detailed coding for each form field, resulting in high repetition and low efficiency. While form generation tools can automatically generate form structures and corresponding validation logic based on predefined data models or configuration files to simplify the development process, they still have limitations in terms of flexibility, scalability, and integration with front-end frameworks.
[0003] There is currently no effective solution to the above problems. Summary of the Invention
[0004] This invention provides an application generation method, an electronic device, and a storage medium to at least solve the technical problems of low form generation efficiency and limitations in the scalability and integration of form generation tools in related technologies.
[0005] According to one embodiment of the present invention, a method for generating an application is provided, comprising: obtaining business requirements of a target application, wherein the business requirements are used to determine the functions required by the target application and the logical relationships between the functions; determining a data model of the target application based on the business requirements, wherein the data model is used to determine entity information in the business requirements and the logical relationships between entities; determining target form and database information based on the data model; and binding the target form and database information to generate the target application.
[0006] Optionally, determining the target form based on the data model includes: generating an initial form based on field information in the data model; decomposing the initial form to obtain reusable form components; and using the form components to configure a preset canvas area to determine the target form.
[0007] Optionally, determining database information based on the data model includes: determining the structure of database tables based on entity information and corresponding attribute information in the data model; and determining the logical relationships between database tables based on logical information between entities in the data model.
[0008] Optionally, binding the target form with database information to generate the target application includes: obtaining the mapping relationship between form elements in the target form and fields in the database table; binding the target form with database information based on the mapping relationship to generate the target application.
[0009] Optionally, determining the data model of the target application based on business requirements includes: obtaining entity information, attribute information corresponding to the entities, logical information between entities, and field validation rules based on business requirements; and determining the data model based on the obtained entity information, attribute information corresponding to the entities, logical information between entities, and field validation rules.
[0010] Optionally, the method further includes: providing an extension interface for the target application, wherein the extension interface includes at least one of the following: a form component registration interface for customizing form components; and a validation rule definition interface for defining validation rules.
[0011] Optionally, the method further includes: obtaining input events of the target form, wherein the input events are used to represent events triggered when input is made in the target form; validating the input events based on the validation rules of the target form to obtain a validation result; and controlling the target form to respond based on the input events in response to determining that the input events conform to the validation rules according to the validation result.
[0012] According to one embodiment of the present invention, an application generation apparatus is also provided, comprising: an acquisition module for acquiring business requirements of a target application, wherein the business requirements are used to determine the functions required by the target application and the logical relationships between the functions; a first determination module for determining a data model of the target application based on the business requirements, wherein the data model is used to determine entity information in the business requirements and the logical relationships between entities; a second determination module for determining target form and database information based on the data model; and a generation module for binding the target form and the database information to generate the target application.
[0013] Optionally, the second determining module is further configured to: generate an initial form based on field information in the data model; decompose the initial form to obtain reusable form components; and use the form components to configure a preset canvas area to determine the target form.
[0014] Optionally, the second determining module is further configured to: determine the structure of the database tables based on the entity information and the attribute information corresponding to the entities in the data model; and determine the logical relationships between the database tables based on the logical information between entities in the data model.
[0015] Optionally, the acquisition module is also used to acquire the mapping relationship between form elements in the target form and fields in the database table; the generation module is also used to bind the target form with the database information based on the mapping relationship to generate the target application.
[0016] Optionally, the acquisition module is also used to acquire entity information, attribute information corresponding to the entity, logical information between entities, and field validation rules based on business requirements; the first determination module is also used to determine the data model based on the acquired entity information, attribute information corresponding to the entity, logical information between entities, and field validation rules.
[0017] Optionally, the device further includes a processing module for providing an extension interface to the target application, wherein the extension interface includes at least one of the following: a form component registration interface for customizing form components; and a validation rule definition interface for defining validation rules.
[0018] Optionally, the acquisition module is further configured to acquire input events of the target form, wherein the input events represent events triggered when input is made in the target form; the device further includes a verification module, configured to verify the input events based on the verification rules of the target form to obtain a verification result; the device further includes a control module, configured to control the target form to respond based on the input events in response to determining that the input events conform to the verification rules according to the verification result.
[0019] According to one embodiment of the present invention, an electronic device is also provided, comprising: a memory storing an executable program; and a processor for running the program, wherein the program executes the above-described application generation method during runtime.
[0020] According to one embodiment of the present invention, a computer-readable storage medium is also provided, comprising: the computer-readable storage medium including a stored executable program, wherein, when the executable program is running, the device where the storage medium is located executes the above-described application generation method.
[0021] According to one embodiment of the present invention, a computer program product is also provided, comprising: a computer program, which, when executed by a processor, implements the above-described method for generating an application program.
[0022] In this embodiment of the invention, the business requirements of the target application are obtained, the data model of the target application is determined based on the business requirements, and the target form and database information are determined based on the data model. Finally, the target form and database information are bound together to generate the target application. By leveraging the component-based and responsive design features of Vue.js, seamless integration with the Vue ecosystem is achieved, thereby improving the efficiency of form generation and enhancing the scalability and integration of the form generation tool. This solves the technical problems of low form generation efficiency and limitations in the scalability and integration of form generation tools in related technologies. Attached Figure Description
[0023] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0024] Figure 1 This is a hardware structure block diagram of an application generation method according to one embodiment of the present invention;
[0025] Figure 2 This is a flowchart of an application generation method according to one embodiment of the present invention;
[0026] Figure 3 This is a flowchart of another application generation method according to one embodiment of the present invention;
[0027] Figure 4 This is a structural block diagram of an application generation apparatus according to one embodiment of the present invention. Detailed Implementation
[0028] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0029] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0030] The application generation method embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 This is a hardware structure block diagram of an application generation method according to one embodiment of the present invention. Figure 1 As shown, the computer terminal 10 (or electronic device 10) may include one or more processors (shown as 102a, 102b, ..., 102n in the figure) (the processor may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0031] It should be noted that the aforementioned one or more processors and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be wholly or partially embodied in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuit may be a single, independent processing module, or may be wholly or partially integrated into any other element within the computer terminal 10 (or electronic device). As involved in the embodiments of this application, the data processing circuit serves as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0032] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the application generation method in this embodiment. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the above-mentioned substation inspection method based on UAV swarm. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0033] The transmission module 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission module 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission module 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0034] The display may be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user page of the computer terminal 10 (or electronic device).
[0035] It should be noted here that, in some optional embodiments, the above... Figure 1 The computer device (or electronic device) shown may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that... Figure 1 This is only one instance of a particular specific instance, and is intended to illustrate the types of components that may exist in the aforementioned computer equipment (or electronic equipment).
[0036] According to an embodiment of the present invention, a method embodiment for generating an application is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0037] Figure 2This is a flowchart of an application generation method according to one embodiment of the present invention, such as... Figure 2 As shown, the method includes the following steps:
[0038] Step S20: Obtain the business requirements of the target application, wherein the business requirements are used to determine the functions required by the target application and the logical relationships between the functions;
[0039] In step S20, the aforementioned business requirements characterize the functionalities that the target application needs to possess, and how these functionalities interact to meet business objectives. For example, the business requirements of an e-commerce platform include user authentication, product browsing, shopping cart management, and order processing.
[0040] Step S22: Determine the data model of the target application based on business requirements, wherein the data model is used to determine the entity information and logical relationships between entities in the business requirements;
[0041] In step S22, the aforementioned data model is used to characterize the abstract representation of entity information and logical relationships between entities in business requirements. It defines the structure and organization of data in the target application, including data types, attributes, relationships, and how data is stored and accessed.
[0042] Step S24: Determine the target form and database information based on the data model;
[0043] In step S24, an element in the target form user interface is used to collect and submit user input data. This typically includes elements such as input boxes, drop-down menus, and buttons for collecting user data. For example, in web development and software applications, forms allow users to input, select, or upload information, which can be used for registering accounts, submitting feedback, searching for content, etc.
[0044] The database information mentioned above includes the database table structure, field types and constraints, and data relationships.
[0045] Specifically, the data model helps determine the types of forms required in the target application, as well as the database structure and table design. Target forms are designed based on the entity attributes and relationships defined in the data model, ensuring users can input and manage data through the forms. For example, if the data model defines a "user" entity, there might be a user registration form containing fields for entering username, password, and email address.
[0046] Step S26: Bind the target form to the database information to generate the target application.
[0047] Specifically, create the backend logic for the target application to ensure that data collected from the target form is correctly stored in the database, and that data is accurately retrieved from the database and displayed on the target table upon user request. For example, create an API using Node.js and the Express framework to receive form data, handle data validation, and store it in the database. Simultaneously, logic needs to be written to retrieve data from the database and populate the form so that users can view or edit it.
[0048] Specifically, the target application consists of two parts: a front-end and a back-end. The front-end is responsible for building the user interface using the target forms to interact with the user, while the back-end is responsible for data processing. For example, the target application might be built using the front-end framework Vue.js and back-end technologies Node.js and a database.
[0049] Furthermore, the front-end uses a data model to generate dynamic target forms. These forms support user input and employ responsive design and data binding mechanisms to ensure real-time updates and consistency. The back-end, based on the data model, implements the logic for data storage and retrieval, as well as the interface communication with the front-end, ensuring accurate data flow between the front-end and the database.
[0050] Based on steps S20 to S26 above, the business requirements of the target application are obtained. The data model of the target application is determined based on the business requirements, and the target form and database information are determined based on the data model. Finally, the target form and database information are bound together to generate the target application. By leveraging the component-based and responsive design features of Vue.js, seamless integration with the Vue ecosystem is achieved. This improves the efficiency of form generation and enhances the scalability and integration of the form generation tool, thereby solving the technical problems of low form generation efficiency and limitations in the scalability and integration of form generation tools in related technologies.
[0051] Optionally, in step S24, determining the target form based on the data model includes:
[0052] Step S241: Generate an initial form based on the field information in the data model;
[0053] In step S241, the above field information is used to characterize the fields and their attribute information in the data model, including but not limited to: field name, type, validation rules, etc.
[0054] Specifically, the form structure is defined based on the fields and their attribute information read from a data model in JSON or other formats. The form generator automatically generates the corresponding form elements and validation rules based on the data model, and constructs the initial form.
[0055] Step S242: Decompose the initial form to obtain reusable form components;
[0056] Specifically, after generating the initial form, Vue.js's component-based features are used to further decompose it into a series of reusable form components, each representing a form element. Examples include text input components, dropdown selection components, and checkbox components. Form components can receive field information from the data model as attributes, and then dynamically generate form elements and validation rules based on these attributes. Automatically generating validation rules ensures the consistency and reliability of the form validation logic, avoiding redundant implementations of validation logic.
[0057] Step S243: Configure the preset canvas area using the form component to determine the target form.
[0058] Specifically, in the preset canvas area, i.e. the application's form interface, the created form components are used to configure and place the form components according to the structure and layout requirements of the data model in order to determine the final target form.
[0059] Furthermore, the target form generated using Vue.js has a responsive design, ensuring that the target form can adapt to different display devices.
[0060] Based on steps S241 to S243 above, an initial form is generated based on the field information in the data model; the initial form is decomposed to obtain reusable form components; the form components are used to configure the preset canvas area to determine the target form; and by utilizing the componentization and responsive design features of Vue.js, integration with the Vue ecosystem is achieved, thereby improving the development efficiency of the target application.
[0061] Optionally, in step S24, determining the database information based on the data model includes:
[0062] Step S244: Determine the structure of the database tables based on the entity information and the corresponding attribute information in the data model;
[0063] In step S244, the aforementioned entities are used to represent specific objects or concepts in the business scenario, and they are typically represented as data tables in the data model. Each entity has specific attributes that describe the characteristics or state of the entity. For example, in an e-commerce application, "user," "order," and "product" are all entities, and each entity has its own attributes. The user entity has attributes such as username, password, and address.
[0064] The attribute information corresponding to the above entities is used to define the structure and constraints of the data, including but not limited to: the name of the attribute, the data type, whether null is allowed, whether there is a unique constraint, etc. In the data model, the attribute information usually appears in the form of key-value pairs.
[0065] Specifically, based on the entity information and corresponding attribute information in the data model, the mapping between entities and database tables is first determined, that is, each entity in the data model is mapped to a database table. For example, the "User" entity is mapped to the "users" table. Next, the attributes of each entity are mapped to columns in the database table. For example, the "Username" attribute of the User entity is mapped to the "username" column in the "users" table. Then, the data type and constraints of the columns are defined according to the attribute information. For example, if the attribute information indicates that the "Username" field cannot be null and must be unique, then in the database design, the "username" column should be defined as VARCHAR type, with NOT NULL and UNIQUE constraints added. Finally, for each entity, one or more primary keys are defined to uniquely identify an instance of the entity. If the relationship between entities involves references, then foreign keys also need to be defined to ensure that the reference relationship between entities is correctly represented in the database. For example, if the "Order" entity has a "UserID" field used to associate with the "User" entity, then the "UserID" column in the "Order" table should be defined as a foreign key, referencing the primary key of the "users" table.
[0066] Step S245: Based on the logical information between entities in the data model, determine the logical relationships between database tables.
[0067] In step S245, the logic between the aforementioned database tables is determined based on the logical relationships between entities, such as one-to-many or many-to-many. For example, a user can have multiple orders (one-to-many), and an order can contain multiple products (many-to-many).
[0068] Specifically, to implement a one-to-one relationship: If there is a one-to-one relationship between two entities, the primary key of the other entity is usually added as a foreign key in the table of one entity. For example, if the "Address" information of the "User" entity is a separate entity, then "User ID" can be added as a foreign key in the "Address" table, or "Address ID" can be added as a foreign key in the "User" table.
[0069] Implementation of a one-to-many relationship: In a one-to-many relationship, the "many" entity table contains a foreign key that references the primary key of the "one" entity table. For example, in a one-to-many relationship between "Users" and "Orders," the "User ID" column in the "Orders" table is a foreign key that references the primary key of the "Users" table.
[0070] Implementing many-to-many relationships: Many-to-many relationships typically require creating an association table to store the relationship between the two entities. This association table contains the primary keys of both entities as foreign keys. For example, when establishing a many-to-many relationship between "orders" and "products," an "order_products" table is created, containing two foreign keys: "order ID" and "product ID," referencing the primary keys of the "orders" and "products" tables, respectively.
[0071] Furthermore, when designing the logical relationships between database tables, data integrity and consistency must be considered. For example, foreign key constraints can be set to ensure that when one entity is deleted, the data of other related entities can be correctly processed.
[0072] Based on steps S244 and S245 above, the structure of the database tables is determined based on the entity information and corresponding attribute information in the data model; the logical relationships between the database tables are determined based on the logical information between entities in the data model. Database design based on the data model facilitates data migration and system scalability. When data needs to be migrated to other databases or systems, only the data model needs to be re-parsed to generate the corresponding new database design. Furthermore, when new functions or entities need to be added, the database design is extended simply by modifying the data model, without redesigning the database. Automated database table structure generation reduces human error and improves the reliability of data storage.
[0073] Optionally, in step S26, binding the target form with database information to generate the target application includes:
[0074] Step S261: Obtain the mapping relationship between form elements in the target form and fields in the database table;
[0075] In step S261, the above mapping relationship is used to characterize the association between each input field in the front-end target form and the corresponding field in the back-end database table. When generating a dynamic form, form elements need to be created based on the entity and attribute information in the data model, while maintaining a one-to-one correspondence between these elements and the database table fields.
[0076] Specifically, the data model typically contains mapping information between form elements and database table fields, such as field names, data types, and validation rules. A mapping table or object is created based on this mapping information, mapping the `model` or `name` attributes of form elements to field names in the database table, ensuring that each form element has a corresponding database field.
[0077] Step S262: Bind the target form to the database information based on the mapping relationship to generate the target application.
[0078] Specifically, after the mapping relationship is created, the mapping information is used for data interaction between the front end and the back end, that is, storing the data collected by the front end target form into the back end database, or displaying the data in the back end database in the front end target form.
[0079] Furthermore, when a user enters data into the target form, the front-end application collects this data and determines which fields in the database the data should be stored in using mapping relationships. At this point, the `v-model` binding attribute of the form element associates the input of the target form with the data properties in the Vue instance. When the front-end has collected the data and submitted the target form, it sends a request to the back-end API. After receiving this data, the back-end API uses the mapping relationships to insert the data into the correct database table fields. For example, the back-end API might use SQL statements or ORM (Object-Relational Mapping) to handle data storage.
[0080] Specifically, when data needs to be read from the database and displayed in the target form on the front end, the backend API will extract the data from the database table according to the mapping relationship and pass it to the front end through the API response. After receiving the data, the frontend application will populate the data into the correct form elements based on the mapping relationship.
[0081] Based on steps S261 to S262 above, the mapping relationship between form elements in the target form and fields in the database table is obtained; based on the mapping relationship, the target form and database information are bound together to generate the target application. This not only ensures the accurate correspondence between the target form and database information, but also enables two-way data binding and management, allowing the application to efficiently collect, validate, and store user input, as well as efficiently read data from the database and present it to the user.
[0082] Optionally, in step S22, determining the data model of the target application based on business requirements includes:
[0083] Step S221: Obtain entity information, corresponding attribute information of the entity, logical information between entities, and field validation rules based on business requirements;
[0084] In step S221, the logical information between entities is used to characterize the relationships between data, such as one-to-many or many-to-many. For example, a user can have multiple orders, and a product can be included in multiple orders.
[0085] The validation rules for the above fields are used to characterize the validity conditions of the data input. For example, data format, length, range, etc.
[0086] Specifically, first, understand the business processes and functional requirements. Then, identify all relevant entities from the business requirements; entities are the basic units in the data model. Next, define attributes for each entity, including attribute name, data type, whether it can be nullable, and whether it is unique. Finally, determine the logical relationships between entities and define validation rules for each field to ensure data accuracy and consistency. For example, email fields may need to validate formatting, and password fields may need length limits and complexity requirements.
[0087] Step S222: Determine the data model based on the obtained entity information, the attribute information corresponding to the entity, the logical information between entities, and the field validation rules.
[0088] Specifically, create a data model file in JSON or XML format to describe entities, attributes, relationships, and validation rules. The data model file should clearly list all entities and their attributes, as well as the relationships between entities and the validation rules for the fields.
[0089] Based on steps S221 to S222 above, entity information, corresponding attribute information, logical information between entities, and field validation rules are obtained based on business requirements. Based on the obtained entity information, corresponding attribute information, logical information between entities, and field validation rules, a data model is determined. Based on the data model-driven approach, the structure of the target form and the maintenance of validation rules become simpler and more intuitive, reducing maintenance costs and improving the accuracy of data validation.
[0090] Optionally, the method further includes:
[0091] Step S27: Provide an extension interface for the target application, wherein the extension interface includes at least one of the following:
[0092] A form component registration interface for customizing form components;
[0093] Specifically, the aforementioned form component registration interface allows developers to create and register custom form components. These custom form components can include any complex functionality, such as rich text editors, file upload components, and geolocation selectors, not just basic input boxes and selection boxes. This requires defining one or more registration functions within the form generator framework to receive the components created by the developer and add them to the system's list of available components.
[0094] Specifically, first, a specification for a form component registration interface is designed, allowing developers to register their own form components. This specification includes the component's name, type, attributes, event handling, etc. Then, the logic is implemented in the form generator to accept the custom form components registered by developers. Finally, detailed API documentation and sample code are provided to help developers understand how to use the interface to register their own form components.
[0095] Verification rule definition interface: Used to define verification rules.
[0096] Specifically, the aforementioned validation rule definition interface allows developers to define new validation rules. These rules can be complex logic targeting specific fields or general rules, such as ID card number verification or mobile phone number verification. This requires providing a definition interface in the form generator's validation module, allowing developers to register custom validation functions.
[0097] Specifically, in the form generator's validation module, a validation rule definition interface is defined. This interface receives validation functions and rule identifiers, adding the validation logic to the rule library. Developers can use this interface to register their custom validation rules. When the target form is generated, the corresponding validation function can be called based on the validation rule configuration of the fields in the data model. For example, if the validation rule for the `idCard` field is defined as `idCard` in the data model, then when the form is submitted, the form generator will call the custom `isIDCard` validation function to check the validity of the input.
[0098] Based on step S27 above, an extension interface is provided for the target application. The extension interface includes at least one of the following: a form component registration interface for customizing form components; and a validation rule definition interface for defining validation rules. Providing an extension interface enables the form generator to adapt to different business scenario requirements, thereby enhancing the flexibility and customizability of the form generator.
[0099] Optionally, the method further includes:
[0100] Step S281: Obtain the input events of the target form, wherein the input events are used to represent the events triggered when input is made in the target form;
[0101] In step S281, the aforementioned input event is an event triggered when the user performs an input operation in the target form. Input events can include actions such as typing text in an input box, selecting an option from a drop-down menu, or checking a checkbox. Input events typically include the following types:
[0102] (1) input: Triggered when the user enters or deletes characters in the input box, used to monitor changes in the input box in real time;
[0103] (2) change: Triggered when the value of the input box changes, usually used to perform validation or update operations after the user completes the input or selection operation;
[0104] (3) click: Triggered when a user clicks a button or control, such as the submit button or reset button.
[0105] Step S282: Validate the input events based on the validation rules of the target form to obtain the validation results;
[0106] Step S283: In response to determining that the input event conforms to the validation rules based on the validation result, control the target form to respond based on the input event.
[0107] Specifically, listen for and capture input events for each input element in the target form. This can be achieved using Vue.js's event listener mechanism. For example, use `@input` or `@change` event listeners to monitor changes in the input fields. After capturing the input event, check if the user input meets the requirements according to the target form's validation rules. When the validation rules pass (i.e., the validation result is true), update the target form's state or trigger other application logic based on the input event. For example, if the input passes validation, allow the user to submit the form, or update the form's error message in a real-time validation scenario. When the validation rules fail (i.e., the validation result is false), display an error message in the target form based on the input event.
[0108] Based on steps S281 to S283 above, input events of the target form are obtained, wherein the input events are used to represent events triggered when input is made in the target form; the input events are validated based on the validation rules of the target form to obtain validation results; in response to determining that the input events conform to the validation rules based on the validation results, the target form is controlled to respond based on the input events, which can monitor and validate the user's input in the target form in real time, not only ensuring the accuracy of the data, but also improving the user experience, allowing the user to immediately know which inputs may have problems and how to correct them.
[0109] Figure 3 This is a flowchart of another application generation method according to one embodiment of the present invention, such as... Figure 3 As shown, the method includes the following steps:
[0110] Step S301: Obtain the business requirements of the target application;
[0111] Step S302: Obtain entity information, corresponding attribute information of the entity, logical information between entities, and field validation rules based on business requirements;
[0112] Step S303: Determine the data model based on the obtained entity information, the attribute information corresponding to the entity, the logical information between entities, and the field validation rules;
[0113] Step S304: Generate an initial form based on the field information in the data model;
[0114] Step S305: Decompose the initial form to obtain reusable form components;
[0115] Step S306: Configure the preset canvas area using the form component to determine the target form;
[0116] Step S307: Determine the structure of the database tables based on the entity information and the corresponding attribute information in the data model;
[0117] Step S308: Determine the logical relationships between database tables based on the logical information between entities in the data model;
[0118] Step S309: Obtain the mapping relationship between form elements in the target form and fields in the database table;
[0119] Step S310: Bind the target form to the database information based on the mapping relationship to generate the target application.
[0120] Based on steps S301 to S310 above, the business requirements of the target application are obtained. The data model of the target application is determined based on the business requirements, and the target form and database information are determined based on the data model. Finally, the target form and database information are bound together to generate the target application. By leveraging the component-based and responsive design features of Vue.js, seamless integration with the Vue ecosystem is achieved. This improves the efficiency of form generation and enhances the scalability and integration of the form generation tool, thereby solving the technical problems of low form generation efficiency and limitations in the scalability and integration of form generation tools in related technologies.
[0121] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.
[0122] This invention also provides an application generation apparatus for implementing the above embodiments and preferred embodiments, which will not be repeated hereafter. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0123] Figure 4 This is a structural block diagram of an application generation apparatus according to one embodiment of the present invention, such as... Figure 4 As shown, the device includes:
[0124] The acquisition module 401 is used to acquire the business requirements of the target application, wherein the business requirements are used to determine the functions required by the target application and the logical relationships between the functions;
[0125] The first determining module 402 is used to determine the data model of the target application based on business requirements, wherein the data model is used to determine the entity information and logical relationships between entities in the business requirements;
[0126] The second determining module 403 is used to determine the target form and database information based on the data model;
[0127] The generation module 404 is used to bind the target form with database information and generate the target application.
[0128] Optionally, the second determining module 403 is further configured to: generate an initial form based on field information in the data model; decompose the initial form to obtain reusable form components; and use the form components to configure a preset canvas area to determine the target form.
[0129] Optionally, the second determining module 403 is further configured to: determine the structure of the database tables based on the entity information and the attribute information corresponding to the entities in the data model; and determine the logical relationships between the database tables based on the logical information between entities in the data model.
[0130] Optionally, the acquisition module 401 is further used to acquire the mapping relationship between form elements in the target form and fields in the database table; the generation module 404 is further used to bind the target form with the database information based on the mapping relationship to generate the target application.
[0131] Optionally, the acquisition module 401 is further used to acquire entity information, attribute information corresponding to the entity, logical information between entities, and field validation rules based on business requirements; the first determination module 402 is further used to determine the data model based on the acquired entity information, attribute information corresponding to the entity, logical information between entities, and field validation rules.
[0132] Optionally, the device further includes a processing module 405 for providing an extension interface to the target application, wherein the extension interface includes at least one of the following: a form component registration interface for customizing form components; and a validation rule definition interface for defining validation rules.
[0133] Optionally, the acquisition module 401 is further configured to acquire input events of the target form, wherein the input events represent events triggered when input is made in the target form; the device further includes a verification module 406, configured to verify the input events based on the verification rules of the target form to obtain a verification result; the device further includes a control module 407, configured to control the target form to respond based on the input events in response to determining that the input events conform to the verification rules according to the verification result.
[0134] According to one embodiment of the present invention, an electronic device is also provided, comprising: a memory storing an executable program; and a processor for running the program, wherein the program executes the above-described application generation method during runtime.
[0135] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0136] Step S1: Obtain the business requirements of the target application, wherein the business requirements are used to determine the functions that the target application needs to have and the logical relationships between the functions;
[0137] Step S2: Determine the data model of the target application based on business requirements, wherein the data model is used to determine the entity information and logical relationships between entities in the business requirements;
[0138] Step S3: Determine the target form and database information based on the data model;
[0139] Step S4: Bind the target form to the database information to generate the target application.
[0140] According to one embodiment of the present invention, a computer-readable storage medium is also provided, comprising: the computer-readable storage medium including a stored executable program, wherein, when the executable program is running, the device where the storage medium is located executes the above-described application generation method.
[0141] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0142] Step S1: Obtain the business requirements of the target application, wherein the business requirements are used to determine the functions that the target application needs to have and the logical relationships between the functions;
[0143] Step S2: Determine the data model of the target application based on business requirements, wherein the data model is used to determine the entity information and logical relationships between entities in the business requirements;
[0144] Step S3: Determine the target form and database information based on the data model;
[0145] Step S4: Bind the target form to the database information to generate the target application.
[0146] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0147] According to one embodiment of the present invention, a computer program product is also provided, comprising: a computer program, which, when executed by a processor, implements the above-described method for generating an application program.
[0148] Optionally, in this embodiment, the computer program product described above may be configured to store computer program instructions for performing the following steps:
[0149] Step S1: Obtain the business requirements of the target application, wherein the business requirements are used to determine the functions that the target application needs to have and the logical relationships between the functions;
[0150] Step S2: Determine the data model of the target application based on business requirements, wherein the data model is used to determine the entity information and logical relationships between entities in the business requirements;
[0151] Step S3: Determine the target form and database information based on the data model;
[0152] Step S4: Bind the target form to the database information to generate the target application.
[0153] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0154] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0155] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0156] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0157] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0158] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0159] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0160] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for generating an application, characterized in that, include: Obtain the business requirements of the target application, wherein the business requirements are used to determine the functions that the target application needs to have and the logical relationships between the functions; The data model of the target application is determined based on the business requirements, wherein the data model is used to determine the entity information and logical relationships between entities in the business requirements; The target form and database information are determined based on the data model; The target form is bound to the database information to generate the target application.
2. The application generation method according to claim 1, characterized in that, The target form is determined based on the data model, including: Based on the field information in the data model, an initial form is generated; The initial form is decomposed to obtain reusable form components; The target form is determined by configuring the preset canvas area using the form component.
3. The application generation method according to claim 1, characterized in that, The database information determined based on the data model includes: Based on the entity information and corresponding attribute information in the data model, the structure of the database tables is determined; Based on the logical information between entities in the data model, the logical relationships between the database tables are determined.
4. The application generation method according to claim 3, characterized in that, Binding the target form to the database information to generate the target application includes: Obtain the mapping relationship between form elements in the target form and fields in the database table; Based on the mapping relationship, the target form is bound to the database information to generate the target application.
5. The application generation method according to claim 1, characterized in that, The data model for the target application, determined based on the aforementioned business requirements, includes: Based on the aforementioned business requirements, obtain entity information, the attribute information corresponding to the entity, the logical information between entities, and the field validation rules; The data model is determined based on the obtained entity information, the attribute information corresponding to the entity, the logical information between the entities, and the validation rules of the fields.
6. The application generation method according to claim 1, characterized in that, The method further includes: Provide an extension interface for the target application, wherein the extension interface includes at least one of the following: A form component registration interface for customizing form components; Verification rule definition interface: Used to define verification rules.
7. The application generation method according to claim 1, characterized in that, The method further includes: Obtain the input events of the target form, wherein the input events are used to represent events triggered when input is made in the target form; The input event is validated based on the validation rules of the target form to obtain the validation result; In response to determining that the input event conforms to the validation rules based on the validation result, the target form is controlled to respond based on the input event.
8. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, executes the method for generating the application according to any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, wherein, when the executable program is executed, it controls the device on which the storage medium is located to perform the application generation method according to any one of claims 1 to 7.
10. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the method for generating an application according to any one of claims 1 to 7.