Code generation method and device and computing equipment
By obtaining target business form data and configuring code templates, and using visual interaction to generate code, complex code generation needs are solved, and development efficiency and code quality are improved.
Patent Information
- Application Number
- CN202510536591.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-08-08
AI Technical Summary
The existing technology is difficult to effectively respond to complex and diverse code generation needs, resulting in low development efficiency and prone to human errors.
By obtaining the form data related to the target business, configuring code templates that match the business logic, and generating target code based on the form selected by the user, using visual information and interactive operations to determine the form, reducing the time and probability of manual code writing.
It automatically generates code corresponding to complex business, improves development efficiency and code quality, simplifies development process, and improves user experience.
Smart Images

Figure CN120449851A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a code generation method, apparatus, and computing device. Background Art
[0002] In traditional software development, writing code requires not only professional programming skills and familiarity with the syntax of a specific programming language, but also the ability to understand complex business logic. For development involving forms, developers often need to manually write code based on the form itself. This process is not only time-consuming and labor-intensive, but also prone to errors due to human negligence. Some form-based automatic code generation technologies can automatically generate code by configuring form element information and related information, thereby reducing the workload of manual coding, improving development efficiency, and reducing development complexity.
[0003] However, the above-mentioned automatic code generation technology can usually only be applied to relatively simple business needs and is difficult to adapt to more complex code generation needs. Summary of the Invention
[0004] The embodiments of the present application provide a code generation method, apparatus, and computing device that can automatically generate code corresponding to specific services in different target services, effectively addressing complex and diverse code generation requirements, thereby improving code generation efficiency.
[0005] To achieve the above objectives, the present invention adopts the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a code generation method, comprising: obtaining business data in response to a user's input operation, the business data including at least one first form related to a target business; configuring a code template corresponding to the target business in response to a user's configuration operation, the code template including a code framework in a preset mode related to the target business; the code framework corresponds to general business logic related to the business; obtaining at least one second form selected by the user from at least one first form, the at least one second form corresponding to at least one sub-business in the target business; filling the target field in the at least one second form into the code template to obtain a target code; the target field is a field obtained by parsing the at least one second form.
[0007] This solution automatically generates target code by extracting at least one second form for specific business needs from at least one first form and configuring a code template that matches the business logic. This automatically generates target code for processing the target fields in these forms based on the different second forms selected by the user. This not only effectively addresses complex and diverse code generation needs, but also significantly reduces the time and error associated with manual code writing, thereby improving development efficiency and code quality.
[0008] In one possible implementation, obtaining at least one second form selected by a user from at least one first form includes: determining at least one second form from the at least one first form based on at least one data source corresponding to a target business; wherein the at least one data source is used to represent an association between visual information of the at least one first form and the at least one first form in a database.
[0009] Based on this solution, at least one second form is determined from at least one first form through at least one data source corresponding to the target business. In this way, by clarifying the association relationship between the first form and at least one data source related to the target business, the computing device can quickly obtain relevant forms according to different business needs, thereby supporting more complex business needs.
[0010] In another possible implementation, based on at least one data source corresponding to the target business, at least one second form is determined from at least one first form, including: generating visualization information corresponding to the at least one first form; and determining at least one second form from a database associated with the at least one data source in response to an interactive operation on the visualization information corresponding to the at least one first form.
[0011] Based on this solution, by generating visual information of the first form, users can more intuitively understand and operate the data, that is, select the second form required by the user. In this way, determining the second form through visualization and user interaction can not only improve work efficiency and accuracy, but also improve user experience.
[0012] In another possible implementation, visual information corresponding to at least one first form is generated, including: in response to address information entered by a user in a browser, displaying a first page corresponding to a target business in the browser; the first page includes a main form identifier corresponding to at least one first form corresponding to the target business, and a first selection control and a second selection control corresponding to each main form identifier.
[0013] Based on this solution, by displaying at least one first form identifier corresponding to the first form, and an interface of a first selection control and a second selection control corresponding to each first form identifier, the user can quickly identify different form contents through the first form identifier, and through the first selection control and the second selection control, the user can directly perform operations, avoiding tedious manual input or configuration.
[0014] In another possible implementation, in response to a user's interactive operation on visual information corresponding to at least one first form, at least one second form is determined from a database associated with at least one data source, including: in response to a user's interactive operation on a first selection control identified by at least one main form, at least one second form is determined from a database associated with at least one data source.
[0015] Based on this solution, by selecting at least one main form identifier corresponding to a specific sub-business from multiple first form identifiers in the first interface, the corresponding second form is obtained based on the at least one main form identifier. In this way, the user does not need to manually search or enter relevant information, thereby reducing the operation steps.
[0016] In another possible implementation, in response to a user's interactive operation on visual information corresponding to at least one first form, at least one second form is determined from a database associated with at least one data source, including: in response to a user's interactive operation on a first selection control corresponding to at least one first form identifier, obtaining at least one main form identifier; in response to a user's interactive operation on a second selection control corresponding to the main form identifier, displaying a second interface, the second interface including at least one sub-form identifier corresponding to the main form identifier and a third selection control; in response to the user's interactive operation on the third selection control, obtaining at least one sub-form identifier corresponding to the main form identifier; and based on the at least one main form identifier and the at least one sub-form identifier, determining at least one second form from the database associated with the at least one data source.
[0017] This solution uses a series of select controls (a first select control, a second select control) to sequentially retrieve the primary form identifier and the subform identifier, ultimately identifying the desired secondary form from the associated database. This allows for precise and rapid locating of the desired form, significantly improving work efficiency by reducing manual input and search steps, and reducing the likelihood of human error.
[0018] In another possible implementation, the target fields in at least one second form are filled into the code template to obtain the target code, including: converting the configuration information and the target fields into template data; the configuration information is used to define the relevant personalized business logic and custom fields of the target business; and obtaining the target code based on the mapping relationship between the template data and the code template.
[0019] Based on this solution, the configuration information and the target fields extracted from the second form are converted into template data that can be recognized by the computing device. The target code is automatically generated through the mapping relationship between the template data and the code template. This allows target code to be generated based on the configuration information, which better meets user needs and improves the user experience. Furthermore, converting the configuration information and the target fields extracted from the second form into template data facilitates recognition by the computing device, improving code generation efficiency.
[0020] In another possible implementation, before determining at least one second form from at least one first form, the method further includes: configuring at least one data source corresponding to at least one database supported by the target business.
[0021] Based on this solution, by pre-configuring the data source corresponding to the database, data from different databases can be managed and organized more effectively, improving the accuracy and efficiency of data processing, simplifying the development process, and enhancing the flexibility of the system and user experience.
[0022] In another possible implementation, before determining at least one second form from at least one first form, the method further includes: configuring configuration information corresponding to the target service.
[0023] Based on this solution, by pre-setting these configuration information, the processing logic can be quickly customized to meet specific business needs, simplifying the development process.
[0024] In another possible implementation, after generating the target code based on at least one second form and a code template, it also includes: generating visual information corresponding to the target code; and updating the target code in response to an interactive operation on the visual information corresponding to the target code to obtain an updated target code.
[0025] Based on this solution, by generating visual information corresponding to the target code, the target code can be personalized modified to meet the user's personalized needs and improve the user experience.
[0026] In the second aspect, an embodiment of the present application also provides a code generation device, which includes: an acquisition module, configured to: acquire business data in response to a user's input operation, the business data including at least one first form related to the target business; a configuration module, configured to: configure a code template corresponding to the target business in response to the user's configuration operation, the code template is a code framework in a preset mode related to the target business; the code framework corresponds to the general business logic related to the target business; a determination module, configured to: acquire at least one second form selected by the user from at least one first form, the at least one second form corresponding to at least one sub-business in the target business; a generation module, configured to: fill the target field in at least one second form into the code template to obtain the target code, the target field is the field obtained by parsing at least one second form.
[0027] This solution automatically generates target code by extracting at least one second form corresponding to a specific business requirement from at least one first form and configuring a code template that matches the business logic of the target business. This automatically generates target code based on the different second forms selected by the user. This not only effectively addresses complex and diverse code generation needs, but also significantly reduces the time and error rate of manual code writing, thereby improving development efficiency and code quality.
[0028] In a third aspect, an embodiment of the present application further provides a computing device comprising: a processor and a memory; the processor and the memory are coupled; the memory is used to store program instructions; and the processor is used to execute program instructions to perform any method as described in the first aspect above.
[0029] In a fourth aspect, an embodiment of the present application provides a chip, which is used to execute any method as described in the first aspect above.
[0030] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a computer, the method as described in any one of the first aspects is implemented.
[0031] In a sixth aspect, an embodiment of the present application provides a program product, comprising a computer program, which implements any method in the first aspect when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 is a flowchart of a code generation method provided by an exemplary embodiment of the present application;
[0033] Figure 2This is a schematic diagram of a system framework for implementing a code generation method provided by an exemplary embodiment of the present application;
[0034] Figure 3 is a schematic diagram of visual information of a first form provided in an embodiment of the present application;
[0035] Figure 4 This is a schematic diagram of the first page provided in the embodiment of the present application;
[0036] Figure 5 is another schematic diagram of the first page provided in an embodiment of the present application;
[0037] Figure 6 is a schematic diagram of visual information of another first form provided in an embodiment of the present application;
[0038] Figure 7 is a flowchart of a code generation method provided by another exemplary embodiment of the present application;
[0039] Figure 8 is a system framework diagram of a code generation method provided by another exemplary embodiment of the present application;
[0040] Figure 9 This is a visual information flow chart of code generation provided by an embodiment of the present application;
[0041] Figure 10 This is another visual information flow chart generated by code provided in an embodiment of the present application;
[0042] Figure 11 This is a schematic diagram of a code generation device provided in an embodiment of the present application;
[0043] Figure 12 This is a schematic diagram of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] The following will describe the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings. To facilitate the clear description of the technical solutions in the embodiments of the present application, the first, second, etc. descriptions in the embodiments of the present application are only used for illustration and to distinguish the described objects. There is no order, nor does it represent a special limitation on the number of devices in the embodiments of the present application, and it does not constitute any limitation on the embodiments of the present application.
[0045] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0046] It should be noted that many specific details are set forth in the following description to facilitate a full understanding of the present application. However, the present application can also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present application is not limited to the specific implementation methods disclosed below.
[0047] In the description of this application, it should be understood that the terms "upper", "lower", "horizontal", "bottom", "inner", "outer" (if any), etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings and are intended only to facilitate the description of this application and simplify the description. They do not indicate or imply that the devices or elements referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore should not be understood as limiting this application. In this application, unless otherwise expressly specified or limited, a first feature being "upper" or "lower" than a second feature may mean that the first and second features are in direct contact, or that the first and second features are in indirect contact through an intermediate medium.
[0048] In this application, unless otherwise expressly specified or limited, the terms "connected," "connected," "fixed," and the like should be understood in a broad sense. For example, they can refer to fixed connections, detachable connections, or integration; they can refer to direct connections or indirect connections through an intermediate medium; they can refer to internal communication between two elements or an interaction between two elements. However, the phrase "directly connected" indicates that the two connected entities are not connected through an intermediate structure, but are connected to form a whole through a connecting structure. Those skilled in the art can understand the specific meanings of the above terms in this application based on the specific circumstances.
[0049] The following explains the professional terms mentioned in the embodiments of the present application to facilitate understanding by those skilled in the art.
[0050] A table, also known as a data table, is a fundamental structure in a database, used to store, organize, index, and manipulate data. A table stores data in rows and columns, with each row representing a record and each column representing a field. For example, a table may include the table name, field names, field types, field constraints, and index relationships.
[0051] A template engine is a template engine based on a programming language, such as the Velocity template engine. It can identify the correspondence between template data and code templates, that is, the mapping relationship, and insert the template data into the corresponding position in the code template to obtain the final code.
[0052] A business is an activity undertaken by an organization to achieve a specific goal. A business can include multiple sub-businesses, each of which is a specific component of the overall business. Sub-businesses focus on solving specific technical problems or meeting specific business needs.
[0053] Spring Boot is an open source application framework on the Java platform that eliminates the need for developers to define boilerplate configuration code, effectively reducing the developer's workload.
[0054] In the embodiment of the present application, at least one includes one or more, and multiple includes two or more.
[0055] The embodiments of the present application are described below with reference to the accompanying drawings.
[0056] Figure 1 It is a flowchart of a code generation method provided by an exemplary embodiment of the present application.
[0057] Figure 2 It is a schematic diagram of a system framework for implementing a code generation method provided by an exemplary embodiment of the present application.
[0058] like Figure 1 and Figure 2 As shown, the code generation method provided in the embodiment of the present application includes the following S1 to S4:
[0059] S1: In response to a user's input operation, business data is acquired, where the business data includes at least one first form related to a target business.
[0060] Optionally, business data is input into a computing device, which then retrieves the business data. Business data refers to the data set required by a user to execute a specific business. Within a business process, a business consists of multiple sub-businesses, each of which implements specific business logic, such as user information management or order processing information. To support these specific implementations, each sub-business corresponds to at least one form, such as a customer order form or a payment information form. Each form includes data of different nature or categories within the business, such as data corresponding to the payment method or order number.
[0061] Exemplarily, the current business activity is an e-commerce business, and a target business, such as at least one first form related to the e-commerce business, such as a customer order form, a payment information form, etc., is obtained.
[0062] S2: In response to a user input operation, obtaining at least one data source corresponding to at least one database supported by the target service.
[0063] A data source is a resource management component used by computing devices to connect to and operate databases. Its core function is to provide an interface for computing devices, through which they can establish a connection with the database using the configuration data stored in the data source. This configuration data can include the database's uniform resource locator (URL), username, password, driver class name, and more. After establishing a data source, computing devices can easily access data from the database through the data source, facilitating subsequent data interaction.
[0064] In one implementation, a data source corresponding to at least one database supported by the target service may be established in a property binding manner.
[0065] For example, if the target business, such as e-commerce, relies on multiple databases, the Spring Boot framework can use the @ConfigurationProperties annotation to establish at least one data source corresponding to the e-commerce business. Specifically, in the Spring Boot framework, a data source bean is a Java object created based on a data source, encapsulating the data source's logic and functionality. In a multi-data source scenario, users need to create multiple data source objects and bind different prefixes using the @ConfigurationProperties annotation.
[0066] For example, if the e-commerce business needs to connect to multiple databases, namely: "MySQL database", "Oracle database", "SQL Server database" and "PostgreSQL database", the user creates four datasource beans and binds different prefixes through the @ConfigurationProperties annotation, namely "@Bean(name="mysqlDataSource")", "@Bean(name="OracleDataSource")", "@Bean(name="sqlServerDataSource")" and "@Bean(name="PostgreSQLDataSource")".
[0067] Optionally, when dealing with multiple data sources, additional configuration parameters may be considered, such as disabling default automatic configuration to avoid potential conflicts and using environment variables to store sensitive information, such as usernames and passwords, to improve security. Furthermore, to account for changes in the target business workload, connection pool parameters (such as hikari.* parameters) can be adaptively configured to dynamically adjust resource allocation and optimize performance.
[0068] For example, let's consider an e-commerce business that relies on four databases for support: MySQL, Oracle, SQL Server, and PostgreSQL. A corresponding data source needs to be configured for each database. The configured data source can include a database driver class, which implements the communication protocol; a database connection address (Uniform Resource Locator, URL), which locates the database server; database authentication credentials, such as usernames and passwords, which verify identity and control permissions; and database connection pool parameters, which represent the maximum number of active connections to the database at the same time. For example, a data source configured for a MySQL database may include a MySQL database driver class. The database driver class may include a package structure and class name, such as com.mysql.cj.jdbc.Driver, where "com.mysql.cj.jdbc" is the package path of the MySQL JDBC driver design, and "Driver" is the core implementation class of the driver class in the JDBC specification, responsible for establishing a connection with the database; a MySQL database connection address, such as "XXXX"; MySQL database authentication credentials including a user name and password, such as user name "A" and password "a"; and MySQL database connection pool parameters, such as the maximum number of active connections allowed in the connection pool at the same time: 10. Similarly, the data sources configured for the other three databases are not listed one by one.
[0069] S3: In response to the user configuration operation, obtain configuration information corresponding to the target business; the configuration information is used to define personalized business logic and custom fields related to the target business.
[0070] For example, the configuration information corresponding to the target business is configured, where the configuration information may include the module name (moduleName), the URL address for accessing the target service (FeignURL), the basic package path (mainPath), the package name (package), the dependent software development kit name (software development kitname, sdkName), and user information, such as the author (author), email address (email), etc. The field information in the above example may be related to the business logic or a custom field added according to user preferences, which is not specifically limited here.
[0071] S4: In response to the user configuration operation, a code template corresponding to the target business is obtained, where the code template is a code framework in a preset mode related to the target business; the code framework corresponds to the general business logic related to the target business.
[0072] Optionally, the preset mode may be a code design mode that supports code modification and maintenance, such as a Model-View-Controller (MVC) software design mode.
[0073] A code template can be a collection of templates specifically designed for a specific business, such as e-commerce. Template collections can be organized according to the logic of a layered architecture (e.g., controller layer, business logic layer, data layer, etc.), with each layer containing corresponding templates. Together, these templates form the code framework for the business.
[0074] For example, the controller class code template (e.g., Controller.java.vm) corresponding to the controller layer mainly defines the code of the controller class. The controller class is the core component in the application responsible for processing user requests. It receives HTTP requests through the controller class and calls the service layer method to execute business logic. The service layer interface code template (e.g., Service.java.vm) and the service layer implementation class code template (e.g., ServiceImpl.java.vm) corresponding to the business logic layer, the service layer interface code template defines the service layer interface code and describes the business logic method. The service layer implementation class code template defines the code of the service layer implementation entity class to implement specific business logic. The Mapper interface code template (e.g., Mapper.java.vm) corresponding to the data layer defines the data access interface code.
[0075] In a layered architecture, in addition to the code templates corresponding to the aforementioned layers, there are also some code templates associated with the layers. For example, the data transfer object template (e.g., Dto.java.vm) primarily defines the code corresponding to transferring data between different layers. The entity class code template (e.g., Entity.java.vm) primarily defines the code for generating entity classes. Entity classes are mapping objects to database tables, and each entity class typically corresponds to a table in the database.
[0076] The following example uses a Controller.java.vm code template. This template includes a class definition (e.g., class name "XXX"); interface implementations (e.g., through the "XX" interface); annotations (e.g., marking it as a Spring controller); a constructor (e.g., using the @RequiredArgsConstructor annotation to automatically generate a constructor containing all final or non-null fields); member variables (e.g., "XXXXX"); and method definitions (e.g., paging query methods).
[0077] S5: Acquire at least one second form selected by the user from the at least one first form, where the at least one second form corresponds to at least one sub-business in the target business.
[0078] In one embodiment, S5 includes S51.
[0079] S51: Determine at least one second form from at least one first form based on at least one data source, wherein the at least one data source is used to represent an association relationship between visualization information of the at least one first form and the at least one first form in a database.
[0080] In one example, S51 includes S511 - S512 .
[0081] S511: Generate visual information corresponding to at least one first form.
[0082] Figure 3 This is a schematic diagram of visual information of a first form provided in an embodiment of the present application.
[0083] like Figure 3 As shown, in one implementation, the visual information corresponding to the first form may be a page containing field information in the first form. For example, the first page 1.
[0084] Exemplarily, the first page 1 includes multiple areas, namely a navigation area and a selection area 11, wherein the navigation area includes a top navigation area 101 and a left navigation area 102. The top navigation area 101 includes a "Home" logo. The left navigation area 102 includes business module classification, console, etc. The selection area 11 includes a display area 111 of at least one first form corresponding to the target business and a query area 112. The first form display area 111 includes multiple first forms, such as the first form AF. The field information of the first form may include key fields, such as table name, table remark information, creation time, etc. Each first form corresponds to a first selection control 1111 (not shown one by one in the figure). The query area 112 includes a query text box 1121 and a core operation control 1122 marked with "Generate Code". The query text box 1121 supports fuzzy matching of forms through field information such as table name or remark information.
[0085] It should be noted that the first page 1 displays the visual information of the first form AF, and more visual information of the first form can be displayed in the form of sliding the first page 1, which will not be illustrated here.
[0086] S512: In response to a user's interactive operation on visual information corresponding to at least one first form, determining at least one second form from a database associated with at least one data source.
[0087] Optionally, in response to an interactive operation on visual information corresponding to at least one first form, the computing device may generate at least one form identifier by calling a method. For example, in the Java programming language, the on_submit_order method may be called to generate at least one form identifier. The computing device then determines at least one second form from a database associated with at least one data source based on the at least one form identifier. Each form identifier corresponds to one form.
[0088] It should be noted that the multiple second forms determined above correspond to multiple sub-businesses, such as user information management and order processing information. It may also be that multiple second forms correspond to one sub-business, such as user information management, or one second form corresponds to one sub-business, such as user information management and order processing information. No specific limitation is given here.
[0089] For ease of distinction, the interactive operations are described below with specific examples. For example, the interactive operations may be in different forms such as a first selection operation, a second selection operation, and a third selection operation.
[0090] The following description will be made by taking an example where multiple second forms correspond to one sub-business.
[0091] The at least one second form may include at least one main form, or at least one main form and at least one subform corresponding to the at least one main form. The main form and the subform corresponding to the main form correspond to different dimensions of the sub-business. This is because in a complete business process, a single main form may not cover all the details and business requirements of the sub-business. Therefore, it is necessary to build multiple subforms associated with the main form to address specific sub-business requirements in detail according to different dimensions.
[0092] For example, the two cases of determining the second form are specifically described with examples.
[0093] In one example, it is taken as an example that two second forms are determined and both of the generated second forms are main forms.
[0094] Optionally, the steps for determining two main forms are as follows:
[0095] S5121: The computing device displays a first page corresponding to the target business in the browser in response to the address information input by the user in the browser.
[0096] The first page includes at least one first form corresponding to the target business and a main form identifier, and a first selection control and a second selection control corresponding to each main form identifier.
[0097] Figure 4 This is a schematic diagram of the first page provided in an embodiment of the present application.
[0098] like Figure 4 As shown in (a) in FIG, the computing device responds to the user's input operation (such as inputting "locallhost / ........html") of opening the visual code generation tool in the browser page 2, and displays the following Figure 4 The first page 3 shown in (b) of FIG. The first page 3 includes multiple main forms (first forms), such as main forms AF.
[0099] S5122: The computing device responds to the user's first selection operation on a first selection control of at least one main form identifier, and the at least one main form identifier corresponding to the first selection operation corresponds to a form.
[0100] Continuing with the above example, Figure 4 As shown in (b) in FIG, the computing device selects the main form A and the main form B in response to the first selection operation on the first selection control 1111 corresponding to the main form A and the main form B respectively on the user's first page 3.
[0101] S5123: The computing device determines at least one second form from a database associated with at least one data source in response to the user operating the core operation control identified by “Generate Code” in the first page.
[0102] Continue to combine Figure 4 As shown in (b), after the main form A and the main form B are selected, in response to the selection operation of the core operation control 1122 marked with "Generate Code" in the first page 3, two second forms, namely the main form A and the main form B, are determined.
[0103] In another example, it is taken as an example that two second forms are determined, and the two generated second forms include a main form and a sub-form corresponding to the main form.
[0104] Optionally, the steps to obtain a main form and a subform are as follows:
[0105] S5124: In response to a trigger operation input by the user, a first page corresponding to the target business is displayed; the first page includes at least one main form identifier, at least one first selection control corresponding to at least one main form identifier, and a second selection control corresponding to each main form identifier; wherein, one main form identifier corresponds to one first selection control; and one main form identifier corresponds to one second selection control.
[0106] Figure 5 This is another schematic diagram of the first page provided in an embodiment of the present application.
[0107] like Figure 5 As shown, in addition to the table name, table remark information, and creation time, the first page 3 also includes an operation control corresponding to a main form, such as a second selection control 1112 corresponding to each main form.
[0108] For other specific contents of the above S5124, please refer to the above S5121 and will not be repeated here.
[0109] S5125: In response to the user's second selection operation on at least one first selection control, determine at least one main form identifier corresponding to the second selection operation; and in response to the second selection operation on the second selection control corresponding to the at least one main form identifier, display a second page; wherein the second page includes at least one third selection control corresponding to at least one sub-form identifier; one sub-form identifier corresponds to one third selection control.
[0110] Figure 6 This is a schematic diagram of another visual information of the first form provided in an embodiment of the present application.
[0111] like Figure 6 As shown, in one implementation, the visual information corresponding to the first form may be another page containing field information in the first form, for example, the second page 4 .
[0112] The second page 4 includes multiple areas, namely a navigation area and a selection area 21. The top navigation area 201 includes a "Home" logo. The left navigation area 202 includes business module classifications, such as the console and master data table navigation logo 2021. The selection area 21 includes a sub-form display area 211 and a query area 212. The sub-form display area 211 includes multiple sub-forms (first forms), such as sub-forms C1-C6. The field information of the first form may include key fields, such as table name, table remark information, creation time, etc. Each sub-form (first form) corresponds to a third selection control 2111 (not shown one by one in the figure). The query area 212 includes a query text box 2121. The query text box 2121 supports fuzzy matching of forms through information such as table name keywords or remark information.
[0113] Continue as in 4 (a) and Figure 5 、 Figure 6 As shown, the computing device displays the first page 3 (eg, Figure 5 The computing device responds to a first selection operation on a first selection control 1111 corresponding to a main form C in the first page 3, obtains the main form C, and then responds to a second selection operation on a second selection control 1112 (selecting a sub-form) associated with the main form C, displays the second page 4 (as shown). Figure 6 shown).
[0114] S5126: In response to a third selection operation of the user on at least one third selection control on the second page, determining a sub-form identifier corresponding to at least one main form identifier corresponding to the third selection operation.
[0115] Optionally, S5126 includes S5126a-S5126b.
[0116] S5126a: The computing device responds to the user's selection operation of a third selection operation on at least one third selection control.
[0117] Continue to combine Figure 4 and Figure 6 As shown, the computing device selects the sub-form C1 in response to the selection operation of the third selection operation of the at least one third selection control 2111 .
[0118] S5126b: The computing device determines at least one second form from a database associated with at least one data source based on at least one main form identifier and at least one sub-form identifier in response to the user's operation on the main data table navigation identifier and the core operation control operation of the "Generate Code" identifier on the second page.
[0119] Continue to combine Figure 5 and Figure 6As shown, the computing device displays the first page 3 in response to the user's operation on the main data table navigation mark on the second page 4. Then, in response to the operation of the core operation control 1122 marked with "Generate Code" on the first page 3, the main form C and the subform C1 are obtained.
[0120] Optionally, a core operation control marked with "Generate Code" can be directly set in the second page 4 (not shown in the figure), without the need to jump back to the first page 3 to obtain the core operation control marked with "Generate Code", which will not be repeated here.
[0121] S6: Filling the target field in the at least one second form into the code template to obtain the target code. The target field is a field obtained by parsing the at least one second form.
[0122] S6 includes S61-S62.
[0123] S61: Convert the configuration information and target fields into template data.
[0124] The following continues to explain by taking obtaining two second forms as an example.
[0125] In one embodiment, when both second forms are primary forms, the computing device can create a hash table (HashMap) to store the data. Specifically, the target fields and configuration information from the selected second form are formatted and placed into the HashMap to obtain template data. This template data can include table information, column information, and other metadata.
[0126] Continuing with the above example, extract field information from main form A and main form B, such as the table name, sub-table name, comment, primary key, and current time, and use the extracted field information as the target field. Furthermore, write the target field and pre-configured configuration information into a HashMap to obtain the template data.
[0127] The following is a specific example of how to obtain template data. First, extract the target fields in main form A and main form B, where the target fields include table name, comments, and primary key. For example, the table name of main form A can be obtained through the "tableEntityA.getTableName()" method, such as the table name of main form A is "tableA_tableName". The comments of main form A can be obtained through the "tableEntityA.getComments()" method, such as "tableA_comments". The primary key of main form A can be obtained through the "tableEntityA.getPk()" method, such as "tableA_pk". You can use the "tableEntityB.getTableName()" method to get the table name of the main form B, such as the table name of the main form B is "tableB_tableName"; you can use the "tableEntityB.getComments()" method to get the comments of the main form B, such as the comments of the main form B is "tableB_comments"; you can use the "tableEntityB.getPk()" method to get the primary key of the main form B, such as the primary key of the main form B is "tableB_pk".
[0128] Secondly, obtain the pre-configured configuration information. For example, the main path can be obtained by the "config.getString("mainPath")" method, such as "mainPath1"; the package name can be obtained by the "config.getString("package")" method, such as "package1"; the module name can be obtained by the "config.getString("moduleName")" method, such as the module name "moduleName1"; the software development kit can be obtained by the "config.getString("sdkName")" method, such as "sdkName1"; the access target service Url address can be obtained by the "config.getString("feignUrl")" method, such as "feignUrl1"; the author can be obtained by the "config.getString("author")" method, such as "author1"; the author's email address can be obtained by the "config.getString("email")" method, such as "email1".
[0129] Finally, based on the field information and configuration information of the above example, the template data is obtained.
[0130] In another embodiment, when the two second forms include both a main form and a corresponding subform, field information (e.g., table name, subtable name, comment, primary key, and current time) is extracted from main form C and subform C1 corresponding to main form C. The extracted field information is used as the target field. Furthermore, the target field and configuration information are written to a HashMap.
[0131] The following is a second specific example of how to obtain template data.
[0132] Extract the target fields from the main form C and the subform C1 corresponding to the main form C, where the target fields include the table name, comments, and primary key. For example, the table name of the main form C can be obtained through the "tableEntityC.getTableName()" method, such as the table name of the main form C is "tableC_tableName"; the comments of the main form C can be obtained through the "tableEntityC.getComments()" method, such as the comments of the main form C "tableC_comments"; and the primary key of the form C can be obtained through the "tableEntityC.getPk()" method, such as the primary key of the main form C is "tableC_pk". You can use the "tableEntityC1.getTableName()" method to get the table name of subform C1, such as "tableC1_tableName" for subform C1. You can use the "tableEntityC1.getComments()" method to get the comments of main form C1, such as "tableC1_comments" for main form C1. You can also use the "tableEntityC1.getPk()" method to get the primary key of subform C1, such as "tableC1pk" for subform C1. To add a relationship between main form C and subform C1, for example, set the foreign key of subform C1 to point to the primary key of main form C, that is, "map.put("tableC1_fk",tableEntityC.getPk());".
[0133] S62: Obtaining target code based on the mapping relationship between the template data and the code template.
[0134] In one embodiment, based on the mapping relationship, the template engine inserts the template data into the corresponding position of the code template to obtain the target code. Continuing with the above example, based on the mapping relationship, the template engine replaces the template data stored in the HashMap with the placeholder in the code template to obtain the target code.
[0135] The following specifically illustrates how to obtain the target code based on the mapping relationship between the template data and the code template.
[0136] Continuing with the above example, obtain the code template, and generate a compressed package corresponding to the target code based on the template data and the obtained code template. Specifically, the code template list is obtained by calling the "getTemplates()" method, and the obtained template list is "templates". Use "for(String template:templates){" to traverse each code file in the code template list. Use "sw" to save the generated code content. Load the template file through the Velocity engine, where "Template" is the name of the template file; use "tpl.merge(context,sw);" to merge the code file with the template parameters to generate the final code content. Compress the final code content in a ZIP compressed file.
[0137] It should be noted that when at least one second form includes two main forms, the ZIP compressed file usually includes two independent files, namely, a first target code file corresponding to the main form A, and a second target code file corresponding to the main form B. Of course, the ZIP compressed file may also include one target code file, that is, a case where there is only one main form, such as the main form C, which is not specifically limited here.
[0138] Optionally, the user may further personalize the target code, specifically, generating visual information corresponding to the target code; and updating the target code in response to an interactive operation on the visual information corresponding to the target code to obtain an updated target code.
[0139] Exemplarily, a first instruction input by a user is obtained, where the first instruction is used to update the target code; wherein the first instruction includes at least one of an operation type, an update object, and update information. According to the first instruction, the target code is adjusted to obtain the adjusted target code. Exemplarily, the operation type may include "add," "delete," "modify," etc. The update object may include "code function requiring adjustment," "variable requiring adjustment," etc. The update information may include "detailed information related to the operation, such as a new field name," etc.
[0140] In summary, the computing device can automatically retrieve the corresponding second form through interaction with the user and automatically generate code based on it to meet specific business requirements. In this way, code corresponding to specific business requirements under the target business can be generated, effectively handling complex and diverse code generation scenarios.
[0141] In other embodiments, the code generation method may not utilize configuration information when generating target code.
[0142] Figure 7It is a flowchart of a code generation method provided by another exemplary embodiment of the present application.
[0143] Figure 8 It is a system framework diagram of a code generation method provided by another exemplary embodiment of the present application.
[0144] like Figure 7 and Figure 8 As shown, in another exemplary embodiment of the present application, the code generation method may not use the configuration information when generating the target code, and may include the following steps:
[0145] S01: Acquire business data, where the business data includes at least one first form related to a target business.
[0146] S02: Configure at least one data source corresponding to at least one database supported by the target business.
[0147] S03: configuring a code template corresponding to the target business. The code template is a code framework in a preset mode related to the target business. The code framework corresponds to the general business logic related to the target business.
[0148] S04: Determine at least one second form from the at least one first form, where the at least one second form corresponds to at least one sub-business in the target business.
[0149] S05: Generate target code based on the at least one second form and the code template, where the target code is used to operate a target field in the at least one second form; the target field is a field obtained by parsing the at least one second form.
[0150] In one embodiment, taking the case where both second forms are main forms as an example, S05 includes S051 - S052.
[0151] In one example, a HashMap may be created to store data. That is, the target fields in the selected second form are formatted and placed into the HashMap to obtain template data.
[0152] Continuing with the above example, extract the field information from main form A and main form B, such as table name, sub-table name, comment, primary key, and current time, and use the extracted field information as the target field and write it into the HashMap to obtain the template data.
[0153] The following is a specific example of template data.
[0154] Extract the target fields in main form A and main form B, where the target fields include table name, comments, and primary key. For example, the table name of main form A can be obtained through the "tableEntityA.getTableName()" method, such as the table name of main form A is "tableA_tableName", the comments of main form A can be obtained through the "tableEntityA.getComments()" method, and the comments of main form A are "tableA_comments"; the primary key of main form A can be obtained through the "tableEntityA.getPk()" method, such as the primary key of main form A is "tableA_pk". The table name of main form B can be obtained through the "tableEntityB.getTableName()" method, such as the table name of main form B is "tableB_tableName", the comments of main form B can be obtained through the "tableEntityB.getComments()" method, such as the comments of main form B are "tableB_comments", and the primary key of main form B can be obtained through the "tableEntityB.getPk()" method, such as the primary key of main form B is "tableB_pk".
[0155] S052: Obtain target code based on the mapping relationship between the template data and the code template.
[0156] S052 can refer to the specific content of S62 above, which will not be repeated here.
[0157] In summary, the computing device can automatically retrieve the corresponding second form through interaction with the user and automatically generate code based on it to meet specific business requirements. In this way, code corresponding to specific business requirements under the target business can be generated, effectively handling complex and diverse code generation scenarios.
[0158] To facilitate understanding, the following examples illustrate specific scenarios of two code generation scenarios for S5 and S6.
[0159] In example 1, a computing device generates target codes corresponding to a user information table and a user-role association table, wherein the user information table is a master data table and the user-role association table is also a master data table.
[0160] Figure 9 This is a visual information flow chart of code generation provided in an embodiment of the present application.
[0161] like Figure 4 and Figure 9 As shown, the computing device responds to the user on the browser page 2 (such as Figure 4(a) in FIG. 1 ) inputs an input operation to open the visual code generation tool, and the first page 5 (as shown in FIG. 1 ) is displayed. Figure 9 As shown in (a) in the figure), the data table display area in the first page 5 includes multiple main data tables corresponding to user resources, such as "system_users", "system_usersrole", etc. The computing device responds to the user's first selection operation 01 of the first selection control 51 corresponding to "system_users" and the first selection operation 02 of the first selection control 52 corresponding to "system_users role" in the first page 5. Then, in response to the user's operation 03 on the core operation control 53 marked with "Generate Code" in the first page 5, the first page 5 is updated to obtain the first page 5 (as shown in the figure). Figure 9 As shown in (b) in FIG, the first page 6 includes a download file 61. Based on the download file 61, two first target files are obtained, and then the target code is obtained.
[0162] Exemplarily, the target code in the first target file may include the author, the author's email address, the table name, such as "user information table", etc. The target code in the first target file may include the author, the author's email address, the table name, such as "user and role association table", etc.
[0163] Example 2: The computing device generates target codes corresponding to the CDOS resource dashboard table and the CDOS resource dashboard details table, wherein the CDOS resource dashboard table is the main data table and the CDOS resource dashboard details table is the sub-data table of the CDOS resource dashboard table.
[0164] Figure 10 This is another code-generated visual information flow chart provided in an embodiment of the present application.
[0165] like Figure 4 and Figure 10 As shown, the computing device responds to the user on the browser page 2 (such as Figure 4 (a) in FIG. 1 ) inputs an input operation to open the visual code generation tool, and the first page 7 (as shown in FIG. 1 ) is displayed. Figure 9 As shown in (a) in FIG, the data table display area in the first page 7 includes multiple main data tables corresponding to CDOS resources, such as "qw_cdos_resource_board", "qw_cdos_com_key_config", etc. The computing device responds to the user's selection operation 04 of the first selection control 71 corresponding to "qw_cdos_resource_board" in the first page 7. Further, in response to the second selection operation 05 of the second selection control 72 (e.g., selecting a sub-table) corresponding to "qw_cdos_resource_board" in the first page 7, the second page 8 (e.g., Figure 10As shown in (b) in the figure, the data table display area in the second page 8 includes multiple sub-data tables corresponding to CDOS resources, such as "qw_cdos_resource_board_detail". The computing device responds to the user's third selection operation 07 of the third selection control 81 corresponding to "qw_cdos_resource_board_detail" in the second page 8. Then, the computing device responds to the user's operation 08 of the main data table navigation mark 82 corresponding to "qw_cdos_resource_board" in the second page 8, and displays the first page 7 (such as Figure 10 As shown in (a) in FIG), the computing device responds to the user's selection operation 09 of the core operation control 73 of the "Generate Code" identification in the first page 7, and displays the first page 9 (as shown in FIG. Figure 10 As shown in (c) in FIG, the first page 9 includes a download file 91, and a target code is obtained based on the file to be downloaded 91.
[0166] For example, the target code may include a table name, such as "CDOS-Resource Dashboard", a function of paging and querying the CDOS-Resource Dashboard list, a format of returned results, and the like.
[0167] Corresponding to the aforementioned embodiments of the code generation method, the present application also provides embodiments of a code generation device.
[0168] Figure 11 This is a schematic diagram of a code generation device provided in an embodiment of the present application.
[0169] like Figure 11 As shown, the code generating apparatus 1100 may include an acquisition module 1110 , a configuration module 1120 , a determination module 1130 , a generation module 1140 and an update module 1150 .
[0170] The acquisition module 1110 is configured to: acquire business data in response to a user's input operation, where the business data includes at least one first form related to the target business; the configuration module 1120 is configured to: configure a code template corresponding to the target business in response to a user configuration operation, where the code template is a code framework in a preset mode related to the target business; the code framework is compatible with general business logic related to the target business; the determination module 1130 is configured to: acquire at least one second form selected by the user from at least one first form; the generation module 1140 is configured to: fill the target field in at least one second form into the code template to obtain the target code.
[0171] In a possible implementation, the determination module 1130 is specifically configured to: generate visual information corresponding to at least one first form; and determine at least one second form in response to an interactive operation on the visual information corresponding to the at least one first form.
[0172] In one possible implementation, the generation module 1140 is further specifically configured to: convert configuration information and target fields into template data; the configuration information is used to define the relevant personalized business logic and custom fields of the target business; and the target code is obtained based on the mapping relationship between the template data and the code template.
[0173] In one possible implementation, the determination module 1130 is further specifically configured to: determine at least one second form from at least one first form based on at least one data source corresponding to the target business; wherein the at least one data source is used to represent the association relationship between the visualization information of the at least one first form and the at least one first form in the database.
[0174] In a possible implementation, the configuration module 1120 is further specifically configured to: configure at least one data source corresponding to at least one database supported by the target service.
[0175] In a possible implementation, the configuration module 1120 is further specifically configured to: configure configuration information corresponding to the target service; the configuration information is used to define personalized service logic related to the target service.
[0176] In one possible implementation, the code generation device 1100 also includes: an update module 1150, and a generation module 1130, which are further specifically configured to: generate visual information corresponding to the target code; the update module 1150 is configured to: update the target code in response to the interactive operation for the visual information corresponding to the target code to obtain an updated target code.
[0177] The present application also provides a computing device, comprising: a processor and a memory; the processor and the memory are coupled; the memory is used to store program instructions; and the processor is used to execute the program instructions to perform a method as in any implementation manner in the above embodiments.
[0178] In some embodiments, the computing device may include a server, a terminal, or other device, such as a rack server or blade server; the computing device includes one or more processors and a memory. The memory is configured to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the code generation method of the above-described embodiment.
[0179] Figure 12This is a schematic diagram of a computing device provided in an embodiment of the present application.
[0180] like Figure 12 As shown, the computing device 1200 includes a processor 1201 and a memory 1202. Exemplarily, the computing device 1200 may further include a communication interface 1203 and a communication bus 1204.
[0181] The processor 1201, memory 1202, and communication interface 1203 communicate with each other via a communication bus 1204. The communication interface 1203 may include a transmitter and a receiver for communicating with other devices or a communication network, and may be a wired interface (port), such as a fiber distributed data interface (FDDI) or a gigabit Ethernet interface (GE).
[0182] In some embodiments, the processor 1201 is configured to execute a program 1205, specifically, the relevant steps in the above-mentioned inference task execution method embodiment. Specifically, the program 1205 may include program code, which includes computer-executable instructions.
[0183] For example, processor 1201 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement some embodiments of the present application. The computing device 1200 may include one or more processors of the same type, such as one or more CPUs, or different types of processors, such as one or more CPUs and one or more ASICs. The CPU may be a single-core CPU (single-CPU) or a multi-core CPU (multi-CPU).
[0184] In some embodiments, the memory 1202 is used to store the program 1205. The memory 1202 may include a high-speed random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory.
[0185] The program 1205 can be specifically called by the processor 1201 to enable the computing device 1200 to perform the code generation method operation.
[0186] Some embodiments of the present application provide a computer-readable storage medium storing at least one executable instruction. When the executable instruction is executed on a computing device 1200, the computing device 1200 executes the code generation method in the above embodiment.
[0187] The executable instructions may be specifically configured to cause the computing device 1200 to perform code generation method operations.
[0188] For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0189] Some embodiments of the present application provide a chip system for use in a server. The chip system includes one or more interface circuits and one or more processors. The interface circuits and processors are interconnected via circuits. The interface circuits are configured to receive signals from the server's memory and send signals to the processors. The signals include computer instructions stored in the memory. When the server processor executes the computer instructions, the server executes the steps of the code generation method described in the above method embodiment.
[0190] The beneficial effects that can be achieved by the readable storage medium provided in some embodiments of the present application can be referred to the beneficial effects of the corresponding code generation method provided above, and will not be repeated here.
[0191] It should be noted that, in the application, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0192] Each embodiment in this specification is described in a related manner. Similar portions between the embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences from other embodiments. In particular, the device embodiments are generally similar to the method embodiments, so their description is relatively simple. For related portions, refer to the description of the method embodiments.
[0193] The logic and / or steps represented in the flowchart or otherwise described herein may be considered, for example, as an ordered list of executable instructions for implementing logical functions, and may be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device).
[0194] For the purposes of this specification, a "computer-readable medium" can be any apparatus that can contain, store, communicate, propagate, or transport the program for use by or in connection with an instruction execution system, apparatus, or device.
[0195] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection having one or more wires (electronic device), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic device, and a portable compact disc read-only memory (CDROM).
[0196] In addition, the computer readable medium can even be paper or other suitable medium on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, and then editing, interpreting or processing it in other suitable ways as necessary, and then storing it in the computer memory. It should be understood that various parts of the present application can be implemented in hardware, software, firmware or a combination thereof.
[0197] In the above-described embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one or a combination of the following technologies known in the art can be used: a discrete logic circuit having logic gate circuits for implementing logic functions on data signals, an application-specific integrated circuit having suitable combinational logic gate circuits, a programmable gate array (PGA), a field-programmable gate array (FPGA), etc. The above-described embodiments are merely specific embodiments of the present application and are not intended to limit the scope of protection of the present application. Any modifications, equivalent substitutions, improvements, etc. made based on the technical solutions of the present application shall be included within the scope of protection of the present application.
Claims
1. A code generation method, characterized in that: include: In response to a user input operation, obtaining business data, the business data including at least one first form related to a target business; In response to a configuration operation by a user, obtaining a code template corresponding to the target service, wherein the code template includes a code framework in a preset mode related to the target service; The code framework corresponds to the general business logic related to the target business; Acquire at least one second form selected by the user from the at least one first form, where the at least one second form corresponds to at least one sub-business in the target business; Fill the target field in the at least one second form into the code template to obtain a target code. The target field is a field obtained by parsing the at least one second form.
2. The method according to claim 1, characterized in that The obtaining, from the at least one first form, at least one second form selected by the user, comprises: Based on at least one data source corresponding to the target business, determine the at least one second form from the at least one first form; wherein the at least one data source is used to represent the association relationship between the visualization information of the at least one first form and the at least one first form in the database.
3. The method according to claim 2, characterized in that The determining, based on the at least one data source corresponding to the target business, from the at least one first form, the at least one second form includes: generating visual information corresponding to the at least one first form; In response to a user's interactive operation on the visual information corresponding to the at least one first form, the at least one second form is determined from a database associated with at least one data source.
4. The method according to claim 3, characterized in that Generating visual information corresponding to the at least one first form includes: In response to the address information entered by the user in the browser, a first page corresponding to the target business is displayed in the browser; the first page includes at least one main form identifier corresponding to the first form corresponding to the target business, a first selection control and a second selection control corresponding to each main form identifier.
5. The method according to claim 4, characterized in that The determining, in response to a user's interactive operation on the visual information corresponding to the at least one first form, from a database associated with at least one data source, the at least one second form comprises: In response to a user interaction with the first selection control identified by at least one of the primary forms, the at least one second form is determined from a database associated with at least one data source.
6. The method according to claim 4, characterized in that The determining, in response to an interactive operation on the visual information corresponding to the at least one first form, from a database associated with at least one data source, the at least one second form comprises: Responding to a user's interactive operation on the first selection control corresponding to at least one of the first form identifiers, obtaining at least one main form identifier; In response to a user's interactive operation on the second selection control corresponding to the main form identifier, displaying a second interface, the second interface including the at least one sub-form identifier corresponding to the main form identifier and a third selection control; In response to a user's interactive operation on the third selection control, obtaining at least one sub-form identifier corresponding to the main form identifier; The at least one second form is determined from a database associated with at least one data source based on the at least one main form identifier and the at least one subform identifier.
7. The method according to any one of claims 1 to 6, characterized in that Filling the target field in the at least one second form into the code template to obtain the target code includes: Converting the configuration information and the target fields into template data; the configuration information is used to define personalized business logic and custom fields related to the target business; The target code is obtained based on the mapping relationship between the template data and the code template.
8. The method according to claim 1, characterized in that After generating the target code based on the at least one second form and the code template, the method further includes: generating visual information corresponding to the target code; In response to a user's interactive operation on the visual information corresponding to the target code, the target code is updated to obtain the updated target code.
9. A code generating device, characterized in that: The device comprises: An acquisition module is configured to: acquire business data in response to a user's input operation, wherein the business data includes at least one first form related to a target business; a configuration module configured to: in response to a user's configuration operation, configure a code template corresponding to the target service, wherein the code template includes a code framework in a preset mode related to the target service; the code framework corresponds to a common service logic related to the target service; A determination module is configured to: obtain at least one second form selected by the user from the at least one first form, where the at least one second form corresponds to at least one sub-business in the target business; The generating module is configured to: fill the target field in the at least one second form into the code template to obtain the target code; the target field is a field obtained by parsing the at least one second form.
10. A computing device, characterized in that The computing device includes a memory and a processor; the memory and the processor are coupled; the memory is used to store computer program code, and the computer program code includes computer instructions. When the processor is used to execute the computer instructions, the computing device executes the code generation method according to any one of claims 1 to 8.