CN117667089A - Front-end form generation method and device, storage medium and electronic equipment - Google Patents

Front-end form generation method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN117667089A
CN117667089A CN202311560864.4A CN202311560864A CN117667089A CN 117667089 A CN117667089 A CN 117667089A CN 202311560864 A CN202311560864 A CN 202311560864A CN 117667089 A CN117667089 A CN 117667089A
Authority
CN
China
Prior art keywords
verification
data
page
item
target file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311560864.4A
Other languages
Chinese (zh)
Inventor
陆春
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianyi Electronic Commerce Co Ltd
Original Assignee
Tianyi Electronic Commerce Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianyi Electronic Commerce Co Ltd filed Critical Tianyi Electronic Commerce Co Ltd
Priority to CN202311560864.4A priority Critical patent/CN117667089A/en
Publication of CN117667089A publication Critical patent/CN117667089A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a front-end form generation method, a front-end form generation device, a storage medium and electronic equipment. Wherein the method comprises the following steps: analyzing the target file of the preset class in the back-end server to obtain the data information of the preset class and the back-end verification annotation; based on the data information, determining a form item for acquiring input form data in a front-end page, wherein the front-end page and a back-end server are of a separation architecture, and the separation architecture is the mutual decoupling of the function deployment of the front-end page and the function deployment of the back-end server; converting the back-end verification annotation, and determining a form verification rule for verifying form data on the front-end page; generating a front-end form on the front-end page based on the form verification rule and the form item, wherein a mapping relation exists between the front-end form and a target file, and the target file is used for processing the front-end form submitted to the back-end server. The invention solves the technical problem of non-ideal front-end and back-end data conversion efficiency in the related technology.

Description

