Code generation method and apparatus, platform, electronic device, and storage medium
Through the combination of neural network models and basic code templates, the code for application or business system is automatically generated, which solves the problem of slow code generation speed in the existing technology, and achieves rapid delivery and efficient development.
Patent Information
- Application Number
- PCT/CN2023/122395
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2025-04-03
AI Technical Summary
The existing technology is difficult to quickly generate code for applications or business systems, resulting in a prolonged development cycle and unable to meet rapid changes in market demand.
By obtaining the characteristic information of the target system, using the neural network model to obtain the structural information of the database table, and combining it with the basic code template, the front-end and back-end code of the target system is automatically generated.
It realizes intelligent and automated processes from business keywords to code generation, shortens development resource investment, improves the rapid delivery capabilities of projects, and allows ordinary business personnel to quickly generate target systems without understanding coding knowledge.
Smart Images

Figure CN2023122395_03042025_PF_FP_ABST
Abstract
Description
Code generation method, platform, device, electronic device and storage medium Technical Field
[0001] Embodiments of the present disclosure relate to a code generation method, platform, device, electronic device, and storage medium. Background Art
[0002] With the advancement of computer technology and the continuous emergence of internet technologies, all industries have joined the wave of the internet era. The development of applications and business systems has become increasingly important. Due to the unpredictable nature of market demand, it is crucial to shorten the development cycle of applications and business systems as much as possible when making business adjustments.
[0003] Summary of the Invention
[0004] At least one embodiment of the present disclosure provides a code generation method, comprising: obtaining characteristic information of a target system to be generated; calculating the characteristic information using a neural network model to obtain first table information of a database table of the target system; and generating target code for the target system based on the first table information and a basic code template.
[0005] For example, in the code generation method provided in an embodiment of the present disclosure, the basic code template is generated based on a template engine tool.
[0006] For example, in the code generation method provided in an embodiment of the present disclosure, the neural network model includes a generator and a discriminator, and the neural network model is used to calculate the feature information to obtain the first table information of the database table of the target system, including: the generator generates second table information based on the feature information; the discriminator determines whether the second table information is true, and in response to the discriminator determining that the second table information is true, the neural network model outputs the second table information as the first table information; in response to the discriminator determining that the second table information is not true, the generator regenerates the second table information based on the feature information and the second table information until the discriminator determines that the second table information is true.
[0007] For example, in the code generation method provided in an embodiment of the present disclosure, the target code includes a front-end code and a back-end code, the front-end code is used to enable the target system to interact with a user, and the back-end code is used to enable the target system to interact with a server, and the target code of the target system is generated based on the first table information and the basic code template, including: combining the first table information with the basic code template to generate the back-end code; and generating the front-end code based on the basic code template.
[0008] For example, in the code generation method provided in an embodiment of the present disclosure, the first table information is combined with the basic code template to generate the back-end code, including: creating a table structure based on the basic code template and the first table information; building and configuring the system structure of the target system based on the basic code template; and generating the back-end code based on the basic code template, the table structure and the system structure.
[0009] For example, in the code generation method provided in one embodiment of the present disclosure, the system structure of the target system is built and configured based on the basic code template, including: building the directory structure of the target system; and generating code files through the basic code template according to the dependencies and plug-ins, system configuration information and log output information of the target system.
[0010] For example, in the code generation method provided in an embodiment of the present disclosure, the dependencies of the target system include database middleware for encapsulating data layer operations.
[0011] For example, in the code generation method provided in an embodiment of the present disclosure, the back-end code is a hierarchical design structure, and the back-end code is generated based on the basic code template, the table structure and the system structure, including: according to the hierarchical design structure, using the basic code template to generate a class corresponding to the table structure; and based on the class corresponding to the table structure, generating the back-end code corresponding to the system structure.
[0012] For example, in the code generation method provided in one embodiment of the present disclosure, the front-end code is generated based on the basic code template, including: initializing the front-end project of the target system; dividing the target system into modules to split the target system into multiple modules; generating the code of the page in the target system based on the basic code template; and configuring the interface of the target system based on the basic code template.
[0013] For example, in the code generation method provided in an embodiment of the present disclosure, the code of the page in the target system includes: interface structure and layout code, interface data loading and logic control code, and interface style display code.
[0014] For example, in the code generation method provided in an embodiment of the present disclosure, the first table structure includes: a table structure of a database table and a mapping field relationship.
[0015] For example, the code generation method provided in an embodiment of the present disclosure further includes: updating the basic code module according to the modification of the basic code module.
[0016] An embodiment of the present disclosure provides a code generation platform, which includes: a feature acquisition unit, configured to acquire feature information of a target system to be generated; and a code generation unit, configured to calculate the feature information using a neural network model to obtain first table information of a database table of the target system; and generate target code for the target system based on the first table information and a basic code template.
[0017] For example, the platform provided in one embodiment of the present disclosure further includes: a system dashboard, configured to obtain user management operations and manage the code generated using the platform according to the management operations; and a component selection unit, configured to obtain user selection operations on at least one component, so that the code generation unit adds the at least one component selected by the user to the target system as a dependency of the target system.
[0018] For example, the platform provided in one embodiment of the present disclosure also includes: a text editor configured to obtain text written by a user; a code previewer configured to display the target code in response to a preview operation input by the user; and a file export unit configured to export the target code in response to an export operation of the user.
[0019] For example, the platform provided in an embodiment of the present disclosure further includes: a code template management unit configured to manage the basic code template.
[0020] For example, the platform provided in an embodiment of the present disclosure further includes: an application management unit configured to manage the target system generated by the platform according to the management operation.
[0021] For example, the platform provided in an embodiment of the present disclosure further includes: a multiple data source management unit configured to determine the data source of the target system according to the system determined by the user application management unit.
[0022] For example, in the platform provided in an embodiment of the present disclosure, the target code includes front-end code and back-end code, the front-end code is used to enable the target system to interact with a user, and the back-end code is used to enable the target system to interact with a server, and the code generation unit includes: a form construction sub-unit, configured to use a neural network model to calculate the feature information to obtain the first table information of the database table of the target system; an engineering construction sub-unit, configured to build and configure the system structure of the target system based on the basic code template; and a code generation sub-unit, configured to create a table structure based on the basic code template and the first table information, generate the back-end code based on the basic code template, the table structure and the system structure, and generate the front-end code based on the front-end configuration information and the basic code template, and generate the front-end code based on the basic code template.
[0023] For example, the platform provided in an embodiment of the present disclosure further includes: a component management unit configured to manage the component in response to a user's processing operation on the component.
[0024] At least one embodiment of the present disclosure provides a code generation device, including: an acquisition unit, configured to acquire characteristic information of a target system to be generated; a neural network model unit, configured to calculate the characteristic information using a neural network model to obtain first table information of a database table of the target system; and a generation unit, configured to generate target code for the target system based on the first table information and a basic code template.
[0025] At least one embodiment of the present disclosure provides an electronic device, comprising the processor and the memory, including one or more computer program instructions, wherein the one or more computer program instructions are stored in the memory and, when executed by the processor, implement instructions of the code generation method provided by any embodiment of the present disclosure.
[0026] At least one embodiment of the present disclosure provides a computer-readable storage medium that non-temporarily stores computer-readable instructions, wherein when the computer-readable instructions are executed by a processor, the code generation method provided by any embodiment of the present disclosure is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly introduced below. Obviously, the drawings in the following description only relate to some embodiments of the present disclosure, rather than limiting the present disclosure.
[0028] FIG1 shows a flowchart of a code generation method provided by at least one embodiment of the present disclosure;
[0029] FIG2 is a schematic diagram showing the principle of a neural network model provided by at least one embodiment of the present disclosure;
[0030] FIG3A shows a flow chart of a method for generating backend code by combining first table information with a basic code template, provided by at least one embodiment of the present disclosure;
[0031] FIG3B shows a schematic diagram of a backend code directory structure provided by at least one embodiment of the present disclosure;
[0032] FIG3C shows a correspondence relationship between Java classes in different layers provided by at least one embodiment of the present disclosure;
[0033] FIG3D shows a flow chart of a method for generating backend code provided by at least one embodiment of the present disclosure;
[0034] FIG4A shows a flow chart of a method for generating front-end code based on front-end configuration information and a basic code template, provided by at least one embodiment of the present disclosure;
[0035] FIG4B shows a schematic diagram of a system file structure provided by at least one embodiment of the present disclosure;
[0036] FIG4C shows a schematic diagram of a front-end code directory structure provided by at least one embodiment of the present disclosure;
[0037] FIG5 shows a flow chart of a method for developing a target system provided by at least one embodiment of the present disclosure;
[0038] FIG6 is a schematic block diagram of a code generation platform provided in some embodiments of the present disclosure;
[0039] FIG7A is a schematic block diagram of a code generation device provided by some embodiments of the present disclosure;
[0040] FIG7B is a schematic block diagram of an electronic device provided in some embodiments of the present disclosure;
[0041] FIG8 shows a schematic block diagram of another electronic device provided by at least one embodiment of the present disclosure; and
[0042] FIG9 is a schematic diagram of a storage medium provided in some embodiments of the present disclosure. DETAILED DESCRIPTION
[0043] To make the purpose, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0044] Unless otherwise defined, the technical or scientific terms used in this disclosure should have the usual meanings understood by people with ordinary skills in the field to which this disclosure belongs. The words "first", "second" and similar words used in this disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, words such as "one", "an" or "the" do not indicate a quantity limitation, but rather indicate the existence of at least one. Words such as "include" or "comprise" mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Words such as "connect" or "connected" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the object being described changes, the relative positional relationship may also change accordingly.
[0045] Business system development requires developers to rewrite code from scratch. This creates a significant workload and a lengthy development timeframe. Therefore, reducing this workload and improving business system development efficiency has become a pressing issue. With the advancement of computer technology, code generation tools are becoming increasingly popular. However, existing code generation tools can only automatically generate code for basic functions like querying, adding, and deleting data, failing to achieve true automated code generation.
[0046] In order to cope with the large number of business projects and insufficient human resources and to achieve rapid development and delivery of business systems, a more intelligent and universal platform tool is needed, so that ordinary business personnel can quickly and independently generate the desired business system through the platform tool without having to understand or be familiar with non-professional knowledge such as code writing and software systems.
[0047] At least one embodiment of the present disclosure provides a code generation method. The method includes: obtaining feature information of a target system to be generated; calculating the feature information using a neural network model to obtain first table information of a database table of the target system; and generating target code of the target system based on the first table information and a basic code template. At least one embodiment of the present disclosure provides a code generation platform, which includes a feature acquisition unit and a code generation unit, wherein the feature acquisition unit is configured to obtain feature information of a target system to be generated; and the code generation unit is configured to calculate the feature information using a neural network model to obtain first table information of a database table of the target system; and generating target code of the target system based on the first table information and a basic code template. The generation method or generation platform automatically generates the structural design of the database table using a neural network model, and embeds the database table into the basic code template. Through intelligent and automated means, it realizes the process from input of business keywords (i.e., feature information) to final successful operation, while reducing the investment of development resources and improving the rapid delivery capability of the project.
[0048] FIG1 shows a flowchart of a code generation method provided by at least one embodiment of the present disclosure.
[0049] As shown in FIG1 , the generating method includes steps S10 to S30 .
[0050] Step S10: Acquire characteristic information of the target system to be generated.
[0051] Step S20: Calculate the characteristic information using a neural network model to obtain first table information of a database table of the target system.
[0052] Step S30: Generate target code of the target system based on the first table information and the basic code template.
[0053] Through intelligent generative AI tools, a series of corresponding structured database table structures are generated according to the input keywords. This code generation method can reduce the investment of development resources while improving the rapid delivery capability of projects or target systems. Through intelligent, automated, and process-based means, it can achieve successful operation from the input of feature information to the final operation, allowing ordinary business personnel to independently and quickly generate the desired target system without having to understand or be familiar with non-professional knowledge such as code writing and software systems.
[0054] In step S10, the target system is, for example, a system that implements a business, such as a logistics system or a personnel management system. The characteristic information describes the key characteristics of the target system. For example, for a logistics system, the characteristic information may include "physical" and "order." Keywords such as "physical" and "order" may be input by a user into the code generation platform that executes the code generation method.
[0055] In step S20, the first table information of the database table may include, for example, the number of database tables, the table structure of each database table, and the mapping field relationship. The table structure may include, for example, the fields contained in the data table, the field name, field type, and width of each field. The mapping field relationship may, for example, refer to the mapping relationship between multiple fields.
[0056] Neural network models can be trained using data. For example, for a logistics system, keywords such as "physics" and "order" can be input into the neural network model. The output of the neural network model is then compared with the logistics system's database table. Based on the comparison results, the parameters in the neural network model are modified so that the output of the neural network model gradually approaches the logistics system's database table, thus obtaining a trained neural network model.
[0057] In some embodiments of the present disclosure, the neural network model may be an adversarial neural network model. The training of the adversarial neural network model is a form of unsupervised learning and does not require labeling of history.
[0058] For example, generative artificial intelligence (AI) can transform basic business keywords provided by users into corresponding field types, then classify them based on the fields and their attributes, ultimately generating multiple different table structures and mapping field relationships for that business. Generative AI is a type of AI that creates new content based on what it learns from existing content. The process of learning from existing content is called training, and it produces a statistical model when given a prompt. AI uses the model to predict what the expected response might be, thereby generating new content. Essentially, it learns the basic structure of the data and can then generate new samples similar to its training data.
[0059] For example, the adversarial neural network model includes a generator and a discriminator. Step S20 includes: the generator generates second table information based on feature information; the discriminator determines whether the second table information is true. In response to the discriminator determining that the second table information is true, the neural network model outputs the second table information as the first table information; in response to the discriminator determining that the second table information is false, the generator regenerates the second table information based on the feature information and the second table information until the discriminator determines that the second table information is true. For a description of this method, please refer to Figure 2 below.
[0060] For example, logistics and order are input as keywords into the code generation platform. The code generation platform uses a neural network model to obtain the table structure of the database table, which includes multiple fields, namely order number, delivery time, payment time, etc. The order number, delivery time and payment time correspond to each other.
[0061] In step S30, the basic code template is generated based on a template engine tool. For example, an organization or company may utilize the generation platform provided by an embodiment of the present disclosure, and developers of the organization or company may utilize the template engine tool on the generation platform to generate the basic code template so that other developers or product managers of the organization or company who do not have programming skills can directly use the basic code template to generate target code.
[0062] In some embodiments of the present disclosure, the template engine tool is, for example, Velocity. Velocity is an open source template engine tool that allows developers to write the required code templates according to its syntax requirements. By using a lightweight template engine like Velocity and standardized code templates, developers can quickly become familiar with its syntax structure and quickly develop code templates. At the same time, the generated business code has a unified, standard, and market-mainstream style, allowing developers to more quickly familiarize themselves with the code when conducting secondary development between different business projects.
[0063] For example, the first table information is embedded in the basic code template to obtain the target code. For example, the table structure and mapping field relationships are embedded in the basic code template, thereby facilitating the generation of the target code based on the pre-set system structure in the basic code template. In some embodiments of the present disclosure, the target code includes front-end code and back-end code, where the front-end code is used to enable the target system to interact with users, and the back-end code is used to enable the target system to interact with servers.
[0064] For example, the front-end code provides an interactive interface for users and receives user operations through the interactive interface. The front-end and back-end interact, for example, through an interface, providing instructions generated by user operations to the back-end code, which is then executed by the back-end code and the server. The interface for front-end and back-end interaction may conform to the RESTful (Representational State Transfer) interface design specification.
[0065] In some embodiments of the present disclosure, step S30 includes: combining the first table information with the basic code template to generate backend code; and generating frontend code based on the basic code template. For a description of this embodiment, please refer to Figure 3A below. It should be noted that although the generation of the frontend code and the backend code is two steps in this embodiment, in reality, the frontend code and the backend code can be generated synchronously based on the basic code template, which is a single operation.
[0066] FIG2 shows a schematic diagram of the principles of a neural network model provided by at least one embodiment of the present disclosure.
[0067] As shown in FIG2 , the neural network model may be an adversarial neural network model, including a generator 201 and a discriminator 202 .
[0068] When training the adversarial neural network model, a random perturbation vector parameter is input to the generator. In the disclosed embodiment, the random perturbation vector parameter is a key feature, such as "logistics" or "order." The generator generates current data based on the random perturbation vector parameter. For example, based on "logistics" or "order," the generator creates a table structure and maps field relationships.
[0069] The current data and the original data are then input into the discriminator 202, which determines whether the current data and the original data are authentic. The original data, for example, is a table structure and mapping field relationships in a real logistics system. If the discriminator 202 determines that the current data is not authentic, it adjusts the parameters of the generator 201 based on the original and current data until the discriminator 202 is unable to distinguish between the original data and the data generated by the generator, completing the training of the adversarial neural network model. That is, the training process for the generator 201 and the discriminator 202 in the dotted box in Figure 2 requires multiple cycles to complete the training of the adversarial neural network model.
[0070] The use of the adversarial neural network model is similar to the training process of the adversarial neural network model. For example, the key features are input into the generator 201, which generates a table structure and mapping field relationship. The discriminator 202 determines whether the table structure and mapping field relationship are true. If the table structure and mapping field relationship are true, the table structure and mapping field relationship are output. If the table structure and mapping field relationship are not true, the table structure and mapping field relationship are provided to the generator, and a new table structure and mapping field relationship is generated from the table structure and mapping field relationship. The new table structure and mapping field relationship is used as the first table information.
[0071] FIG3A shows a flow chart of a method for combining first table information with a basic code template to generate backend code, provided by at least one embodiment of the present disclosure.
[0072] As shown in FIG3A , the method includes steps S31 to S33 .
[0073] Step S31: Create a table structure based on the basic code template and the first table information.
[0074] Step S32: Building and configuring the system structure of the target system based on the basic code template.
[0075] Step S33: Generate backend code based on the basic code template, table structure and the system structure.
[0076] In step S31, the table structure is expressed using Structured Query Language (SQL). For example, the table structure and mapping field relationships are embedded into a basic code template, and a SQL script for the table structure and mapping field relationships is generated. For example, the table structure and mapping field relationships replace or fill in corresponding portions in the basic code template, thereby generating a SQL script.
[0077] After obtaining the SQL script representing the table structure and the mapping field relationship, execute the SQL script to initialize the table structure.
[0078] For step S32, for example, building and configuring the system structure of the target system includes: building the directory structure, directory and file names of the target system; and adding configuration to the directory structure.
[0079] For example, after initializing the table structure, initialize the Spring Boot project. For example, use Maven to create and initialize a Spring Boot project. Maven is a management and build tool specifically designed for Java projects. Spring Boot is a comprehensive framework that integrates the Spring technology stack and simplifies Spring application development. Creating and initializing a Spring Boot project using Maven involves the following steps: select a Maven project, and then create the appropriate directory structure, directories, and file names according to Spring Boot's directory requirements.
[0080] For example, adding configuration to the directory structure includes: generating corresponding code files through basic code templates based on dependencies and plug-ins selected or provided by the user (if the user does not select or provide, the default values set by the system are used), system configuration information, and log output information.
[0081] The target system's dependencies and plug-ins can be user-entered or selected on the interactive interface, or they can be default. Dependency and plug-in selection can include, for example, selecting open source components and their versions, selecting proprietary components, or selecting a database type. System configuration information includes, for example, the database address, connection pool configuration, and the program's main configuration file. System configuration information can also be default or user-configured.
[0082] The target system's dependencies include data middleware, such as MyBatis-Plus. This data middleware enables direct access to the database, encapsulating data-layer operations and reducing the need to write SQL statements. Combining Velocity with MyBatis-Plus not only enables custom code development, but also fully leverages the characteristics of MyBatis-Plus as a data middleware, allowing the generated code to naturally integrate MyBatis-Plus and reduce the need to reinvent the wheel.
[0083] Log output information may include, for example, output format, file size, and log path.
[0084] FIG3B shows a schematic diagram of a backend code directory structure provided by at least one embodiment of the present disclosure.
[0085] As shown in Figure 3B, the backend code directory structure includes the project name as the main directory. This main directory contains src, main, and the Java source code. The next level below the Java source code is the project package path. Below the project package path are the reusable class layer (bean) (for details on the reusable class layer, see the description below), the configuration layer (config), the interface description layer (controller), the business logic layer (service), the single domain description layer (manager), and the database table operation access layer (mapper).
[0086] The bean layer includes six objects: query object (qo), application object (ao), business object (bo), database operation object (data object, do / entity) and data transformation object (data transform object, dto).
[0087] The query object is the input parameter of the query interface (referred to as "input parameter"), which is the input parameter of the control sublayer. The application object is the input parameter object of the interface for adding or modifying, that is, the input parameter of the control sublayer. The business object is the input parameter of the control sublayer and the management sublayer when adding or modifying. The database operation object corresponds one-to-one to the database table, and this object is only used within the mapping sublayer and the management sublayer. The data transfer object is the object that the database object is converted before being transmitted, that is, the output parameter of the management sublayer (referred to as "output parameter"). The bean layer can also include view objects (vo), which are objects returned by the query interface that requires data aggregation, that is, the output parameter of the control sublayer.
[0088] The configuration layer is used to configure backend interface documents, such as Knife4j configuration files. The interface description layer describes all interface parameters, including input and output parameters, and access types. The business logic layer defines business logic and primarily conducts secondary development. The single-domain description layer handles general business operations and is the semantic layer for SQL operations. The database table operation access layer, inherited from Mybatis, is used for data interaction with the database. It corresponds one-to-one with database tables.
[0089] As shown in FIG3B , the directory structure further includes a program launcher (DemoApplication) serving as the entry point for the program.
[0090] The directory structure also includes the program's main configuration files (resources). The program's main configuration files include, for example, the database table structure file (db), XML file (mapper), the program's main configuration file (application.yaml), and the log configuration file (logback-spring.xml).
[0091] For example, the database table structure file uses Liquibase to ensure consistency across different environments. XML files are used by Mybatis and correspond one-to-one with database tables. The program's main configuration file includes port definitions, database and connection pool configuration, and more. The log configuration file includes output format, file size, and log path.
[0092] As shown in FIG3B , the directory structure may further include a unit test directory (test), and the user may decide whether to develop this part.
[0093] As shown in FIG3B , the directory structure may also include file information (Dockerfile) for building a Docker image file and all dependency management files (pom.xml) used in the project.
[0094] As shown in FIG3B , the directory structure may further include external libraries and temporary file editing environments (scratches and consoles).
[0095] In step S33, for example, a code corresponding to the system structure is generated according to the table structure.
[0096] In some embodiments of the present disclosure, the backend code is a hierarchical design structure. Step S33, for example, includes generating a class corresponding to the table structure using a basic code template based on the hierarchical design structure; and generating a backend code corresponding to the system structure based on the class corresponding to the table structure.
[0097] In some embodiments of the present disclosure, when generating a JavaBean corresponding to a database table, a corresponding Java class is generated based on the different hierarchical design structures of the backend code. The hierarchical structure and corresponding relationship are shown in Figure 3B. JavaBean is a reusable, cross-platform software component. That is, JavaBean is a special, reusable Java class that must have a parameterless constructor, all properties are private, and access to member properties is achieved by providing setter and getter methods.
[0098] For example, in step S33 , Java codes for each layer corresponding to each table are generated respectively.
[0099] FIG. 3C illustrates a correspondence relationship between Java classes in different layers provided by at least one embodiment of the present disclosure.
[0100] As shown in FIG3C , the backend code includes a service layer (service layer) and a reusable class layer (bean layer).
[0101] The service layer includes the above-mentioned interface description layer, business logic layer, single domain description layer and database table operation access layer.
[0102] In Figure 3C, "I" represents input and "O" represents output. For example, the input of the interface description layer corresponds to the query object and the application object, and the output of the interface description layer corresponds to the data transmission object.
[0103] The input of the business logic layer corresponds to query objects and business objects, and the output of the business logic layer corresponds to data transfer objects.
[0104] The input of the single domain description layer corresponds to the query object, and the output of the single domain description layer corresponds to the data transmission object.
[0105] The input and output of the database table operation access layer correspond to data transfer objects.
[0106] In some embodiments of the present disclosure, the generated backend source code supports JavaBean layering at varying granularities, from one to six objects. This not only meets the complex business logic needs of large projects, but also satisfies the simple business logic requirements of small projects. Database table fields are associated at the business level, with logical associations performed only at the code level, minimizing database operations.
[0107] FIG3D shows a flow chart of a method for generating backend code provided by at least one embodiment of the present disclosure.
[0108] As shown in FIG3D , the method includes steps S301 to S306 .
[0109] Step S301: Create a table structure. For example, combine the table information output by the neural network model with the basic code template to generate an SQL script. This step is similar to step S31 in Figure 3A.
[0110] Step S302: Initialize the table structure. For example, execute an SQL script to initialize the table structure.
[0111] Step S303: Initialize the Spring Boot project. For example, use Maven to create the Spring Boot project and initialize it.
[0112] Step S304: Building the project directory structure and configuring the directory structure. Building the project directory structure and configuring the project directory structure based on the dependencies and plug-ins, system configuration information, and log output format selected by the user.
[0113] Step S303 and step S304 are similar to step S32 in FIG. 3A .
[0114] Step S305: Generate backend code and frontend code corresponding to the directory structure based on the table structure. This step is similar to step S33 in Figure 3A. For example, the backend code and frontend code corresponding to the directory structure are generated using a basic code template. That is, in some embodiments of the present disclosure, the backend code and frontend code are generated synchronously based on the basic code template.
[0115] In some embodiments of the present disclosure, after the backend code and the frontend code are generated, they can be run locally to verify the backend code and the frontend code.
[0116] Step S306: Generate the system deployment file Dockerfile. After obtaining the deployment file Dockerfile, you can run the deployment file locally to verify it.
[0117] As shown in FIG3D , in addition to steps S301 to S306 , the method may further include steps S307 to S308 .
[0118] After the backend code and the frontend code are generated, if the target system is deployed, steps S306 to S308 are executed.
[0119] Step S307: Joint debugging of the front-end code and the back-end code.
[0120] Step S308: Export the compressed package of the target system for secondary development.
[0121] FIG4A shows a flow chart of a method for generating front-end code based on front-end configuration information and a basic code template, provided by at least one embodiment of the present disclosure.
[0122] As shown in FIG. 4A , the method includes steps S41 to S44 .
[0123] Step S41: Initialize the front-end project of the target system.
[0124] Step S42: Divide the target system into modules to split the target system into multiple modules.
[0125] Step S43: Generate the code of the page in the target system based on the basic code template.
[0126] Step S44: Based on the basic code template, configure the interface of the target system.
[0127] Regarding step S41 , for example, when the front-end project is initialized, a public resource directory and a source code directory are generated. At this time, there is no content in the source code, for example, the data interface layer in the source code is empty.
[0128] For step S42, for example, it includes dependency definition of the Package.json file, global routing settings, and system file structure management.
[0129] The package.json file describes a project or module package and contains a lot of metadata, such as the project name, version, entry point, and contributors. The npm install command uses this file to download all dependent modules.
[0130] Global routing settings include, for example, setting a global access interface.
[0131] FIG4B shows a schematic diagram of a system file structure provided by at least one embodiment of the present disclosure.
[0132] As shown in Figure 4B , System 1 (also referred to as "Project 1") is divided into Project 1, Project 2, ..., Project n. Projects can be further divided into modules. For example, Project 1 includes Module 1.1, Module 1.2, and Module 1.n. The next level below Module 1.1 is a number of database tables (e.g., Database Table 1, Database Table 2, and Database Table n). For example, Project 2 includes Module 2.1, Module 2.2, and Module 2.n.
[0133] For step S43, the page code includes, for example, interface structure and layout code, interface data loading and logic control code, and interface style display code. For example, the page code is added to the basic code template.
[0134] Step S44 includes, for example, the division of interface modules, interface definition and parameter transfer, and interface debugging. For example, the configuration of the interface is added to the basic code template.
[0135] In some embodiments of the present disclosure, when developing an overall project, a hierarchical design of projects, projects, modules, and data tables is performed to meet the needs of projects at different levels, such as large, medium, and small.
[0136] FIG4C shows a schematic diagram of a front-end code directory structure provided by at least one embodiment of the present disclosure.
[0137] As shown in Figure 4C, the front-end code directory structure includes the project main directory (e.g., resource manager), dependency package installation directory (e.g., node_modules), public resource directory (public), and source code (src). The source code directory includes the data interface layer (api), global components (components), layout files (layout), routing files (router), global state files (store), custom style files (styles), global utility classes (utiles), view layer (views), and unit tests (tests).
[0138] The data interface layer stores definitions related to data interfaces. Global components store common components. Layout files are referenced in routing files. When there are many routes, routing files can be managed by modules. Global state files store state data such as global management required by the application. The view layer interacts with users and implements specific business logic. The view layer includes files such as the application's main entry point and routing restriction control files. For example, the unit test directory includes environment configuration files.
[0139] FIG5 shows a flow chart of a method for developing a target system provided by at least one embodiment of the present disclosure.
[0140] As shown in FIG5 , the method includes steps S501 to S508 .
[0141] Step S501: Inputting random perturbation vector parameters into the neural network model. Please refer to the description of FIG2 above for this step.
[0142] Step S502: The neural network model outputs a table field list and its associated relationships. The table field list and its associated relationships are examples of the first table information.
[0143] Step S503: The table field list and its associated relationships are combined with the source code template and the deployment template to generate backend code and frontend code. In this example, the basic code template includes the source code template and the deployment template. This step is similar to step S30 in Figure 1.
[0144] Step S504: Output the back-end source code project (i.e., back-end code) and the front-end source code project (i.e., front-end code). For example, the back-end code includes the Java source code for CRUD, where CRUD refers to the abbreviations of the initials of the words Create, Retrieve, Update, and Delete when performing calculations. It is mainly used to describe the basic operating functions of the DataBase or persistence layer in the software system. For example, the front-end code includes source code based on Vue. Vue is an open source JavaScript framework for creating user interfaces, and is also a web application framework for creating single-page applications.
[0145] Step S505: Compile and build the source code. For example, the front-end source code is compiled using Node, and the back-end source code is compiled using Maven. Node is JavaScript running on the server and is an event-driven I / O server-side JavaScript environment. For example, compiling and building the source code requires the server to have a random port generated for the front-end, a back-end Maven environment, a front-end Node environment, a middleware environment, and a Docker environment.
[0146] Step S506: Generate a front-end code image file and a back-end code image file.
[0147] Step S507: deploy and run the image file.
[0148] Step S508: deploying a front-end Uniform Resource Locator (URL), through which the target system can be accessed.
[0149] Some embodiments of the present disclosure provide code generation methods that connect and successfully run a series of basic operations, including project construction, database table structure design, interface code writing for adding, deleting, modifying, and querying, front-end and back-end code debugging, code packaging, and build deployment. This reduces development resource investment while improving the project's rapid delivery capabilities. Through intelligent, automated, and streamlined methods, the process from business keyword input to successful operation is achieved, allowing ordinary business personnel to quickly and independently generate the desired platform system without having to understand or be familiar with code writing, software systems, or other non-professional knowledge.
[0150] Some embodiments of the present disclosure use an intelligent generative structure to search, refine, classify, associate, and summarize input business keywords, generate multiple database table structures related to the input keywords, and then use standardized Velocity code templates combined with the data middleware function of MyBatis-plus to generate front-end and back-end source code, deployment files, project brief introduction files, etc. at different structural levels, and support code compilation, packaging, construction and other operations.
[0151] FIG6 is a schematic block diagram of a code generation platform 600 provided in some embodiments of the present disclosure.
[0152] As shown in FIG6 , the code generation platform 600 includes a front-end interaction unit 610 and a back-end management unit 620 .
[0153] Front-end interaction unit 610 includes a feature acquisition unit 611, configured to acquire feature information of the target system to be generated. For example, feature acquisition unit 611 is an input control into which a user can enter feature information of the target system, such as keywords such as "logistics" or "order." Feature acquisition unit 611, for example, executes step S10 in Figure 1.
[0154] Backend management unit 620 includes a code generation unit 621 configured to calculate feature information using a neural network model to obtain first table information of a database table of the target system; and to generate target code for the target system based on the first table information and a basic code template. Code generation unit 621, for example, performs step S20 in FIG1 .
[0155] In some embodiments of the present disclosure, the code generation unit 621 includes a project construction subunit 6211 , a form construction subunit 6212 , and a code generation subunit 6123 .
[0156] The project construction subunit 6211 is configured to build and configure the system structure of the target system. For example, the project construction subunit 6211 executes step S32 in FIG3A .
[0157] The form construction subunit 6212 is configured to calculate the feature information using a neural network model to obtain first table information of a database table of the target system. The form construction subunit 6212 executes step S20 in FIG1 , for example.
[0158] The code generation subunit 6213 is configured to create a table structure based on the basic code template and the first table information, generate the backend code based on the basic code template, the table structure and the system structure, and generate the frontend code based on the basic code template. The code generation subunit 6213, for example, performs step S30 in Figure 1.
[0159] In some embodiments of the present disclosure, the front-end interaction unit 610 may include a system dashboard 612 and a component selection unit 613 in addition to the feature acquisition unit 611 .
[0160] The system dashboard 612 is configured to obtain management operations of the user and manage the codes generated by the platform according to the management operations.
[0161] The component selection unit 613 is configured to obtain a user's selection operation on at least one component, so that the code generation unit adds the at least one component selected by the user to the target system as a dependency of the target system.
[0162] For example, a user creates at least one project using a code generation platform, and the at least one project has its own code. Project information of the at least one project can be displayed on the system dashboard to facilitate the user to manage each project.
[0163] Management operations include, for example, deleting a project, viewing project progress, modifying project code, and modifying project goals and personnel.
[0164] The component selection unit 613 displays multiple dependencies and plug-ins for the user to select on an interactive interface. The user selects the multiple dependencies and plug-ins as the target system's dependencies as needed. For example, if the user clicks a selection button corresponding to a target dependency, causing the selection button to be selected, the target dependency becomes the target system's dependency.
[0165] In some embodiments of the present disclosure, the front-end interaction unit 610 may further include a text editor 614 , a code previewer 615 , and a file export unit 616 .
[0166] The text editor 614 is configured to obtain the text written by the user. For example, the user can open the text editor 614 and edit code or text in the text editor 614.
[0167] The code previewer 615 is configured to display the target code in response to a preview operation input by the user. For example, in response to the user clicking a "code preview" icon in the interactive interface, the target code is displayed in at least a portion of the interactive interface.
[0168] The file export unit 616 is configured to export the target code in response to the user's export operation. For example, in response to the user clicking the "export" icon in the interactive interface, the target code is exported. For example, the target code is exported in the form of a compressed package.
[0169] In addition to the code generation unit 621, the backend management unit 620 may also include a code module management unit 622. The code template management unit 622 is configured to manage the basic code templates, for example, modify or delete the basic code templates.
[0170] In some embodiments of the present disclosure, the code template management unit 622 includes an interface specification definition subunit configured to define the interface specification in the basic code template.
[0171] The backend management unit 620 also includes an application management unit 623. The application management unit 623 is configured to manage the target system generated by the platform based on management operations. For example, the application management unit 623 manages the target system generated by the platform based on user management operations in the system dashboard. For example, if a user deletes, modifies, queries, or adds information to the logistics system through the system dashboard, the application management unit 623 will delete, modify, query, or add information to the logistics system in response to the user's operation on the system dashboard.
[0172] The backend management unit 620 further includes a multi-data source management unit 624. The multi-data source management unit 624 is configured to determine the data source of the target system according to the system type selected by the application management unit 623.
[0173] For example, a user creates a personnel management system and a logistics system using the code generation platform. If the user selects the personnel management system, the multi-data source management unit 624 determines the data source to be an Oracle database; if the user selects the logistics system, the multi-data source management unit 624 determines the data source to be a MySQL database. The data source corresponding to each system type can be set by the user on the front-end interactive interface.
[0174] In some embodiments of the present disclosure, the code generation platform 600 includes, in addition to the front-end interaction unit 610 and the back-end management unit 620 , a component management unit 630 configured to manage components in response to user processing operations on the components.
[0175] For example, a user can perform processing operations on the front-end interactive interface, and the component management unit manages the components in response to the processing operations. The processing operations include, for example, deletion, addition, and modification of information.
[0176] For example, if a user deletes a component that has not been used for a long time or has been eliminated in the front-end interactive interface, the component management unit 630 will delete the component that has not been used for a long time or has been eliminated in the back-end code. For another example, if a user adds a new component in the front-end interactive interface, the component management unit 630 will add the new component in the back-end code.
[0177] In some embodiments of the present disclosure, the code generation platform 600 may further include a cloud-based service access unit 640. The cloud-based service access unit 640, for example, provides an interface for a user to log in to the code generation platform. The user enters a username and password in the interface, and if the username and password are verified to be correct, the user is logged in to the account corresponding to the username.
[0178] The code generation platform 600 can use tools such as Jquery, Json (JavaScript Object Notation), Ajax (asynchronous JavaScript and XML) and Vue. jQuery is a JavaScript library that simplifies the process of client-side JavaScript programming, especially for HTML document traversal and manipulation, event handling, animation effects and Ajax operations. Using jQuery makes it easier to write maintainable JavaScript code while improving cross-browser compatibility. JSON is a lightweight data exchange format. Ajax is a method that combines several existing technologies, including: HTML or XHTML, CSS, JavaScript, DOM, XML, XSLT, and most importantly, the XMLHttpRequest object. When using the Ajax model that combines these technologies, web applications can quickly present incremental updates to the user interface without reloading (refreshing) the entire page. This allows the program to respond to user operations more quickly. The most attractive feature of Ajax is its "asynchronous" nature, which means that it can communicate with the server, exchange data and update the page without refreshing the page. Vue is a JavaScript framework for building user interfaces. It is built on standard HTML, CSS, and JavaScript, and provides a declarative, component-based programming model for efficiently developing user interfaces.
[0179] For example, the front-end and back-end of the code generation platform 600 communicate in accordance with the interface design specification RESTful.
[0180] The embodiments of the present disclosure provide an intelligent way to generate code. First, the template tool can be used to write the basic code template to be generated, and then the system to be generated is input with keywords or tags, and the corresponding data structure and form style are generated through the neural network model. According to the data structure and the basic code template, the corresponding system front-end code and back-end code are further generated. At the same time, the neural network model can be deployed and run according to the generated system code. Through this platform, ordinary users or product managers can generate and try out a demonstration-level basic platform system, and developers can also perform secondary development and optimization on the generated system. It reduces some repetitive work of developers when writing code, improves development efficiency, and also reduces the problems of inaccurate information, poor timeliness, high communication costs, etc. in the communication process between business personnel and IT personnel.
[0181] The platform implements the generation of front-end and back-end codes based on generative AI, Velocity, and MyBatis-Plus. Before generating the code, it supports the selection of commonly used open source components and their versions for the front-end and back-end, the selection of the company's own components, the selection of database types, the selection of project team members, the design definition of database table structure fields, the association of table fields, the setting of enumeration values, the preview of front-end and back-end source code, the preview of SQL script files, the upload of files / images, import and export, and other functions on the interface.
[0182] In some embodiments of the present disclosure, a lightweight template engine such as Velocity is used, so that developers can quickly become familiar with its syntax structure and quickly develop front-end and back-end code templates. The generated code is a unified standardized code, which is suitable for developers to quickly carry out secondary development.
[0183] In some embodiments of the present disclosure, the source code generated by the code generation platform 600 conforms to the mainstream of the industry, including back-end programming languages Java, SQL, XML, Dockerfile, as well as front-end programming languages Vue and JavaScript.
[0184] In some embodiments of the present disclosure, the code generation platform 600 automatically implements the complete link in the conventional development process from the input of business keywords to the complete operation of the system. The generated front-end and back-end codes are already normally usable and do not require front-end and back-end developers to perform joint debugging, which greatly reduces the very time-consuming joint debugging work in the system development process.
[0185] In some embodiments of the present disclosure, the code generation platform 600 provides intelligent code generation, intelligent source code deployment, intelligent program execution, and intelligent operation and maintenance management, enabling usage scenarios tailored to different user groups and supporting both primary project demonstrations and secondary project development.
[0186] In some embodiments of the present disclosure, the generated backend code includes tool codes collected, organized, and summarized by multiple backend developers in the company's long-term development work, such as RedisUtils, DateUtils, FileUtils, HttpUtils, MinUtils, PGUtils, IoTUtils, and other general, efficient, reliable, and complete tool classes, which reduces the need for other developers to reinvent the wheel. For the frontend, the generated code includes built-in commonly used interface templates of different styles, which not only meet the company's default interface style requirements but also allow for secondary development based on them.
[0187] FIG7A is a schematic block diagram of a code generating device 70 provided in some embodiments of the present disclosure.
[0188] As shown in Figure 7A, the code generation device 70 includes an acquisition unit 701, a neural network model unit 702, and a generation unit 703.
[0189] The acquisition unit 701 is configured to acquire characteristic information of the target system to be generated. The acquisition unit 701 executes step S10 in FIG1 , for example.
[0190] The neural network model unit 702 is configured to calculate the feature information using a neural network model to obtain first table information of the database table of the target system. The neural network model unit, for example, executes step S20 in FIG1 .
[0191] The generating unit 703 is configured to generate the target code of the target system based on the first table information and the basic code template. The generating unit 703 executes step S30 in FIG1 , for example.
[0192] The code generation device 70 can reduce the investment in development resources while improving the rapid delivery capability of the project or target system.
[0193] For example, the acquisition unit 701, the neural network model unit 702, and the generation unit 703 can be hardware, software, firmware, or any feasible combination thereof. For example, the acquisition unit 701, the neural network model unit 702, and the generation unit 703 can be dedicated or general-purpose circuits, chips, or devices, or a combination of a processor and a memory. The embodiments of the present disclosure do not limit the specific implementation of each of the above units.
[0194] It should be noted that in the embodiments of the present disclosure, the various units of the code generation device 70 correspond to the various steps of the aforementioned code generation method. For the specific functions of the code generation device 70, reference can be made to the relevant description of the code generation method, which will not be repeated here. The components and structure of the code generation device 70 shown in FIG7A are merely exemplary and non-restrictive. The generation device 70 may also include other components and structures as needed.
[0195] At least one embodiment of the present disclosure further provides an electronic device comprising a processor and a memory, wherein the memory comprises one or more computer program modules. The one or more computer program modules are stored in the memory and configured to be executed by the processor, wherein the one or more computer program modules comprise instructions for implementing the aforementioned code generation method. The electronic device can reduce development resource investment while improving the ability to quickly deliver projects or target systems.
[0196] Figure 7B is a schematic block diagram of an electronic device provided in some embodiments of the present disclosure. As shown in Figure 7B, the electronic device 700 includes a processor 710 and a memory 720. The memory 720 is used to store non-transitory computer-readable instructions (e.g., one or more computer program modules). The processor 710 is used to execute non-transitory computer-readable instructions, which can execute one or more steps in the image processing method described above when executed by the processor 710. The memory 720 and the processor 710 can be interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0197] For example, the processor 710 may be a central processing unit (CPU), a graphics processing unit (GPU), or other processing units with data processing capabilities and / or program execution capabilities. For example, the central processing unit (CPU) may be an X86 or ARM architecture. The processor 710 may be a general-purpose processor or a dedicated processor, and may control other components in the electronic device 700 to perform desired functions.
[0198] For example, the memory 720 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), a hard disk, an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), a USB memory, a flash memory, etc. One or more computer program modules may be stored on the computer-readable storage medium, and the processor 710 may execute one or more computer program modules to implement various functions of the electronic device 700. Various applications and various data, as well as various data used and / or generated by the applications, may also be stored in the computer-readable storage medium.
[0199] It should be noted that, in the embodiment of the present disclosure, the specific functions and technical effects of the electronic device 700 can be referred to the description of the generation method above, and will not be repeated here.
[0200] Figure 8 is a schematic block diagram of another electronic device provided in some embodiments of the present disclosure. This electronic device 800 is, for example, suitable for implementing the generation method provided in the embodiments of the present disclosure. The electronic device 800 may be a terminal device, etc. It should be noted that the electronic device 800 shown in Figure 8 is merely an example and does not impose any limitations on the functionality and scope of use of the embodiments of the present disclosure.
[0201] As shown in FIG8 , the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 810, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 820 or a program loaded from a storage device 880 into a random access memory (RAM) 830. Various programs and data required for the operation of the electronic device 800 are also stored in the RAM 830. The processing device 810, the ROM 820, and the RAM 830 are connected to each other via a bus 840. An input / output (I / O) interface 850 is also connected to the bus 840.
[0202] Typically, the following devices may be connected to the I / O interface 850: an input device 860 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 870 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 880 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 890. The communication device 890 may allow the electronic device 800 to communicate with other electronic devices wirelessly or by wire to exchange data. Although FIG8 shows the electronic device 800 with various devices, it should be understood that it is not required to implement or have all of the devices shown, and the electronic device 800 may alternatively implement or have more or fewer devices.
[0203] For example, according to an embodiment of the present disclosure, the above-mentioned generation method can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the above-mentioned generation method. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 890, or installed from the storage device 880, or installed from the ROM 820. When the computer program is executed by the processing device 810, the functions defined in the generation method provided in the embodiment of the present disclosure can be implemented.
[0204] The electronic device can reduce the investment in development resources while improving the ability to quickly deliver projects or target systems.
[0205] At least one embodiment of the present disclosure further provides a computer-readable storage medium for storing non-transitory computer-readable instructions. When executed by a computer, the non-transitory computer-readable instructions implement the aforementioned generation method. This computer-readable storage medium reduces development resource investment while improving the ability to rapidly deliver projects or target systems.
[0206] Figure 9 is a schematic diagram of a storage medium provided by some embodiments of the present disclosure. As shown in Figure 9, storage medium 900 is used to store non-transitory computer-readable instructions 910. For example, when non-transitory computer-readable instructions 910 are executed by a computer, one or more steps of the generation method described above may be performed.
[0207] For example, the storage medium 900 can be applied to the electronic device 700 described above. For example, the storage medium 900 can be the memory 720 in the electronic device 700 shown in FIG7B . For example, the relevant description of the storage medium 900 can refer to the corresponding description of the memory 720 in the electronic device 700 shown in FIG7B , and will not be repeated here.
[0208] There are a few points to note:
[0209] (1) The drawings of the embodiments of the present disclosure only relate to the structures involved in the embodiments of the present disclosure. Other structures may refer to conventional designs.
[0210] (2) In the absence of conflict, the embodiments of the present disclosure and the features therein may be combined with each other to form new embodiments.
[0211] The above description is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. The protection scope of the present disclosure shall be based on the protection scope of the claims.
Claims
1. A code generation method, comprising: Obtain characteristic information of the target system to be generated; Calculating the characteristic information using a neural network model to obtain first table information of a database table of the target system; as well as Based on the first table information and the basic code template, the target code of the target system is generated.
2. The method according to claim 1, wherein: The basic code template is generated based on a template engine tool.
3. The method according to claim 1 or 2, wherein: The neural network model includes a generator and a discriminator. The feature information is calculated using a neural network model to obtain first table information of a database table of the target system, including: The generator generates second table information according to the characteristic information; The discriminator determines whether the second table information is true. In response to the discriminator determining that the second table information is true, the neural network model outputs the second table information as the first table information; In response to the discriminator determining that the second table information is not authentic, the generator regenerates the second table information based on the feature information and the second table information until the discriminator determines that the second table information is authentic.
4. The method according to any one of claims 1 to 3, wherein: The target code includes a front-end code and a back-end code, wherein the front-end code is used to enable the target system to interact with a user, and the back-end code is used to enable the target system to interact with a server. Generating the target code of the target system based on the first table information and the basic code template includes: Combining the first table information with the basic code template to generate the backend code; and Based on the basic code template, the front-end code is generated.
5. The method according to claim 4, wherein: Combining the first table information with the basic code template to generate the backend code includes: Based on the basic code template and the first table information, create a table structure; Building and configuring the system structure of the target system based on the basic code template; and The backend code is generated based on the basic code template, the table structure and the system structure.
6. The method according to claim 5, wherein: Building and configuring the system structure of the target system based on the basic code template includes: Building the directory structure of the target system; and A code file is generated through the basic code template according to the dependencies and plug-ins of the target system, system configuration information and log output information.
7. The method according to claim 6, wherein: The dependencies of the target system include database middleware, which is used to encapsulate data layer operations.
8. The method according to claim 6, wherein: The backend code is a hierarchical design structure, and the backend code is generated based on the basic code template, the table structure and the system structure, including: According to the hierarchical design structure, the class corresponding to the table structure is generated using the basic code template; and Based on the class corresponding to the table structure, generate the backend code corresponding to the system structure.
9. The method according to any one of claims 4 to 8, wherein: Based on the basic code template, the front-end code is generated, including: Initializing the front-end engineering of the target system; Performing module division on the target system to split the target system into multiple modules; Based on the basic code template, generate code for the page in the target system; and Based on the basic code template, the interface of the target system is configured.
10. The method according to claim 9, wherein: The code of the page in the target system includes: Interface structure and layout code, interface data loading and logic control code, and interface style display code.
11. The method according to any one of claims 1 to 10, wherein: The first table structure includes: a table structure of a database table and a mapping field relationship.
12. The method according to any one of claims 1 to 11, further comprising: The basic code module is updated according to the modification to the basic code module.
13. A code generation platform comprising: A feature acquisition unit configured to acquire feature information of a target system to be generated; as well as A code generation unit is configured to calculate the feature information using a neural network model to obtain first table information of a database table of the target system; And based on the first table information and the basic code template, generate the target code of the target system.
14. The platform according to claim 13, further comprising: A system dashboard configured to obtain management operations of a user and manage the code generated using the platform according to the management operations; as well as The component selection unit is configured to obtain a user's selection operation on at least one component, so that the code generation unit adds the at least one component selected by the user to the target system as a dependency of the target system.
15. The platform according to claim 13 or 14, further comprising: A text editor configured to obtain text written by a user; as well as A code previewer, configured to display the target code in response to a preview operation input by a user; as well as The file exporting unit is configured to export the target code in response to an exporting operation of a user.
16. The platform according to any one of claims 13 to 15, further comprising: The code template management unit is configured to manage the basic code template.
17. The platform according to claim 16, wherein: The code template management unit includes: an interface specification definition subunit configured to define the interface specification in the basic code template.
18. The platform according to any one of claims 13 to 17, further comprising: The application management unit is configured to manage the target system generated by the platform according to the management operation.
19. The platform according to any one of claims 13 to 18, further comprising: The multiple data source management unit is configured to determine the data source of the target system according to the system determined by the user application management unit.
20. The platform according to any one of claims 13 to 19, wherein: The target code includes a front-end code and a back-end code, wherein the front-end code is used to enable the target system to interact with a user, and the back-end code is used to enable the target system to interact with a server. The code generation unit comprises: A form construction subunit is configured to calculate the characteristic information using a neural network model to obtain first table information of a database table of the target system; An engineering construction subunit configured to build and configure the system structure of the target system based on the basic code template; and The code generation subunit is configured to create a table structure based on the basic code template and the first table information, generate the backend code based on the basic code template, the table structure and the system structure, and generate the frontend code based on the basic code template.
21. The platform according to any one of claims 13 to 20, further comprising: The component management unit is configured to manage the component in response to a user's processing operation on the component.
22. A code generating device, comprising: An acquisition unit configured to acquire characteristic information of a target system to be generated; A neural network model unit, configured to calculate the feature information using a neural network model to obtain first table information of a database table of the target system; as well as A generating unit is configured to generate target code of the target system based on the first table information and a basic code template.
23. An electronic device, comprising: processor; a memory including one or more computer program instructions; The one or more computer program instructions are stored in the memory and are instructions for implementing the generation method according to any one of claims 1 to 12 when executed by the processor.
24. A computer-readable storage medium non-temporarily storing computer-readable instructions, wherein: When the computer-readable instructions are executed by a processor, the generation method according to any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
Code automatic generation method and apparatus
CN106648690A
Project engineering construction method and device based on IDEA plug-in
CN113805877A
Code generation method and device, storage medium and electronic device
CN114253546A
Generation method and device of persistent layer archived file, electronic equipment and medium
CN115268930A
Declarative design-time experience platform for code generation
US20160357526A1