Code generation method and system, electronic equipment and storage medium
By obtaining database and table selection instructions, returning data structures and objects, and using Beetl engine to generate code, the problem of low project development efficiency is solved, and efficient code generation and management is achieved.
Patent Information
- Application Number
- CN202311281982.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2025-03-28
AI Technical Summary
In the prior art, project development is low efficiency, making it difficult to manage code, waste resources and difficult to effectively utilize.
By obtaining database selection instructions and database table selection instructions, determine the target database and table generated by the code, return the corresponding data structure and objects, and generate the target code based on the Beetl engine.
It realizes efficient and rapid generation of target codes, improves the efficiency of project development, and improves the accuracy and flexibility of code through configuration information and hierarchical processing.
Smart Images

Figure CN119718277A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of code generation, and in particular relates to a code generation method, system, electronic equipment and storage medium. Background Art
[0002] When developing a project, developers often use their own programming habits to implement functions, which often results in a variety of frameworks that are not unified, and a chaotic and complex project structure. This will make it difficult to effectively manage the code, waste resources, and make it difficult to effectively use them. In addition, the efficiency of project development is low. Summary of the invention
[0003] The technical problem to be solved by the present invention is to overcome the defect of low efficiency of project development in the prior art and to provide a code generation method, system, electronic device and storage medium.
[0004] The present invention solves the above technical problems through the following technical solutions:
[0005] The present invention provides a code generation method, comprising the following steps:
[0006] Obtain a database selection instruction to determine a target database corresponding to code generation;
[0007] Obtain a database table selection instruction to determine a target database table corresponding to code generation;
[0008] Return the corresponding data structure and object according to the target database and target database table;
[0009] Generates object code based on data structures and objects.
[0010] This technical solution achieves efficient and rapid generation of target code, which can effectively improve the efficiency of project development.
[0011] Preferably, before returning the corresponding data structure and object according to the target database and the target database table, the code generation method further includes:
[0012] The configuration information for code generation is obtained, where the configuration information includes at least one of query condition configuration information, list display configuration information, and added display configuration information.
[0013] In this technical solution, by obtaining configuration information, code generation can be made more accurate and reasonable, and the flexibility of code generation can also be improved.
[0014] Preferably, the corresponding data structure and object are returned according to the target database and the target database table, specifically including:
[0015] Based on the query condition configuration information, the list display configuration information and / or the added display configuration information, corresponding data structures and objects are returned according to the target database and the target database table.
[0016] In this technical solution, the accuracy of the returned data structure and objects can be improved by querying condition configuration information and the like.
[0017] Preferably, generating target code based on data structures and objects specifically includes:
[0018] Based on the Beetl engine (a template engine), data structures and objects are filled into predetermined positions of a preset code template to form a target code.
[0019] In this technical solution, the efficiency and accuracy of generating target code can be effectively improved.
[0020] Preferably, after generating the target code based on the data structure and the object, the code generation method further comprises:
[0021] The target code is processed in layers according to the preset layered structure.
[0022] In this technical solution, the target code is processed in layers, which can facilitate project management and improve efficiency.
[0023] Preferably, the target code is processed in layers according to a preset layered structure, specifically including:
[0024] Determine whether to generate microservices;
[0025] If yes, a microservice is generated. The microservice is a four-layer structure consisting of a service logic layer, an external interface layer, a storage layer, and a model layer.
[0026] If not, a non-microservice is generated. The non-microservice is a three-layer structure consisting of a service logic layer, a storage layer, and a model layer.
[0027] In this technical solution, microservices or non-microservices can be generated on demand, thereby meeting different code generation requirements.
[0028] Preferably, after the step of performing hierarchical processing on the target code according to the preset hierarchical structure, the code generation method further comprises:
[0029] Determine whether to generate a project. If yes, generate a microservice project from a microservice or a non-microservice project from a non-microservice according to the preset project structure.
[0030] In this technical solution, projects can be generated on demand, and basic projects of microservice structure and basic projects of non-microservice architecture can be generated. Through the project hierarchical structure, a new project can be created by cloning, so as to achieve unified management of project versions and rapid project development and iteration.
[0031] Preferably, the code generation method further comprises: obtaining additional configuration information, the additional configuration information comprising: at least one of table prefix configuration information to be ignored, business line configuration information and project name configuration information.
[0032] In this technical solution, by obtaining additional configuration information, the pertinence and accuracy of code generation can be improved.
[0033] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the code generation method of the present invention is implemented when the processor executes the computer program.
[0034] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the code generation method of the present invention is implemented.
[0035] The present invention also provides a code generation system, comprising:
[0036] A library acquisition module is used to obtain a database selection instruction to determine a target database corresponding to code generation;
[0037] A table acquisition module is used to acquire a database table selection instruction to determine a target database table corresponding to code generation;
[0038] The return module is used to return the corresponding data structure and object according to the target database and the target database table;
[0039] The generation module is used to generate target code based on data structures and objects.
[0040] This technical solution achieves efficient and rapid generation of target code, which can effectively improve the efficiency of project development.
[0041] Preferably, the code generation system further comprises:
[0042] The configuration acquisition module is used to acquire configuration information for code generation, wherein the configuration information includes at least one of query condition configuration information, list display configuration information and added display configuration information.
[0043] This technical solution achieves efficient and rapid generation of target code, which can effectively improve the efficiency of project development.
[0044] Preferably, the return module returns corresponding data structures and objects according to the target database and the target database table based on the query condition configuration information, the list display configuration information and / or the added display configuration information.
[0045] In this technical solution, the accuracy of the returned data structure and objects can be improved by querying condition configuration information and the like.
[0046] Preferably, the generation module fills the data structure and the object into the predetermined position of the preset code template based on the Beetl engine to form the target code.
[0047] In this technical solution, the efficiency and accuracy of generating target code can be effectively improved.
[0048] Preferably, the code generation system further comprises:
[0049] The hierarchical module is used to perform hierarchical processing on the target code according to a preset hierarchical structure.
[0050] In this technical solution, the target code is processed in layers, which can facilitate project management and improve efficiency.
[0051] Preferably, the layering module determines whether to generate a microservice;
[0052] If yes, a microservice is generated. The microservice is a four-layer structure consisting of a service logic layer, an external interface layer, a storage layer, and a model layer.
[0053] If not, a non-microservice is generated. The non-microservice is a three-layer structure consisting of a service logic layer, a storage layer, and a model layer.
[0054] In this technical solution, microservices or non-microservices can be generated on demand, thereby meeting different code generation requirements.
[0055] Preferably, the code generation system further comprises:
[0056] The project generation module is used to determine whether to generate a project. If so, the microservice is generated into a microservice project according to the preset project structure, or the non-microservice is generated into a non-microservice project.
[0057] In this technical solution, projects can be generated on demand, and basic projects of microservice structure and basic projects of non-microservice architecture can be generated. Through the project hierarchical structure, a new project can be created by cloning, so as to achieve unified management of project versions and rapid project development and iteration.
[0058] Preferably, the code generation system further comprises: an additional acquisition module for acquiring additional configuration information, wherein the additional configuration information comprises: at least one of table prefix configuration information to be ignored, business line configuration information and project name configuration information.
[0059] In this technical solution, by obtaining additional configuration information, the pertinence and accuracy of code generation can be improved.
[0060] The positive progressive effect of the present invention is that the technical solution of the present invention realizes efficient and rapid generation of target code, which can effectively improve the efficiency of project development. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 This is a flowchart of the code generation method of embodiment 1 of the present invention.
[0062] Figure 2 This is a flowchart of an optional implementation of the code generation method of Example 1 of the present invention.
[0063] Figure 3 This is a schematic diagram of a code generation system according to Embodiment 2 of the present invention.
[0064] Figure 4 This is a schematic diagram of an optional implementation of the code generation system of Example 2 of the present invention.
[0065] Figure 5 This is a schematic diagram of the structure of an electronic device according to Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0066] The present invention is further described below by way of examples, but the present invention is not limited to the scope of the examples.
[0067] Example 1
[0068] This embodiment provides a code generation method. Figure 1 , the code generation method comprises the following steps:
[0069] Step S1: Obtain a database selection instruction to determine a target database corresponding to code generation.
[0070] Step S2: Obtain a database table selection instruction to determine a target database table corresponding to code generation.
[0071] Step S3: Return corresponding data structures and objects according to the target database and the target database table.
[0072] Step S4: Generate target code based on the data structure and the object.
[0073] The code generation method of this embodiment realizes efficient and rapid generation of target code, which can effectively improve the efficiency of project development.
[0074] As an optional implementation, the code generation method of this embodiment is implemented based on an electronic device, which can be a computer or a server. In specific implementation, a user interface is set on the electronic device to receive the user's operation instructions. First, according to step S1, a database selection instruction is obtained to determine the target database corresponding to the code generation. Among them, the optional databases include MySQL (a database) and PgSQL (a database). The user can select MySQL or PgSQL as the target database through the user interface.
[0075] Then, according to step S2, a database table selection instruction is obtained to determine a target database table corresponding to code generation.
[0076] As an optional implementation, refer to Figure 2 Before step S3, the code generation method further includes the following steps:
[0077] Step S21, obtain configuration information for code generation. The configuration information includes at least one of query condition configuration information, list display configuration information and add display configuration information. In specific implementation, the user interface can be used for users to select or input configuration information. By setting the query condition configuration information, the object encapsulation Query (a query parameter class) of the condition in the interface can be queried; by setting the list display configuration information, the returned object encapsulation DTO (data transfer object) in the interface can be queried; when adding display configuration information for object addition operations, the parameter encapsulation DTO is specified. By obtaining configuration information, code generation can be made more accurate and reasonable, and the flexibility of code generation can be improved.
[0078] Next, according to step S3, the corresponding data structure and object are returned according to the target database and the target database table. In an optional embodiment, based on the query condition configuration information and the list display configuration information, the corresponding data structure and object are returned according to the target database and the target database table. In another optional embodiment, based on the query condition configuration information and the added display configuration information, the corresponding data structure and object are returned according to the target database and the target database table. In yet another optional embodiment, based on the query condition configuration information, the list display configuration information and the added display configuration information, the corresponding data structure and object are returned according to the target database and the target database table. By querying the condition configuration information, etc., the accuracy of the returned data structure and object can be improved.
[0079] Then, according to step S4, the target code is generated based on the data structure and the object. In some optional embodiments, the data structure and the object are filled into the predetermined position of the preset code template based on the Beetl engine to form the target code, thereby effectively improving the efficiency and accuracy of generating the target code.
[0080] Next, in some optional implementations, the code generation method further includes:
[0081] Step S5: hierarchically process the target code according to the preset hierarchical structure.
[0082] During specific implementation, in step S5, it is determined whether to generate a microservice; if so, a microservice is generated, and the microservice is a four-layer structure consisting of a service logic layer, an external interface layer, a storage layer, and a model layer; if not, a non-microservice is generated, and the non-microservice is a three-layer structure consisting of a service logic layer, a storage layer, and a model layer.
[0083] The service logic layer includes:
[0084] service->layer core folder description;
[0085] rest->controller;
[0086] service->Business logic service, or more precisely, the business logic assembly layer;
[0087] convert->converter;
[0088] exception->custom exception;
[0089] rpc->call other feign (service) encapsulation, record remote call input parameters, output parameters, and exceptions;
[0090] constant->measured for this service;
[0091] validation->encapsulates all validation logic.
[0092] The storage layer includes:
[0093] Configuration->MyBatis configuration class
[0094] criteria->Query condition class (generated by code generation tool)
[0095] entity->entity class
[0096] mapper->mapper (mapping file) class
[0097] repository->warehouse layer (isolates the business logic layer to directly interact with the database)
[0098] resource / mapper->mapper's XML (Extensible Markup Language).
[0099] As an optional implementation method, all feign services provided to the outside are uniformly defined in the external interface layer.
[0100] The model layer includes:
[0101] dto->dto (data transfer object) of interface interaction;
[0102] Request->query encapsulated request class;
[0103] vo->Returns the vo (view object) class of the page.
[0104] In some optional implementations, the code generation method further includes: obtaining additional configuration information. The additional configuration information includes: at least one of table prefix configuration information to be ignored, business line configuration information, and project name configuration information. The user sets the additional configuration information through the user interface. For example, if the table prefix configuration information to be ignored is not set, the generated table name is "tb_company"; if the table prefix configuration information to be ignored is set, the generated table name is "company", that is, the prefix "tb_" is ignored. Setting the business line configuration information can standardize the business line naming rules. Setting the project name configuration information can standardize the project naming rules.
[0105] In some optional implementations, by specifying the database and table, the basic CRUD (create, add data; read, read data; update, modify data; delete) functions are implemented by integrating the encapsulation components of MyBatis (a persistence layer framework). And the encapsulation components are integrated to control the same version management of the components. Among them, commonly used objects such as status codes and return value objects are encapsulated. In addition, the use of MyBatis components is encapsulated, the configuration and properties of swagger (a framework) are encapsulated, and commonly used tool classes are encapsulated.
[0106] Based on the code generation method of this embodiment, it is possible to realize the generation of repeated codes, unify the relevant basic classes of return values and status codes, thereby reducing repetitive work; specify the hierarchical modules of the project, set the hierarchical code standards and usage, thereby realizing code standardization; encapsulate components to realize component reuse, unify components, and efficiently optimize the use of components, thereby realizing the unification of components and tools.
[0107] Example 2
[0108] This embodiment provides a code generation system. Figure 3The code generation system includes: a library acquisition module 501, used to acquire a database selection instruction to determine a target database corresponding to code generation; a table acquisition module 502, used to acquire a database table selection instruction to determine a target database table corresponding to code generation; a return module 503, used to return corresponding data structures and objects according to the target database and the target database table; a generation module 504, used to generate target code based on the data structure and the object.
[0109] The code generation system of this embodiment realizes efficient and rapid generation of target code, which can effectively improve the efficiency of project development.
[0110] As an optional implementation, the code generation system of this embodiment is implemented based on an electronic device, which can be a computer or a server. In specific implementation, a user interface is set on the electronic device to receive the user's operation instructions. First, the library acquisition module 501 obtains a database selection instruction to determine the target database corresponding to the code generation. Among them, the optional databases include MySQL and PgSQL. The user can select MySQL or PgSQL as the target database through the user interface.
[0111] Then, the table acquisition module 502 acquires the database table selection instruction to determine the target database table corresponding to the code generation.
[0112] As an optional implementation, refer to Figure 4 , the code generation system also includes a configuration acquisition module 505. Before returning the corresponding data structure and object according to the target database and the target database table, the configuration acquisition module 505 obtains the configuration information for code generation. Among them, the configuration information includes: at least one of query condition configuration information, list display configuration information and add display configuration information. During specific implementation, the user interface can be used for users to select or input configuration information. Among them, by setting the query condition configuration information, the object encapsulation Query of the condition in the interface can be queried; by setting the list display configuration information, the returned object encapsulation DTO in the interface can be queried; when adding the display configuration information for the object adding operation, the parameter encapsulation DTO is specified. By obtaining the configuration information, the code generation can be made more accurate and reasonable, and the flexibility of the code generation can be improved.
[0113] Next, the return module 503 returns the corresponding data structure and object according to the target database and the target database table. In an optional embodiment, based on the query condition configuration information and the list display configuration information, the corresponding data structure and object are returned according to the target database and the target database table. In another optional embodiment, based on the query condition configuration information and the added display configuration information, the corresponding data structure and object are returned according to the target database and the target database table. In yet another optional embodiment, based on the query condition configuration information, the list display configuration information and the added display configuration information, the corresponding data structure and object are returned according to the target database and the target database table. By querying the condition configuration information, etc., the accuracy of the returned data structure and object can be improved.
[0114] Then, the generation module 504 generates the target code based on the data structure and the object. In some optional embodiments, the generation module 504 fills the data structure and the object into the predetermined position of the preset code template based on the Beetl engine to form the target code, thereby effectively improving the efficiency and accuracy of generating the target code.
[0115] In some optional implementations, the code generation system further includes a hierarchical module 506. After generating the target code based on the data structure and the object, the hierarchical module 506 performs hierarchical processing on the target code according to a preset hierarchical structure.
[0116] During specific implementation, the layering module 506 determines whether to generate a microservice; if so, a microservice is generated, and the microservice is a four-layer structure consisting of a service logic layer, an external interface layer, a storage layer, and a model layer; if not, a non-microservice is generated, and the non-microservice is a three-layer structure consisting of a service logic layer, a storage layer, and a model layer.
[0117] The service logic layer includes:
[0118] service->layer core folder description;
[0119] rest->controller;
[0120] service->Business logic service, or more precisely, the business logic assembly layer;
[0121] convert->converter;
[0122] exception->custom exception;
[0123] rpc->call other feign (service) encapsulation, record remote call input parameters, output parameters, and exceptions;
[0124] constant->measured for this service;
[0125] validation->encapsulates all validation logic.
[0126] The storage layer includes:
[0127] Configuration->MyBatis configuration class
[0128] criteria->Query condition class (generated by code generation tool)
[0129] entity->entity class
[0130] mapper->mapper (mapping file) class
[0131] repository->warehouse layer (isolates the business logic layer to directly interact with the database)
[0132] resource / mapper->mapper's XML (Extensible Markup Language).
[0133] As an optional implementation method, all feign services provided to the outside are uniformly defined in the external interface layer.
[0134] The model layer includes:
[0135] dto->dto (data transfer object) of interface interaction;
[0136] Request->query encapsulated request class;
[0137] vo->Returns the vo (view object) class of the page.
[0138] In some optional implementations, the configuration acquisition module 505 also acquires additional configuration information. The additional configuration information includes at least one of: table prefix configuration information to be ignored, business line configuration information, and project name configuration information. The user sets the additional configuration information through the user interface. For example, if the table prefix configuration information to be ignored is not set, the generated table name is "tb_company"; if the table prefix configuration information to be ignored is set, the generated table name is "company", that is, the prefix "tb_" is ignored. Setting the business line configuration information can standardize the business line naming rules. Setting the project name configuration information can standardize the project naming rules.
[0139] In some optional implementations, by specifying the database and table, the basic CRUD function is implemented by integrating the encapsulation component of MyBatis. And the encapsulation component is integrated to control the same version management of the component. Among them, commonly used objects such as status code and return value object are encapsulated. In addition, the use of MyBatis components is encapsulated, the configuration and properties of swagger are encapsulated, and commonly used tool classes are encapsulated.
[0140] Based on the code generation system of this embodiment, it is possible to realize the generation of repeated codes, unify the relevant basic classes of return values and status codes, thereby reducing the amount of repetitive work; specify the hierarchical modules of the project, set the hierarchical code standards and usage, thereby realizing code standardization; encapsulate components to realize component reuse, unify components, and efficiently optimize the use of components, thereby realizing the unification of components and tools.
[0141] Example 3
[0142] Figure 5 The schematic diagram of the structure of an electronic device provided in this embodiment includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the code generation method of embodiment 1 is implemented when the processor executes the program. Figure 5 The electronic device 30 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0143] like Figure 5 As shown, the electronic device 30 may be in the form of a general-purpose computing device, for example, it may be a server device. The components of the electronic device 30 may include, but are not limited to: at least one processor 31, at least one memory 32, and a bus 33 connecting different system components (including the memory 32 and the processor 31).
[0144] The bus 33 includes a data bus, an address bus, and a control bus.
[0145] The memory 32 may include a volatile memory, such as a random access memory (RAM) 321 and / or a cache memory 322 , and may further include a read-only memory (ROM) 323 .
[0146] The memory 32 may also include a program / utility 325 having a set (at least one) of program modules 324, such program modules 324 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0147] The processor 31 executes various functional applications and data processing by running the computer programs stored in the memory 32, such as the code generation method of the first embodiment of the present invention.
[0148] The electronic device 30 may also communicate with one or more external devices 34 (e.g., keyboards, pointing devices, etc.). Such communication may be performed via an input / output (I / O) interface 35. Furthermore, the model-generated device 30 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 36. As shown, the network adapter 36 communicates with other modules of the model-generated device 30 via a bus 33. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the model-generated device 30, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (RAID) systems, tape drives, and data backup storage systems.
[0149] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.
[0150] The above-mentioned electronic device embodiment can also achieve the corresponding technical effects of an embodiment of a code generation method, which has been described in detail above and will not be repeated here.
[0151] Example 4
[0152] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the code generation method of embodiment 1 are implemented.
[0153] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.
[0154] In a possible implementation manner, the present invention may also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of the code generation method of embodiment 1.
[0155] The program code for executing the present invention may be written in any combination of one or more programming languages, and may be executed entirely on a user device, partially on a user device, as an independent software package, partially on a user device and partially on a remote device, or entirely on a remote device.
[0156] The above-mentioned computer-readable storage medium embodiment can also achieve the corresponding technical effect of an embodiment of a code generation method, which has been described in detail above and will not be repeated here.
[0157] Although the specific embodiments of the present invention are described above, it should be understood by those skilled in the art that this is only for illustration and the protection scope of the present invention is defined by the appended claims. Those skilled in the art may make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, but these changes and modifications all fall within the protection scope of the present invention.
Claims
1. A code generation method, characterized in that: The following steps are involved: Obtain a database selection instruction to determine a target database corresponding to code generation; Obtain a database table selection instruction to determine a target database table corresponding to code generation; Return corresponding data structures and objects according to the target database and the target database table; Generate object code based on the data structures and objects.
2. The code generation method according to claim 1, characterized in that: Before returning corresponding data structures and objects according to the target database and the target database table, the code generation method further includes: The configuration information for code generation is obtained, wherein the configuration information includes at least one of query condition configuration information, list display configuration information, and added display configuration information.
3. The code generation method according to claim 2, characterized in that: Returning corresponding data structures and objects according to the target database and the target database table specifically includes: Based on the query condition configuration information, the list display configuration information and / or the additional display configuration information, corresponding data structures and objects are returned according to the target database and the target database table.
4. The code generation method according to claim 1, characterized in that: Generating target code based on the data structure and object specifically includes: Based on the Beetl engine, the data structure and the object are filled into the predetermined position of the preset code template to form the target code.
5. The code generation method according to claim 1, characterized in that: After generating the target code based on the data structure and the object, the code generation method further includes: The target code is processed in layers according to a preset layered structure.
6. The code generation method according to claim 4, characterized in that: The target code is processed in layers according to a preset layered structure, specifically including: Determine whether to generate microservices; If yes, a microservice is generated, wherein the microservice is a four-layer structure consisting of a service logic layer, an external interface layer, a storage layer, and a model layer; If not, a non-microservice is generated, and the non-microservice is a three-layer structure consisting of a service logic layer, a storage layer, and a model layer.
7. The code generation method according to claim 6, characterized in that: After the step of performing hierarchical processing on the target code according to the preset hierarchical logic, the code generation method further includes: It is determined whether a project is to be generated. If so, the microservice is generated into a microservice project, or the non-microservice is generated into a non-microservice project according to a preset project structure.
8. The code generation method according to claim 1, characterized in that: The code generation method further includes: obtaining additional configuration information, wherein the additional configuration information includes: at least one of table prefix configuration information to be ignored, business line configuration information, and project name configuration information.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the code generation method according to any one of claims 1 to 8 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the code generation method according to any one of claims 1 to 8 is implemented.
11. A code generation system, characterized in that: include: A library acquisition module is used to obtain a database selection instruction to determine a target database corresponding to code generation; A table acquisition module is used to acquire a database table selection instruction to determine a target database table corresponding to code generation; A return module, used for returning corresponding data structures and objects according to the target database and the target database table; A generation module is used to generate target code based on the data structure and the object.