Front-end form generation method and device, storage medium and electronic equipment
Technical Field
The invention relates to the field of front-end and back-end development, data transmission and verification technologies, in particular to a front-end form generation method, a device, a storage medium and electronic equipment.
Background
Currently, in development of Web (Web page) application programs, front-end and back-end separation architecture is widely applied, and data interaction is required to be frequently performed between the front end and the back end, so that in order to achieve high efficiency and consistency of data transmission, data transmission objects are often used to transfer data between different layers, and the data transmission objects usually comprise a plurality of fields and verification annotations for describing a structure and verification rules of the data. However, due to the code language and validation rule differences between the front-end and the back-end, it is often necessary to manually create the front-end form item and validation rule, there are repetitive work and potential errors, and in the related art, but no widely-used automated solution has yet emerged, the data conversion and validation method may be inefficient for complex data transmission object structures and validation rules, and be prone to errors.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a front-end form generation method, a front-end form generation device, a storage medium and electronic equipment, which at least solve the technical problem of non-ideal front-end and back-end data conversion efficiency in the related technology.
According to an aspect of an embodiment of the present invention, there is provided a front-end form generating method, including: analyzing a target file of a preset class in a back-end server to obtain data information of the preset class and a back-end verification annotation; based on the data information, determining a form item for acquiring input form data in a front-end page, wherein the front-end page and the back-end server are of a separation architecture, and the separation architecture is that the function deployment of the front-end page and the function deployment of the back-end server are mutually decoupled; converting the back-end verification annotation, and determining a form verification rule for verifying the form data on the front-end page; generating a front-end form on the front-end page based on the form verification rule and the form item, wherein a mapping relation exists between the front-end form and the target file, and the target file is used for processing the front-end form submitted to the back-end server.
Optionally, the converting the backend verification annotation determines a form verification rule on the front-end page, including: acquiring front-end call mapping configuration; converting the back-end verification annotation based on the front-end call mapping configuration instruction, and determining a front-end call method corresponding to the back-end verification annotation; and generating the form verification rule based on the front-end calling method.
Optionally, the determining, based on the data information, a form item for acquiring the input form data on the front-end page includes: determining a data type of the data information; and determining an input box corresponding to the data type to obtain the form item.
Optionally, the generating the front-end form on the front-end page based on the form verification rule and the form item includes: acquiring a front-end template pattern and a front-end interface; and generating the front-end form by adopting the front-end template style based on the form verification rule and the form item, wherein the front-end form is submitted to the back-end server through the front-end interface.
Optionally, the parsing the target file of the predetermined class in the back-end server to obtain the data information of the predetermined class and the back-end verification annotation includes: analyzing the source code of the target file in the back-end server to obtain the variable names, keywords and operators of the preset classes in the target file; generating an abstract syntax tree by taking the variable names, the keywords and the operators as nodes; traversing the abstract syntax tree to obtain the data information and the backend verification annotation.
Optionally, after the front-end page generates a front-end form based on the form verification rule and the form item, the following processing is performed by the front-end page: acquiring the form data input in the form item; and submitting the front-end form to the back-end server under the condition that the form data passes the form verification rule verification.
Optionally, the front-end page is provided with a custom configuration interface, and the generating, based on the form verification rule and the form item, a front-end form on the front-end page includes: generating an initial form based on the form verification rule and the form item; and adjusting the initial form through the custom configuration interface to obtain the front-end form.
According to another aspect of the embodiment of the present invention, there is provided a front-end form generating apparatus, including: the analysis module is used for analyzing the target file of the preset class in the back-end server to obtain the data information of the preset class and the back-end verification annotation; the item determining module is used for determining a form item for acquiring input form data on a front-end page based on the data information, wherein the front-end page and the back-end server are of a separated architecture, and the separated architecture is that the function deployment of the front-end page and the function deployment of the back-end server are mutually decoupled; the rule determining module is used for converting the back-end verification annotation and determining a form verification rule for verifying the form data on the front-end page; the form generation module is used for generating a front-end form on the front-end page based on the form verification rule and the form item, wherein a mapping relation exists between the front-end form and the target file, and the target file is used for processing the front-end form submitted to the back-end server.
According to another aspect of embodiments of the present invention, there is provided a nonvolatile storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform any one of the front-end form generation methods.
According to another aspect of an embodiment of the present invention, there is provided an electronic apparatus including: one or more processors and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the front-end form generation method of any of the claims.
In the embodiment of the invention, the target file of the preset class in the back-end server is analyzed to obtain the data information of the preset class and the back-end verification annotation; based on the data information, determining a form item for acquiring input form data in a front-end page, wherein the front-end page and the back-end server are of a separation architecture, and the separation architecture is that the function deployment of the front-end page and the function deployment of the back-end server are mutually decoupled; converting the back-end verification annotation, and determining a form verification rule for verifying the form data on the front-end page; generating a front-end form on the front-end page based on the form verification rule and the form item, wherein a mapping relation exists between the front-end form and the target file, and the target file is used for processing the front-end form submitted to the back-end server. The method achieves the aim of automatically converting the front-end form from the back-end processing, achieves the technical effect of improving the non-ideal front-end and back-end data conversion efficiency, and further solves the technical problem of the non-ideal front-end and back-end data conversion efficiency in the related technology.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
FIG. 1 is a flow chart of an alternative front-end form generation method provided in accordance with an embodiment of the present invention;
FIG. 2 is a schematic flow chart diagram of an alternative front-end form generation method provided in accordance with an embodiment of the present invention;
fig. 3 is a schematic diagram of an alternative front-end form generation apparatus provided according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of description, the following will describe some terms or terms related to the embodiments of the present application:
data Transfer Object (DTO, data transfer object) for transferring data within an application or between different systems, typically for transferring data from one layer to another, DTO files are typically Java class files or files in other programming languages for describing data transfer objects, which help decouple data models and business logic, improving flexibility and maintainability of the system.
AST (Abstract Syntax Tree ), which is a tree-shaped data structure, is built by parsing and analyzing source code. Each node in an AST represents a syntax element in the source code, such as an expression, a statement, a function, a class, etc.
Front-end refers to the user interface portion of an application program, including the interface and logic by which a user interacts with the application program. The front end functions to present data, interact with the user, and present a user interface to the user, providing a user-friendly use experience.
The backend refers to the server-side portion of the application program that is responsible for handling business logic, data storage, and communication with the front-end. The back end is used for processing business logic, data storage and communication with the front end, ensuring the normal operation of the application program and providing corresponding functions.
The front-end and back-end separated architecture is a software architecture mode, wherein the front end and the back end are respectively independently developed, deployed and maintained, and the front-end and back-end separated architecture is mainly characterized in that data interaction can exist between the front end and the back end, and data can be transmitted through a network instead of being directly coupled together. Front-end and back-end functional decoupling can improve development efficiency, reduce system complexity, and realize front-end and back-end parallel development and deployment.
In the related technology, the front-end form item and the verification rule are created manually or by means of partial components and frames, so that errors easily occur, the data interaction is inaccurate or incomplete, and the stability and the reliability of the system are affected. The code language difference between the front end and the back end also causes maintenance to be trapped, and once the back end data structure changes, the forms in the front end page also need to be correspondingly modified, so that maintenance cost and risk are increased. And frequent data interaction and manual creation of front-end form items and validation rules reduce development efficiency and are also less scalable.
In view of the foregoing, embodiments of the present invention provide a method embodiment for front-end form generation, it should be noted that the steps illustrated in the flowchart of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order other than that illustrated herein.
FIG. 1 is a flow chart of a front-end form generation method according to an embodiment of the present invention, as shown in FIG. 1, the optional execution body is a software component for front-end and back-end conversion, the method comprising the steps of:
step S102, analyzing a target file of a preset class in a back-end server to obtain data information of the preset class and a back-end verification annotation;
it can be understood that the target file of the predetermined class in the back-end server is analyzed, the predetermined class can be the DTO class file in Java for lexical analysis, and the data information of the predetermined class and the back-end verification annotation can be obtained based on the source code for decomposition. Through the processing, the data processing required to be executed by the target file in the back-end server can be extracted, and the processing can be used for generating the front-end form in the front-end page later.
In an alternative embodiment, parsing the target file of the predetermined class in the back-end server to obtain the data information of the predetermined class and the back-end verification annotation includes: analyzing the source code of the target file in the back-end server to obtain the variable name, the keyword and the operator of the preset class in the target file; generating an abstract syntax tree by taking variable names, keywords and operators as nodes; traversing the abstract syntax tree to obtain data information and a back-end verification annotation.
It is understood that the predetermined class may be a DTO class of Java, which performs lexical analysis on the object file, and decomposes the source code into tokens (tokens), such as keywords, identifiers, operators, etc. of the DTO class. The abstract syntax tree is generated with the variable names, keywords, and operators as nodes to represent the structure and hierarchy of the source code. Traversing the abstract syntax tree to obtain data information and a back-end verification annotation.
It should be noted that the backend verification annotation may be from a manual annotation or may be automatically added by the code analysis tool, where the backend verification annotation includes some additional information of the code, such as the data type of the variable, the return value of the method, and so on. The backend validation annotation may be in a predetermined annotation format.
Alternatively, the way to traverse the abstract syntax tree may be in a number of ways, by traversing to obtain specific information of the source code, the traversal may be a depth-first search, or a breadth-first search. The depth-first search described above searches the branches of the tree as deep as possible, and this process continues until all nodes reachable from the source node are found. If there are yet undiscovered nodes, one of them is selected as the source node and the process is repeated, and the whole process iterates until all nodes in the directed abstract syntax tree are accessed. Breadth-first searches access the root node in the closer abstract syntax tree, then access all neighboring nodes, and then access neighboring nodes to those neighboring nodes.
Alternatively, the keywords, identifiers, operators of the DTO class may be various, for example, the keywords may be keywords for defining access rights of the class, and for defining types of the class and implementing interfaces. The identifier may be a name that refers to a class, attribute, method, etc., typically a string of letters, numbers, underlined symbols. The operator may be an assignment operator, an add-subtract multiply-divide operator, or the like for assigning and calculating attributes of the class. In addition, DTO classes may include keywords, identifiers, and operators for representing data types, method declarations, notes, and the like.
Step S104, determining form items for acquiring input form data in a front-end page based on data information, wherein the front-end page and a back-end server are of a separated architecture, and the separated architecture is formed by mutually decoupling the function deployment of the front-end page and the function deployment of the back-end server;
it can be appreciated that the front-end page and the back-end server are separate architectures, and the function deployment of the front-end page and the function deployment of the back-end server are decoupled from each other. After the functions of the front-end page and the back-end server are decoupled, development and maintenance can be independently performed respectively, and the functions are not affected mutually. This allows for more flexibility in updating and modifying the functionality of the page and server without affecting one part as it varies. Thus expansion and upgrade are easier. New functions can be independently added to the front-end page or the back-end server, so that different platforms and devices can be better adapted. Form items for acquiring the input form data in the front-end page may be determined based on the data information parsed in the back-end server.
Alternatively, the form items may be Vue form items, which are components used to collect user input data, and the form items may be bound to data attributes of Vue instances, so as to implement bidirectional binding of data. The Vue form item may also contain validation rules to ensure that the data entered by the user is satisfactory. Vue (view) is used to build user interfaces and single page applications.
In an alternative embodiment, determining form items for retrieving input form data at a front-end page based on data information includes: determining a data type of the data information; and determining an input box corresponding to the data type to obtain the form item.
It can be understood that according to the DOT type in the data information, the data type of the data information can be determined, and the input box corresponding to the data type can be determined, so that the form item is obtained.
Alternatively, in the case where the data information indicates a character string type, a text input box is generated as a form item, in the case where the data information indicates an integer type, a number input box is generated as a form item, in the case where the data information indicates a date type, a date input box is generated as a form item, in the case where the data information indicates an enumeration type, a drop-down box is generated as a form item, and in the case where the data information indicates a boolean type, a check box is generated as a form item.
Step S106, converting the back-end verification annotation, and determining a form verification rule for verifying form data on a front-end page;
it will be appreciated that the conversion of the backend validation annotations may determine form validation rules for validating form data at the front-end page. Before the front-end form is submitted to the back-end server, the form data is verified on the front-end page according to the form verification rule, and then the submission to the back-end server can be performed.
In an alternative embodiment, converting the backend validation annotations, determining the form validation rules at the front-end page, includes: acquiring front-end call mapping configuration; converting the back-end verification annotation based on the front-end call mapping configuration instruction, and determining a front-end call method corresponding to the back-end verification annotation; form verification rules are generated based on the front-end calling method.
It will be appreciated that the content in the front-end call map configuration includes a conversion map that corresponds the back-end verification annotations to the front-end call methods. Form verification rules may be generated based on the front-end call method obtained after the conversion of the back-end verification annotation.
Alternatively, the backend validation annotation may be a Hibernate validation annotation extracted from the DTO class, such as @ NotNull, @ Max (value), @ Min (value), message, and the like. The Hibernate validation annotation is a set of annotations used for data validation on Java objects for validating fields of entity classes in an application. NotNull is used to ensure that a field is not null (null) and if it is null, a validation error will be raised. Max (value) is used to specify the maximum value of the field, and if the value of the data field exceeds this maximum value, a validation error may be raised. The @ Min (value) is used to specify a minimum value for a field, and if the value of the data field exceeds this minimum value, a verification error may be raised. Message indicates that the attribute is used to specify an error Message when verification fails, and when the field does not meet the verification rule, the Message in Message will be displayed.
Optionally, according to the front-end call mapping configuration, @ NotNull is converted into a call mandatory entry verification method, @ Max (value) is converted into a call maximum verification method, and message is converted into a call error information method.
Step S108, generating a front-end form on the front-end page based on the form verification rule and the form item, wherein a mapping relation exists between the front-end form and a target file, and the target file is used for processing the front-end form submitted to the back-end server.
It will be appreciated that the front-end form is generated on the front-end page using the form verification rules and form items obtained as described above. The front-end form and the target file have a mapping relation, after the front-end form is verified, the front-end form is submitted to a back-end server, and the target file in the back-end server is used for processing the submitted front-end form.
In an alternative embodiment, generating the front-end form on the front-end page based on the form verification rules and the form items includes: acquiring a front-end template pattern and a front-end interface; and generating a front-end form by adopting a front-end template style based on the form verification rule and the form item, wherein the front-end form is submitted to a back-end server through a front-end interface.
It will be appreciated that the front-end template style and front-end interface are pre-configured, and that the front-end template style is employed to generate a front-end form that is submitted to the back-end server through the front-end interface.
Alternatively, the front-end forms may be various, such as: vue or exact single page file. Both Vue and exact can create Single Page Applications (SPAs), and single page files are one technique used to build these applications. In Vue, a single page file typically ends with an ". Vue" extension, containing HTML, CSS, and JavaScript code, as well as component-related logic. The single page file of the reaction is usually used as an · js file or an · jsx file, and supports modular development, so that a page is split into a plurality of components, each component has its own state and behavior, and thus code reusability and maintainability are greatly improved.
In an alternative embodiment, after the front-end page generates the front-end form based on the form verification rules and the form items, the following processing is performed by the front-end page: acquiring form data input in a form item; and under the condition that the form data passes the form verification rule verification, submitting the front-end form to a back-end server.
It can be understood that the execution body is a front-end page, and the front-end page is generally used for displaying data, interacting with a user and presenting a user interface to the user, so that form data input into a form item can be obtained. If the form data passes the form verification rule, the front-end form is submitted to the back-end server for processing.
In an alternative embodiment, the front-end page is provided with a custom configuration interface, and the front-end form is generated on the front-end page based on the form verification rule and the form item, including: generating an initial form based on the form verification rules and the form items; and adjusting the initial form through the custom configuration interface to obtain a front-end form.
It can be appreciated that a custom configuration interface can be provided on the front-end page, and automatically generated form verification rules and form items can be used as an initial form. The set custom configuration interface can perform custom configuration on the initial form which is automatically set so as to meet the requirements of different projects. After the initial form is adjusted through the custom configuration interface, an adjusted front-end form can be obtained.
Through the step S102, the target file of the predetermined class in the back-end server is parsed, so as to obtain the data information of the predetermined class and the back-end verification annotation; step S104, determining form items for acquiring input form data in a front-end page based on data information, wherein the front-end page and a back-end server are of a separated architecture, and the separated architecture is formed by mutually decoupling the function deployment of the front-end page and the function deployment of the back-end server; step S106, converting the back-end verification annotation, and determining a form verification rule for verifying form data on a front-end page; step S108, generating a front-end form on the front-end page based on the form verification rule and the form item, wherein a mapping relation exists between the front-end form and a target file, and the target file is used for processing the front-end form submitted to the back-end server. The method can realize the purpose of automatically converting the back-end processing into the front-end form, and realize the technical effect of improving the non-ideal front-end and back-end data conversion efficiency, thereby solving the technical problem of the non-ideal front-end and back-end data conversion efficiency in the related technology.
Based on the above embodiment and the optional embodiment, the present invention proposes an optional implementation, as shown in fig. 2, specifically including the following steps:
step S1, performing lexical analysis on the DOT class target file in the back-end server, and decomposing to generate marks (tokens) based on the source code of the target file, wherein the marks (tokens) are used as data information, such as keywords, identifiers, operators and the like. And carrying out grammar analysis based on the data information, taking the key words, the identifiers and the operators as nodes, and generating an abstract grammar tree to represent the structure and the hierarchy of the source code.
Step S2, traversing and analyzing on an Abstract Syntax Tree (AST), and identifying and extracting the structure, the field type and the field name of the Java DTO class as data information.
And S3, generating a list item for displaying and using the list item of the form according to the data information of the DTO class.
And S4, converting the data information into corresponding Vue form items, such as text input boxes, digital input boxes, time input boxes, drop-down boxes, check boxes and the like, according to the data type of the data information.
In step S5, the target file of the DOT class may also parse the backend verification annotation, where the backend verification annotation may be a Hibernate verification annotation, and the extracting Hibernate verification annotation may be multiple, for example @ NotNull, @ Max (value), @ Min (value), message, and so on.
And S6, generating a corresponding Vue form verification rule according to the extracted Hibernate verification annotation, for example, converting @ NotNull into a call mandatory verification method, converting @ Max (value) into a call maximum verification method, and converting message into a call error information method.
And S7, generating a Vue list page file according to the converted Vue list items and the Vue list verification rule.
At least the following effects are achieved by the above alternative embodiments: compared with the traditional method for manually creating the front-end form and the verification rule, the method for manually creating the front-end form and the verification rule by using the Abstract Syntax Tree (AST) in the embodiment realizes automatic conversion, does not need to create the Vue or the practice form items and the verification rule one by one, and can automatically generate the front-end form by taking the target file as input, thereby accelerating the development speed, saving the time cost and also maintaining the data consistency. Through abstract syntax tree technology, and directly converts the abstract syntax tree technology into a corresponding front-end form. The consistency of the front-end data model and the back-end data model is ensured, potential errors caused by manual conversion are avoided, and the accuracy and the stability of the front-end data interaction and the back-end data interaction are improved. By combining AST technology and automatic generation of front-end form items, the efficiency and quality of software development are improved significantly. Compared with the traditional manual conversion mode, the method has obvious advantages in the aspects of data consistency and error reduction, can be more focused on business logic instead of complicated form and verification rule writing, and accelerates form development efficiency.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowcharts, in some cases the steps illustrated or described may be performed in an order other than that illustrated herein.
The embodiment also provides a front-end form generating device, which is used for implementing the foregoing embodiments and preferred embodiments, and is not described in detail. As used below, the terms "module," "apparatus" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
According to an embodiment of the present invention, there is further provided an embodiment of an apparatus for implementing a front-end form generating method, and fig. 3 is a schematic diagram of a front-end form generating apparatus according to an embodiment of the present invention, as shown in fig. 3, where the front-end form generating apparatus includes: the device is described below as parsing module 302, item determination module 304, rule determination module 306, and form generation module 308.
The parsing module 302 is configured to parse the target file of the predetermined class in the back-end server to obtain data information of the predetermined class and a back-end verification annotation;
the item determining module 304 is connected with the parsing module 302, and is configured to determine a form item for acquiring input form data on a front-end page based on data information, where the front-end page and the back-end server are separated structures, and the separated structures are a functional deployment of the front-end page and a functional deployment of the back-end server that are decoupled from each other;
the rule determining module 306 is connected with the item determining module 304 and is used for converting the back-end verification annotation and determining a form verification rule for verifying form data on a front-end page;
the form generation module 308 is connected to the rule determination module 306, and is configured to generate a front-end form on the front-end page based on the form verification rule and the form item, where a mapping relationship exists between the front-end form and a target file, where the target file is used to process the front-end form submitted to the back-end server.
In the front-end form generating device provided by the embodiment of the invention, the analysis module 302 is used for analyzing the target file of the preset class in the back-end server to obtain the data information of the preset class and the back-end verification annotation; the item determining module 304 is connected with the parsing module 302, and is configured to determine a form item for acquiring input form data on a front-end page based on data information, where the front-end page and the back-end server are separated structures, and the separated structures are a functional deployment of the front-end page and a functional deployment of the back-end server that are decoupled from each other; the rule determining module 306 is connected with the item determining module 304 and is used for converting the back-end verification annotation and determining a form verification rule for verifying form data on a front-end page; the form generation module 308 is connected to the rule determination module 306, and is configured to generate a front-end form on the front-end page based on the form verification rule and the form item, where a mapping relationship exists between the front-end form and a target file, where the target file is used to process the front-end form submitted to the back-end server. The method achieves the aim of automatically converting the front-end form from the back-end processing, achieves the technical effect of improving the non-ideal front-end and back-end data conversion efficiency, and further solves the technical problem of the non-ideal front-end and back-end data conversion efficiency in the related technology.
As an optional embodiment, the front-end form generating device provided by the embodiment of the present invention, the rule determining module includes: the first acquisition module is used for acquiring front-end call mapping configuration; the annotation conversion module is used for converting the back-end verification annotation based on the front-end call mapping configuration instruction and determining a front-end call method corresponding to the back-end verification annotation; and the rule generation module is used for generating a form verification rule based on the front-end calling method.
As an alternative embodiment, the item determination module includes: the first determining module is used for determining the data type of the data information; and the second determining module is used for determining an input box corresponding to the data type to obtain the form item.
As an alternative embodiment, the form generation module includes: the second acquisition module is used for acquiring the front-end template pattern and the front-end interface; and the generation processing module is used for generating a front-end form by adopting a front-end template style based on the form verification rule and the form item, wherein the front-end form is submitted to the back-end server through a front-end interface.
As an alternative embodiment, the parsing module includes: the first analysis module is used for analyzing the source code of the target file in the back-end server to obtain the variable name, the keyword and the operator of the preset class in the target file; the abstract syntax tree generating module is used for generating an abstract syntax tree by taking variable names, keywords and operators as nodes; and the traversing module is used for traversing the abstract syntax tree to obtain data information and a back-end verification annotation.
As an alternative embodiment, the form generation module includes: the third acquisition module is used for acquiring form data input in the form items; and the submitting module is used for submitting the front-end form to the back-end server under the condition that the form data passes the form verification rule verification.
As an alternative embodiment, the form generation module includes: the initial generation module is used for generating an initial form based on the form verification rule and the form item; the self-defining configuration module is used for adjusting the initial form through the self-defining configuration interface to obtain a front-end form.
It should be noted that each of the above modules may be implemented by software or hardware, for example, in the latter case, it may be implemented by: the above modules may be located in the same processor; alternatively, the various modules described above may be located in different processors in any combination.
Here, the parsing module 302, the item determining module 304, the rule determining module 306, and the form generating module 308 correspond to steps S102 to S108 in the embodiment, and the above modules are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the above modules may be run in a computer terminal as part of the apparatus.
It should be noted that, the optional or preferred implementation manner of this embodiment may be referred to the related description in the embodiment, and will not be repeated herein.
The front-end form generating device may further include a processor and a memory, the parsing module 302, the item determining module 304, the rule determining module 306, the form generating module 308, and the like, which are all stored as program units in the memory, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel may be provided with one or more. The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
The embodiment of the invention provides a nonvolatile storage medium, on which a program is stored, which when executed by a processor, implements a front-end form generation method.
The embodiment of the invention provides an electronic device, which comprises a processor, a memory and a program stored on the memory and capable of running on the processor, wherein the following steps are realized when the processor executes the program: analyzing the target file of the preset class in the back-end server to obtain the data information of the preset class and the back-end verification annotation; based on the data information, determining a form item for acquiring input form data in a front-end page, wherein the front-end page and a back-end server are of a separation architecture, and the separation architecture is the mutual decoupling of the function deployment of the front-end page and the function deployment of the back-end server; converting the back-end verification annotation, and determining a form verification rule for verifying form data on the front-end page; generating a front-end form on the front-end page based on the form verification rule and the form item, wherein a mapping relation exists between the front-end form and a target file, and the target file is used for processing the front-end form submitted to the back-end server. The device herein may be a server, a PC, etc.
The invention also provides a computer program product adapted to perform, when executed on a data processing device, a program initialized with the method steps of: analyzing the target file of the preset class in the back-end server to obtain the data information of the preset class and the back-end verification annotation; based on the data information, determining a form item for acquiring input form data in a front-end page, wherein the front-end page and a back-end server are of a separation architecture, and the separation architecture is the mutual decoupling of the function deployment of the front-end page and the function deployment of the back-end server; converting the back-end verification annotation, and determining a form verification rule for verifying form data on the front-end page; generating a front-end form on the front-end page based on the form verification rule and the form item, wherein a mapping relation exists between the front-end form and a target file, and the target file is used for processing the front-end form submitted to the back-end server.
Optionally, the above computer program product is further adapted to execute a program initialized with the method steps of: acquiring front-end call mapping configuration; converting the back-end verification annotation based on the front-end call mapping configuration instruction, and determining a front-end call method corresponding to the back-end verification annotation; form verification rules are generated based on the front-end calling method.
Optionally, the above computer program product is further adapted to execute a program initialized with the method steps of: determining a data type of the data information; and determining an input box corresponding to the data type to obtain the form item.
Optionally, the above computer program product is further adapted to execute a program initialized with the method steps of: acquiring a front-end template pattern and a front-end interface; and generating a front-end form by adopting a front-end template style based on the form verification rule and the form item, wherein the front-end form is submitted to a back-end server through a front-end interface.
Optionally, the above computer program product is further adapted to execute a program initialized with the method steps of: analyzing the source code of the target file in the back-end server to obtain the variable name, the keyword and the operator of the preset class in the target file; generating an abstract syntax tree by taking variable names, keywords and operators as nodes; traversing the abstract syntax tree to obtain data information and a back-end verification annotation.
Optionally, the above computer program product is further adapted to execute a program initialized with the method steps of: acquiring form data input in a form item; and under the condition that the form data passes the form verification rule verification, submitting the front-end form to a back-end server.
Optionally, the above computer program product is further adapted to execute a program initialized with the method steps of: generating an initial form based on the form verification rules and the form items; and adjusting the initial form through the custom configuration interface to obtain a front-end form.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises an element.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present invention and is not intended to limit the present invention. Various modifications and variations of the present invention will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the invention are to be included in the scope of the claims of the present invention.

