Code generation method, device and equipment and computer readable storage medium
By obtaining the data table information of the target database and generating the target data model, combined with the user input service system selection, automatic deployment and continuous integration of code are achieved, solving the problem of inefficient code generation in the existing technology, and achieving rapid delivery.
Patent Information
- Application Number
- CN202310617866.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-29
- Publication Date
- 2024-11-29
AI Technical Summary
Existing code generation methods cannot achieve automatic deployment, continuous integration and rapid delivery of code, and require developers to manually connect and tune, resulting in inefficiency.
By obtaining the data table information of the target database, generating the target data model, and obtaining the target code template based on the service system input by the user, generating and deploying the target business code to the target service system, realizing automatic deployment and continuous integration.
There is no need for manual docking and debugging, which realizes automatic deployment, continuous integration and rapid delivery of code, improving development efficiency.
Smart Images

Figure CN119045791A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of software development technology, and in particular, relates to a code generation method, device, equipment and computer-readable storage medium. Background Art
[0002] With the rapid expansion of software scale and the increasing maturity of software development technology, the requirements for the efficiency and sustainability of code generation in the software development process are becoming increasingly higher.
[0003] At present, the existing code generation methods usually require developers to connect and debug between the code generation tools and the service system. During the code deployment process, developers manually download the generated code and implant the code into the corresponding service system to realize the corresponding business service functions. In this way, it is impossible to realize automatic deployment, continuous integration and rapid delivery of code. Summary of the invention
[0004] The embodiments of the present application provide a code generation method, apparatus, device, and computer-readable storage medium, which can realize automatic deployment, continuous integration, and rapid delivery of code.
[0005] In a first aspect, an embodiment of the present application provides a code generation method, the method comprising:
[0006] Acquire data table information of at least one data table in a target database;
[0007] Receive a first input from a user for data table design based on data table information;
[0008] In response to the first input, generating a target data model;
[0009] receiving a second input of a user selecting a target service system from a plurality of pre-added service systems, wherein the plurality of service systems include at least two of a server-side system, a mobile-side system, and a web-side system;
[0010] In response to the second input, obtaining a target code template corresponding to the target service system;
[0011] Generate a target business code corresponding to the target data model according to the target code template;
[0012] Deploy the target business code to the target service system.
[0013] In some implementations, the data table information includes data table relationship information and data table field information;
[0014] After acquiring data table information of at least one data table in the target database, the method further includes:
[0015] Displaying a window corresponding to at least one data table in the front-end interface, and displaying data table field information of the corresponding data table in the window;
[0016] Display the connection relationship between windows based on the data table relationship information.
[0017] In some implementations, before obtaining the target code template corresponding to the target service system, the method further includes:
[0018] receiving a third input from a user for adding a target code template for a target service system, wherein the target code template includes at least one of a front-end code template and a back-end code template;
[0019] In response to the third input, a target code template corresponding to the target service system is added and saved.
[0020] In some implementations, deploying the target business code to the target service system includes:
[0021] Obtain the address information corresponding to the target service system;
[0022] Deploy the target business code to the target service system according to the address information.
[0023] In some implementations, after generating the target data model, the method further includes:
[0024] Update the data tables in the target database according to the target data model.
[0025] In some implementations, after deploying the target business code to the target service system, the method further includes:
[0026] Update the service interface information corresponding to the target service system.
[0027] In some implementations, after deploying the target business code to the target service system, the method further includes:
[0028] receiving a fourth input from a user for testing a target service code;
[0029] In response to the fourth input, the target business code is tested to obtain a test result.
[0030] In a second aspect, an embodiment of the present application provides a code generation device, the device comprising:
[0031] An acquisition module, used for acquiring data table information of at least one data table in a target database;
[0032] A first receiving module, used for receiving a first input of a user for data table design based on data table information;
[0033] A first response module, configured to generate a target data model in response to a first input;
[0034] A second receiving module is used to receive a second input of a user selecting a target service system from a plurality of pre-added service systems, wherein the plurality of service systems include at least two of a server-side system, a mobile-side system, and a web-side system;
[0035] A second response module, configured to obtain a target code template corresponding to a target service system in response to a second input;
[0036] A generation module, used to generate a target business code corresponding to a target data model according to a target code template;
[0037] The deployment module is used to deploy the target business code to the target service system.
[0038] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: a processor and a memory storing computer program instructions;
[0039] When the processor executes the computer program instructions, the steps of the code generation method as described in any one of the embodiments of the first aspect are implemented.
[0040] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the steps of the code generation method described in any one of the embodiments of the first aspect are implemented.
[0041] In a fifth aspect, an embodiment of the present application provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device performs the steps of the code generation method described in any one of the embodiments of the first aspect.
[0042] The code generation method, apparatus, device and computer-readable storage medium in the embodiments of the present application obtain data table information of at least one data table in the target database, receive and respond to a first input of a user for data table design based on the data table information, and generate a target data model; and receive and respond to a second input of a user selecting a target service system from a plurality of pre-added service systems, obtain a target code template corresponding to the target service system, generate a target business code corresponding to the target data model according to the target code template, and deploy the target business code to the target service system. Since the target business code generated in the embodiments of the present application is the target business code that can be executed by the target service system, there is no need for docking and joint debugging, and in the process of code deployment, automatic deployment can be achieved, without the need for developers to manually download the code and implant the code into the target service system, so that the embodiments of the present application can achieve automatic deployment, continuous integration and rapid delivery of code. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0044] Figure 1 It is a flowchart of a code generation method provided in an embodiment of the present application;
[0045] Figure 2 It is a flow chart of a data table display method provided in an embodiment of the present application;
[0046] Figure 3 This is a schematic diagram of a data table display window provided in an embodiment of the present application;
[0047] Figure 4 It is a flowchart of a method for adding a target code template provided in an embodiment of the present application;
[0048] Figure 5 is a flowchart of a specific implementation method of step S107;
[0049] Figure 6 It is a flowchart of a target business code testing method provided in an embodiment of the present application;
[0050] Figure 7 It is a structural diagram of a code generation system provided in an embodiment of the present application;
[0051] Figure 8 It is a structural schematic diagram of a code generation device provided in an embodiment of the present application;
[0052] Fig. 9It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0054] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0055] From the perspective of application projects, DevOps is to put the application code and operation and maintenance code into a source code library and manage its versions. In this way, all the information about the project is available, and the program itself and the program's operating environment can be deployed at any time. Since the operating environment is the same, it can be guaranteed that the operating results of the program created each time are the same.
[0056] For an agile code development scenario, the front-end and back-end usually need to be linked, that is, to generate the corresponding back-end code, it is necessary to develop the corresponding front-end code for docking and joint debugging. At present, the existing code generation system usually generates code according to a specific code template and through specific code generation steps. However, the above method can only generate JAVA single-language back-end code, and cannot perform continuous integration and rapid delivery of code. In addition, the existing code generation system does not have the online model design function, and requires developers to manually add the corresponding database tables to support the code generation function, which is not friendly to developers.
[0057] In order to solve the problems in the prior art, the embodiments of the present application provide a code generation method, apparatus, device and computer-readable storage medium. The code generation method provided by the embodiments of the present application is first introduced below.
[0058] Figure 1 FIG. 1 is a flow chart of a code generation method provided by an embodiment of the present application. Figure 1 As shown, the code generation method may specifically include the following steps:
[0059] S101, obtaining data table information of at least one data table in a target database;
[0060] S102, receiving a first input of a user for data table design based on data table information;
[0061] S103, generating a target data model in response to the first input;
[0062] S104, receiving a second input of a user selecting a target service system from a plurality of pre-added service systems, wherein the plurality of service systems include at least two of a server-side system, a mobile-side system, and a web-side system;
[0063] S105. In response to the second input, obtain a target code template corresponding to the target service system;
[0064] S106, generating a target business code corresponding to the target data model according to the target code template;
[0065] S107: Deploy the target business code to the target service system.
[0066] Therefore, according to the code generation method provided in the embodiment of the present application, data table information of at least one data table in the target database is obtained, a first input of a user for data table design based on the data table information is received and responded to, and a target data model is generated; and a second input of a user selecting a target service system from a plurality of pre-added service systems is received and responded to, a target code template corresponding to the target service system is obtained, a target business code corresponding to the target data model is generated according to the target code template, and the target business code is deployed to the target service system. Since the target business code generated in the embodiment of the present application is the target business code that can be executed by the target service system, there is no need for docking and joint debugging, and in the process of code deployment, automatic deployment can be achieved, and there is no need for developers to manually download the code and implant the code into the target service system, so that the embodiment of the present application can achieve automatic deployment, continuous integration and rapid delivery of code.
[0067] The specific implementation methods of the above steps are introduced below.
[0068] In some embodiments, in S101, the target database may be any one of common databases such as Mysql, Oracle, SqlServer, etc., and each target database contains multiple data tables, and the data table information of the data table includes data table relationship information, data table field information, and annotation information. Among them, the data table relationship information is the relationship between tables, such as foreign keys, one or more columns used to establish and strengthen the link between the data of two tables. By adding one or more columns that store the primary key value in the table to another table, a link between the two tables can be created.
[0069] As an example, Figure 2 As shown, after S101, the method further includes the following steps:
[0070] S201, displaying a window corresponding to at least one data table in the front-end interface, and displaying data table field information of the corresponding data table in the window;
[0071] S202: Display the connection relationship between windows according to the data table relationship information.
[0072] Exemplarily, after obtaining data table information of at least one data table in the target database, the obtained data table information is synchronized to the business table of the automation code platform through the logic encapsulation of the automation code platform, so as to parse the data table information and display it on the front-end interface. Figure 3 As shown, at least one window corresponding to a data table will be displayed in the front-end interface, and the window will display the data table field information of the corresponding data table. There is a corresponding connection relationship between the windows corresponding to each data table, and the connection relationship between the windows is determined based on the data table relationship information, and the connection relationship between the windows corresponding to each data table is displayed on the front-end interface.
[0073] Since the data table can be customized according to actual needs in the front-end page, the data table field information of each data table and the connection relationship between the data tables are displayed on the front-end page, which is also convenient for designing the data table in response to user needs.
[0074] In some embodiments, in S102, the front-end interface provides a rich component library and page design element library to perform online model design in a visual interface. When a first input from a user to design a data table based on data table information is received, the data table is designed through online design, such as dragging components in the component library or design elements in the page design element library. Since different databases map different data structures, independent areas are divided for abstract mapping of the database, whether at the data storage level or the user interface (UI) design level. The area refers to the location where the data is stored, that is, the data of each user is stored in segments. Therefore, for different databases, it is convenient for users to add data source drivers for expansion.
[0075] In some embodiments, in S103, in response to the user's first input of designing a data table based on the data table information, the target data model is generated by the user dragging and dropping components to design a form, and the template engine of the target data model is Freemarker, and the code constructed in this way can provide automatic deployment and online downloading for users to use, wherein the number of generated target data models is not limited. For example, a user table has attributes such as user name, age, and telephone number. In the process of adding attributes by the user, the data structure corresponding to the added attribute can be determined by whether the user selects text or numbers, thereby determining the target data model.
[0076] Therefore, according to the design of the target data model, a quick code construction function is provided. Users only need to enter information such as the code author, package name, module name, etc. to automatically generate front-end and back-end codes for diversified code construction.
[0077] In some embodiments, after generating the target data model, the method further includes: updating a data table in the target database according to the target data model. As an example, based on the Java Database Connectivity (JDBC) protocol, a structured query language (SQL) is sent to the target database in Java, and the target data model is created in the target database in the form of SQL, thereby updating the data table in the target database.
[0078] In some embodiments, in S104, the multiple service systems include at least two of a server system, a mobile system, and a web system, and the target service system is any one of the multiple service systems. A second input of a user selecting a target service system from multiple pre-added service systems is received, and when adding a service system, it is necessary to define whether the added service system belongs to a server system, a mobile system, or a web system.
[0079] In some embodiments, Figure 4 As shown, before S105, the method further includes the following steps:
[0080] S401, receiving a third input from a user to add a target code template for a target service system, wherein the target code template includes at least one of a front-end code template and a back-end code template;
[0081] S402: In response to the third input, add and save a target code template corresponding to the target service system.
[0082] As an example, in S401 and S402, when receiving the second input of the user selecting the target service system from the pre-added multiple service systems, the target service system is selected from the multiple service systems including at least two of the server-side system, the mobile-side system and the web-side system. Based on this, in response to the user's third input of adding a target code template for the target service system, a target code template including at least one of the front-end code template and the back-end code template corresponding to the target service system is added, and the target code template is saved in the automation code platform so as to call the target code template.
[0083] Therefore, in S105, since the target code template is previously added and saved in the automated code platform, the second input of the user selecting the target service system from the pre-added multiple service systems is received and responded to, and the target code template corresponding to the target service system is obtained. Because for an agile code development scenario, the front-end and back-end are usually required to be linked, that is, to generate the corresponding back-end code, it is necessary to develop the corresponding front-end code for docking and joint debugging. The target code template includes at least one of the front-end code template and the back-end code template, and the target code template supports application codes in multiple languages, not limited to single-language back-end code, thereby achieving continuous integration and rapid delivery of code.
[0084] In some embodiments, in S106, since the target code template is a template with multiple languages, and the template can be customized to generate codes in different languages, after obtaining the target code template, the target business code corresponding to the target data model can be generated according to the target code template. The target business code designed and generated on the development platform, for example, has functions such as creating new users, editing users, and deleting users. Users can rely on the automatically generated code to perform functional verification of the code according to the functions they choose to implement, and release the functional service through the assembly line if there are no problems with the functional verification and review. After the functional service is released, the open source software Knife4J will automatically update the Application Program Interface (API) document for the purpose of functional specification review and verification and docking and integration with third-party systems.
[0085] In some embodiments, Figure 5 As shown, the above S107 may specifically include the following steps:
[0086] S501, obtaining address information corresponding to the target service system;
[0087] S502: Deploy the target business code to the target service system according to the address information.
[0088] As an example, if you want to deploy the target business code to the target service system, you first need to obtain the address information corresponding to the target service system and deploy the code according to the address information. For example, first manage the target service system project, add all the code addresses of the target service system project and deploy the environment address, and obtain the corresponding target code template according to the different target service systems, that is, generate codes in different languages to serve different terminals.
[0089] Exemplarily, the terminal includes a server corresponding to the backend, a mobile terminal, and a web terminal corresponding to the frontend, wherein the language of the server may include java, XML, the language of the mobile terminal may be Kotlin, and the language of the web terminal may include html, vue, js, and when the target business code is generated correctly, the target business code is automatically merged, and the target business code is deployed to the target service system through the deployment pipeline according to the address information corresponding to the target service system. It should be noted that after the target business code is deployed to the target service system, the service interface information corresponding to the target service system can be automatically updated to achieve release.
[0090] In some implementations, in order to ensure that the target service code is deployed correctly, such as Figure 6 As shown, after S107, the method further includes the following steps:
[0091] S601, receiving a fourth input from a user for testing a target service code;
[0092] S602: In response to the fourth input, test the target service code to obtain a test result.
[0093] As an example, after the target business code is deployed to the target service system, the target business code is tested by receiving and responding to the fourth input for testing the target business code. For example, if the code is designed and generated on the development platform and there is no problem after preliminary verification, an asynchronous scheduling strategy can be implemented, that is, a demand is initiated, and related tasks are executed in a one-step manner, such as scheduling the published scenario to the production environment in one step and asynchronously executing the creation of the database data model, automatically merging and submitting the code repository code, and deploying CI / CD to the production environment with one click, where CI refers to continuous integration and CD refers to continuous delivery and / or continuous deployment. Database model creation and code repository merging are asynchronous tasks that are executed synchronously. After the two tasks are completed, the notification strategy will be triggered, and the designed functions will be officially deployed and released. Relevant personnel will be notified in a timely manner by email, text message, etc., and a reviewable report and test case operation results will be generated so that relevant personnel can review the content of this deployment and release.
[0094] For example, Figure 7 As shown, a code generation system is provided for reverse engineering of multiple data sources, online model involvement, automatic code generation, rapid integration of business services, and automatic update of API documents. The dynamic data source corresponds to the target database, and the microservice corresponds to the target service system. Thus, through online design, development, deployment, and verification, the perfect combination of the automated code platform and Devops is achieved, solving the problem of repeated code writing for simple businesses, connecting multiple data sources and corresponding microservice systems, and thus performing Devops continuous integration and automated deployment and release.
[0095] It should be noted that the application scenarios described in the above-mentioned embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0096] Based on the same inventive concept, the present application also provides a code generation device. Figure 8 Provide detailed explanation.
[0097] Figure 8 It is a structural diagram of a code generation device provided in an embodiment of the present application.
[0098] like Figure 8As shown, the code generating device 800 may include:
[0099] An acquisition module 801 is used to acquire data table information of at least one data table in a target database;
[0100] A first receiving module 802 is used to receive a first input of a user for data table design based on data table information;
[0101] A first response module 803, configured to generate a target data model in response to a first input;
[0102] The second receiving module 804 is used to receive a second input of a user selecting a target service system from a plurality of pre-added service systems, wherein the plurality of service systems include at least two of a server system, a mobile system, and a web system;
[0103] A second response module 805, configured to obtain a target code template corresponding to a target service system in response to a second input;
[0104] A generating module 806, configured to generate a target business code corresponding to a target data model according to a target code template;
[0105] The deployment module 807 is used to deploy the target business code to the target service system.
[0106] Therefore, according to the code generation device of the embodiment of the present application, data table information of at least one data table in the target database is obtained, a first input of a user for data table design based on the data table information is received and responded to, and a target data model is generated; and a second input of a user selecting a target service system from a plurality of pre-added service systems is received and responded to, and a target code template corresponding to the target service system is obtained, and a target business code corresponding to the target data model is generated according to the target code template, and the target business code is deployed to the target service system. Since the target business code generated in the embodiment of the present application is the target business code that can be executed by the target service system, there is no need for docking and joint debugging, and in the process of code deployment, automatic deployment can be achieved, and there is no need for developers to manually download the code and implant the code into the target service system, so that the embodiment of the present application can achieve automatic deployment, continuous integration and rapid delivery of code.
[0107] The above-mentioned code generation device 700 is described in detail below, as shown below:
[0108] In some implementations, the data table information includes data table relationship information and data table field information. After acquiring the data table information of at least one data table in the target database, the code generation device 800 further includes the following submodules:
[0109] A first display submodule, used to display a window corresponding to at least one data table in the front-end interface, and to display data table field information of the corresponding data table in the window;
[0110] The second display submodule is used to display the connection relationship between windows according to the data table relationship information.
[0111] In some implementations, the first response module 803 may include the following units:
[0112] The update unit is used to update the data table in the target database according to the target data model.
[0113] In some implementations, the second response module 805 may include the following units:
[0114] A first receiving unit is used to receive a third input of a user adding a target code template for a target service system, wherein the target code template includes at least one of a front-end code template and a back-end code template;
[0115] The adding unit is used to add and save the target code template corresponding to the target service system in response to the third input.
[0116] In some implementations, the deployment module 807 may include the following units:
[0117] An acquisition unit, used to acquire address information corresponding to a target service system;
[0118] The deployment unit is used to deploy the target business code to the target service system according to the address information.
[0119] In some implementations, the code generation device 800 further includes the following submodules:
[0120] The update submodule is used to update the service interface information corresponding to the target service system.
[0121] In some implementations, the code generation device 800 further includes the following submodules:
[0122] A receiving submodule, used for receiving a fourth input from a user for testing a target service code;
[0123] The testing submodule is used to test the target business code in response to the fourth input to obtain a test result.
[0124] Fig. 9 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application.
[0125] The electronic device 900 may include a processor 901 and a memory 902 storing computer program instructions.
[0126] Specifically, the processor 901 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0127] The memory 902 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 902 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 902 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 902 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 902 is a non-volatile solid-state memory.
[0128] In a particular embodiment, the memory 902 may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Therefore, generally, the memory 902 includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the code generation method according to the first aspect of the present application.
[0129] The processor 901 implements any one of the code generation methods in the above embodiments by reading and executing computer program instructions stored in the memory 902 .
[0130] In some examples, the electronic device 900 may further include a communication interface 903 and a bus 910. Fig. 9 As shown, the processor 901, the memory 902, and the communication interface 903 are connected via a bus 910 and communicate with each other.
[0131] The communication interface 903 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0132] Bus 910 includes hardware, software or both, and the components of electronic device 800 are coupled to each other. For example, but not limitation, bus 910 may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 910 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.
[0133] Exemplarily, the electronic device 900 may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA).
[0134] The electronic device 900 can execute the code generation method in the embodiment of the present application, thereby realizing the combination Figure 1 and Figure 8 The code generation method and device described.
[0135] In addition, in combination with the code generation method in the above embodiment, the embodiment of the present application may provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any one of the code generation methods in the above embodiment is implemented. Examples of computer-readable storage media include non-transitory computer-readable storage media, such as portable disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, etc.
[0136] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0137] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0138] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0139] The above reference is according to the method of the embodiment of the present application, the flow chart of the device (system) and the computer program product and / or the block diagram described various aspects of the present application.It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram.Such a processor can be but is not limited to a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.
[0140] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A code generation method, characterized in that: include: Acquire data table information of at least one data table in a target database; Receive a first input from a user for data table design based on the data table information; In response to the first input, generating a target data model; receiving a second input of a user selecting a target service system from a plurality of pre-added service systems, wherein the plurality of service systems include at least two of a server-side system, a mobile-side system, and a web-side system; In response to the second input, acquiring a target code template corresponding to the target service system; Generate a target business code corresponding to the target data model according to the target code template; Deploy the target business code to the target service system.
2. The method according to claim 1, characterized in that The data table information includes data table relationship information and data table field information; After acquiring data table information of at least one data table in the target database, the method further includes: Displaying a window corresponding to the at least one data table in the front-end interface, and displaying data table field information of the corresponding data table in the window; The connection relationship between the windows is displayed according to the data table relationship information.
3. The method according to claim 1, characterized in that Before acquiring the target code template corresponding to the target service system, the method further includes: receiving a third input from a user for adding the target code template to the target service system, wherein the target code template includes at least one of a front-end code template and a back-end code template; In response to the third input, the target code template corresponding to the target service system is added and saved.
4. The method according to claim 1, characterized in that: The deploying the target business code to the target service system includes: Obtaining address information corresponding to the target service system; The target business code is deployed to the target service system according to the address information.
5. The method according to claim 1, characterized in that After generating the target data model, the method further includes: The data table in the target database is updated according to the target data model.
6. The method according to claim 1, characterized in that After deploying the target business code to the target service system, the method further includes: Update the service interface information corresponding to the target service system.
7. The method according to claim 1, characterized in that After deploying the target business code to the target service system, the method further includes: receiving a fourth input from a user for testing the target service code; In response to the fourth input, the target service code is tested to obtain a test result.
8. A code generating device, characterized in that: include: An acquisition module, used for acquiring data table information of at least one data table in a target database; A first receiving module, used for receiving a first input of a user for data table design based on the data table information; A first response module, configured to generate a target data model in response to the first input; A second receiving module is used to receive a second input of a user selecting a target service system from a plurality of pre-added service systems, wherein the plurality of service systems include at least two of a server-side system, a mobile-side system, and a web-side system; A second response module, configured to obtain a target code template corresponding to the target service system in response to the second input; A generating module, used for generating a target business code corresponding to the target data model according to the target code template; A deployment module is used to deploy the target business code to the target service system.
9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the steps of the code generation method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the steps of the code generation method according to any one of claims 1 to 7 are implemented.