Claims (10)

1. A front-end form generation method, comprising:
analyzing a target file of a preset class in a back-end server to obtain data information of the preset class and a back-end verification annotation;
based on the data information, determining a form item for acquiring input form data in a front-end page, wherein the front-end page and the back-end server are of a separation architecture, and the separation architecture is that the function deployment of the front-end page and the function deployment of the back-end server are mutually decoupled;
Converting the back-end verification annotation, and determining a form verification rule for verifying the form data on the front-end page;
generating a front-end form on the front-end page based on the form verification rule and the form item, wherein a mapping relation exists between the front-end form and the target file, and the target file is used for processing the front-end form submitted to the back-end server.
2. The method of claim 1, wherein said translating the backend validation annotation to determine a form validation rule at the front-end page comprises:
acquiring front-end call mapping configuration;
converting the back-end verification annotation based on the front-end call mapping configuration instruction, and determining a front-end call method corresponding to the back-end verification annotation;
and generating the form verification rule based on the front-end calling method.
3. The method of claim 1, wherein the determining a form item for acquiring the input form data at the front-end page based on the data information comprises:
determining a data type of the data information;
And determining an input box corresponding to the data type to obtain the form item.
4. The method of claim 1, wherein the generating a front-end form on the front-end page based on the form verification rules and the form items comprises:
acquiring a front-end template pattern and a front-end interface;
and generating the front-end form by adopting the front-end template style based on the form verification rule and the form item, wherein the front-end form is submitted to the back-end server through the front-end interface.
5. The method according to claim 1, wherein the parsing the target file of the predetermined class in the back-end server to obtain the data information of the predetermined class and the back-end verification annotation includes:
analyzing the source code of the target file in the back-end server to obtain the variable names, keywords and operators of the preset classes in the target file;
generating an abstract syntax tree by taking the variable names, the keywords and the operators as nodes;
traversing the abstract syntax tree to obtain the data information and the backend verification annotation.
6. The method according to any one of claims 1 to 5, wherein after the front-end page generates a front-end form based on the form verification rule and the form item, the following processing is performed by the front-end page:
acquiring the form data input in the form item;
and submitting the front-end form to the back-end server under the condition that the form data passes the form verification rule verification.
7. The method according to any one of claims 1 to 5, wherein the front-end page is provided with a custom configuration interface, and the generating the front-end form on the front-end page based on the form verification rule and the form item includes:
generating an initial form based on the form verification rule and the form item;
and adjusting the initial form through the custom configuration interface to obtain the front-end form.
8. A front-end form generation apparatus, comprising:
the analysis module is used for analyzing the target file of the preset class in the back-end server to obtain the data information of the preset class and the back-end verification annotation;
The item determining module is used for determining a form item for acquiring input form data on a front-end page based on the data information, wherein the front-end page and the back-end server are of a separated architecture, and the separated architecture is that the function deployment of the front-end page and the function deployment of the back-end server are mutually decoupled;
the rule determining module is used for converting the back-end verification annotation and determining a form verification rule for verifying the form data on the front-end page;
the form generation module is used for generating a front-end form on the front-end page based on the form verification rule and the form item, wherein a mapping relation exists between the front-end form and the target file, and the target file is used for processing the front-end form submitted to the back-end server.
9. A non-volatile storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the front-end form generation method of any of claims 1 to 7.
10. An electronic device, comprising: one or more processors and memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the front-end form generation method of any of claims 1 to 7.
CN202311560864.4A 2023-11-21 2023-11-21 Front-end form generation method and device, storage medium and electronic equipment Pending CN117667089A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311560864.4A CN117667089A (en) 2023-11-21 2023-11-21 Front-end form generation method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311560864.4A CN117667089A (en) 2023-11-21 2023-11-21 Front-end form generation method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117667089A true CN117667089A (en) 2024-03-08

Family

ID=90072514

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311560864.4A Pending CN117667089A (en) 2023-11-21 2023-11-21 Front-end form generation method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117667089A (en)

Similar Documents

Publication Publication Date Title
US10698682B1 (en) Computerized software development environment with a software database containing atomic expressions
CN110968325B (en) Applet conversion method and device
US8286132B2 (en) Comparing and merging structured documents syntactically and semantically
US9483260B1 (en) Documentation generation for web APIs based on byte code analysis
US7506324B2 (en) Enhanced compiled representation of transformation formats
US9710243B2 (en) Parser that uses a reflection technique to build a program semantic tree
US20040158820A1 (en) System for generating an application framework and components
US9122540B2 (en) Transformation of computer programs and eliminating errors
US20150242194A1 (en) System for Translating Diverse Programming Languages
US20080320031A1 (en) Method and device for analyzing an expression to evaluate
US8856190B2 (en) Distributed computing system hierarchal structure manipulation
CN111913739B (en) Service interface primitive defining method and system
CN109491658A (en) The generation method and device of computer-executable code data
CN110333863A (en) A kind of method and device for generating, showing the small routine page
CN112328226B (en) Embedded system automatic test code generation method and device
CN108595334B (en) Method and device for calculating dynamic slices of Java program and readable storage medium
CN111831384A (en) Language switching method and device, equipment and storage medium
CN112379917A (en) Browser compatibility improving method, device, equipment and storage medium
CN115202626A (en) Low-code front-end development method supporting multi-technology stack components
CN109325217B (en) File conversion method, system, device and computer readable storage medium
CN105867886B (en) Method and device for writing table
CN114168149A (en) Data conversion method and device
CN114816364A (en) Method, device and application for dynamically generating template file based on Swagger
EP2535813B1 (en) Method and device for generating an alert during an analysis of performance of a computer application
CN117667089A (en) Front-end form generation method and device, storage medium and electronic equipment

Legal Events

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