CN115878092A - Code generation method, device and medium based on micro-service architecture - Google Patents

Code generation method, device and medium based on micro-service architecture Download PDF

Info

Publication number
CN115878092A
CN115878092A CN202211581212.4A CN202211581212A CN115878092A CN 115878092 A CN115878092 A CN 115878092A CN 202211581212 A CN202211581212 A CN 202211581212A CN 115878092 A CN115878092 A CN 115878092A
Authority
CN
China
Prior art keywords
code
data
service
template
page
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211581212.4A
Other languages
Chinese (zh)
Inventor
潘先文
马岩堂
商广勇
肖雪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Inspur Quality Chain Technology Co Ltd
Original Assignee
Shandong Inspur Quality Chain Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong Inspur Quality Chain Technology Co Ltd filed Critical Shandong Inspur Quality Chain Technology Co Ltd
Priority to CN202211581212.4A priority Critical patent/CN115878092A/en
Publication of CN115878092A publication Critical patent/CN115878092A/en
Pending legal-status Critical Current

Links

Images

Abstract

The embodiment of the specification discloses a code generation method, equipment and a medium based on a micro-service architecture, relates to the technical field of computers, is applied to a code generation system, comprises a code designer, a code generator and a micro-service deployment module, and comprises the following steps: acquiring a data source to be operated, and determining a data model corresponding to the data source to be operated; configuring data information for the data model through a code designer to generate a code template required by a user; and generating a service code according to the code template through a code generator so as to deploy the service code through the micro-service deployment module. The templates are dynamically generated according to different project requirements, customized development is achieved, project development becomes unified standardization and project standardization, the problem of mismatching of fixed templates is avoided by using the mode of dynamically generating the templates, the applicability and flexibility of code generation are improved, the application development requirements which can be changed at any time are met, and the customized development requirements are achieved.

Description

Code generation method, device and medium based on micro-service architecture
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a code generation method, device and medium based on a microservice architecture.
Background
With the gradual maturity of computing technology and the increasing trend of mobility, application system development is also developing towards "more general", "lower threshold" and "higher efficiency". Traditional software development may take 4 to 9 months to complete an application and bring it online, and the time frame of a project may vary depending on business needs and the size of the development team.
In the development process of an actual software project or application, business requirements frequently change, and a developer is required to quickly generate a project prototype to meet a use scenario. Aiming at different types of application development requirements which can be changed at any time, the development period of technical personnel is increased, the development cost of enterprises is increased, in addition, the burden is too heavy in the development process due to different development standards and non-standard operation, and the overall development efficiency and quality are influenced. The current development mode cannot meet the application development requirement which can be changed at any time, the customization requirement is difficult to realize, and the flexibility is lacked.
Disclosure of Invention
One or more embodiments of the present specification provide a code generation method, device and medium based on a micro service architecture, which are used to solve the following technical problems: the current development mode cannot meet the application development requirement which can be changed at any time, the customization requirement is difficult to realize, and the flexibility is lacked.
One or more embodiments of the present specification adopt the following technical solutions:
one or more embodiments of the present specification provide a code generation method based on a micro-service architecture, which is applied to a code generation system, where the code generation system includes a code designer, a code generator, and a micro-service deployment module, and the method includes: acquiring a data source to be operated, and determining a data model corresponding to the data source to be operated; configuring data information for the data model through a code designer, and generating a code template required by a user; and generating a service code according to the code template through a code generator so as to deploy the service code through the micro-service deployment module.
Further, the code generation system further comprises a page and component configuration module, and before generating the service code according to the code template through the code generator, the method further comprises: acquiring a service rule corresponding to the service code through a page and component configuration module, and determining page configuration required by a page based on the service rule, wherein the page configuration comprises a page component and a page tool; based on the page configuration required by the page, acquiring a specified page component required by the configuration page from a pre-constructed component library, and acquiring a specified page tool required by the configuration page from a pre-constructed tool library; and generating a page template corresponding to the service code according to the specified page component and the specified page tool.
Further, the code generation system further includes a data source management module, which acquires a data source to be operated, and determines a data model corresponding to the data source to be operated, and specifically includes: connecting the data source to be operated corresponding to the data entity required by the user through a data source management module to obtain the data source to be operated; determining data table structures of data tables respectively corresponding to the data entities in the data source to be operated; and determining a data model corresponding to the data tables based on the data table structures of the data tables respectively corresponding to the data entities, wherein the data model comprises a plurality of data entities.
Further, configuring data information for the data model through a code designer, and generating a code template required by a user, specifically comprising: acquiring the association relation among the data tables and the corresponding relation between each data entity and the corresponding data table; establishing an incidence relation between each data entity in the data model through the incidence relation among the data tables; establishing data corresponding relations between the data model and a plurality of data tables based on the incidence relation between each data entity in the data model and the corresponding relation between each data entity and the corresponding data table; and configuring data information for the data model according to the data corresponding relation between the data model and the data tables to generate a code template required by a user.
Further, generating a service code according to the code template by a code generator, specifically comprising: reading the code template by a reading unit of the code generator; performing data verification on the data model in the code template through a data verification unit of the code generator according to a preset verification rule; and after the data verification is passed, replacing the specified characteristic value in the code template by the generation unit of the code generator to generate the service code.
Further, after generating the service code, the method further includes: and writing the service code into a specified file through an editing unit of the code generator.
Further, deploying the service code through the micro-service deployment module specifically includes: acquiring a pre-constructed project template, wherein the project template comprises a plurality of service units; determining an appointed service unit corresponding to the service code, and filling the service code in the appointed service unit of the project template according to the appointed service unit corresponding to the service code to generate a project code; and deploying the project code in a one-key publishing mode.
Further, after writing the service code into a designated file, the method further includes: and configuring code template storage position information of the service code, operation environment information of the code generator and storage position information of the service code through a code template configuration unit of the code generator.
One or more embodiments of the present specification provide a code generation apparatus based on a microservice architecture, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to: acquiring a data source to be operated, and determining a data model corresponding to the data source to be operated; configuring data information for the data model through a code designer, and generating a code template required by a user; and generating a service code according to the code template through a code generator so as to deploy the service code through the micro-service deployment module.
One or more embodiments of the present specification provide a non-transitory computer storage medium storing computer-executable instructions configured to: acquiring a data source to be operated, and determining a data model corresponding to the data source to be operated; configuring data information for the data model through a code designer, and generating a code template required by a user; and generating a service code according to the code template through a code generator so as to deploy the service code through the micro-service deployment module.
The embodiment of the specification adopts at least one technical scheme which can achieve the following beneficial effects: according to different project requirements, a code template is generated through a code designer, customized development is realized in a dynamic template generation mode, the project development becomes uniform standardization and project standardization through template generation, the problem of mismatching generated by a fixed template is avoided by using the dynamic template generation mode, and the applicability and flexibility of code generation are improved; in addition, the micro-service deployment module is used for deploying the service codes, so that the efficiency and the development quality of a software development process are improved, the application development requirement which can be changed at any time is met, and the customized development requirement is met.
Drawings
In order to more clearly illustrate the embodiments of the present specification or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the present specification, and for those skilled in the art, other drawings can be obtained according to the drawings without any creative effort. In the drawings:
fig. 1 is a flowchart illustrating a code generation method based on a micro service architecture according to an embodiment of the present disclosure;
fig. 2 is a schematic structural diagram of a code generation apparatus based on a micro service architecture according to an embodiment of the present specification.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present specification, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present specification without any creative effort shall fall within the protection scope of the present specification.
With the gradual maturity of computing technology and the increasing trend of mobility, application system development is also developing towards "more general", "lower threshold" and "higher efficiency". Traditional software development may take 4 to 9 months to complete an application and bring it online, and the time frame of a project may vary depending on business needs and the size of the development team.
In the development process of an actual software project or application, business requirements frequently change, and a developer is required to quickly generate a project prototype to meet a use scenario. Aiming at different types of application development requirements which can be changed at any time, the development period of technical personnel is increased, the development cost of enterprises is increased, in addition, the burden is too heavy in the development process due to different development standards and non-standard operation, and the overall development efficiency and quality are influenced. The current development mode cannot meet the application development requirement which can be changed at any time, the customization requirement is difficult to realize, and the flexibility is lacked.
The embodiments of the present specification provide a code generation method based on a micro service architecture, and it should be noted that an execution subject in the embodiments of the present specification may be a server or any device with data processing capability. Fig. 1 is a flowchart of a code generation method based on a micro-service architecture according to an embodiment of the present disclosure, and it should be noted that the method in the embodiment of the present disclosure may be applied to a code generation system, where the code generation system includes a data source management module, a page and component configuration module, a code designer, a code generator, and a micro-service deployment module. The method provided by the embodiment of the specification is shown in fig. 1, and mainly comprises the following steps:
step S101, a data source to be operated is obtained, and a data model corresponding to the data source to be operated is determined.
In one embodiment of the present description, a code generation system includes a data source management module, a page and component configuration module, a code designer, a code generator, and a microservice deployment module. The data source management module is used for managing and maintaining different data source connections, providing a data model, managing various databases such as a relational database, a non-relational database and the like, and maintaining and managing database table structures and model structures. And configuring different data according to the difference of the parent-child table, the single table and the association table.
The code generation system further comprises a data source management module, wherein the data source management module is used for acquiring a data source to be operated and determining a data model corresponding to the data source to be operated, and the data model comprises the following specific steps: connecting the data source to be operated corresponding to the data entity required by the user through a data source management module to obtain the data source to be operated; determining data table structures of data tables respectively corresponding to the data entities in the data source to be operated; and determining a data model corresponding to the data table based on the data table structures of the data tables respectively corresponding to the data entities, wherein the data model comprises a plurality of data entities.
In an embodiment of the present specification, the data source management module is connected to a data source to be operated corresponding to a data entity required by a user, and manages and maintains multiple types of data sources through the data source management module, so that the system can satisfy multiple types of data sources. And acquiring a data source to be operated, which is required by a user, through the data source management module.
In an embodiment of the present specification, the data source to be operated includes multiple data tables, a required data entity corresponding to a service requirement of a user is determined, and a data model corresponding to the data table is determined according to a data table structure of the data table corresponding to the required data entity, where it is to be noted that the data model includes multiple data entities. That is, the data model corresponding to the business requirement is determined through the data source management module.
And step S102, configuring data information for the data model through a code designer, and generating a code template required by a user.
Configuring data information for the data model through a code designer, and generating a code template required by a user, wherein the method specifically comprises the following steps: acquiring the association relation among the data tables and the corresponding relation between each data entity and the corresponding data table; establishing an incidence relation between each data entity in the data model through the incidence relation among the data tables; establishing data corresponding relations between the data model and a plurality of data tables based on the incidence relation between each data entity in the data model and the corresponding relation between each data entity and the corresponding data table; and configuring data information for the data model according to the data corresponding relation between the data model and the data tables to generate a code template required by a user.
In an embodiment of the present specification, a code designer redesigns relevant elements of a corresponding page according to business presentation requirements to establish a correspondence between a model and a business presentation. The data sources corresponding to different services are different, a plurality of data tables may exist in the data sources, and a certain association relationship exists between each data table, for example, a parent table and a child table. Acquiring the incidence relation among the plurality of data tables, acquiring the incidence relation between each data entity and the corresponding data table, and establishing the incidence relation between each data entity in the data model through the incidence relation among the plurality of data tables.
In an embodiment of the present specification, a data correspondence between a data model and a plurality of data tables is established according to an association relationship between each data entity in the data model and a correspondence between each data entity and a corresponding data table, and data information is configured for the data model by using data in the corresponding data table according to the data correspondence, so as to generate a code template required by a user. Here, the configuration data information may be an entity name, a field of the entity, a field type, a field length, whether to fill, whether to key, whether to be blank, and the like.
And step S103, generating a service code according to the code template through the code generator, and deploying the service code through the micro-service deployment module.
The code generation system also comprises a page and component configuration module, and before generating the service code according to the code template through the code generator, the method also comprises the following steps: acquiring a service rule corresponding to the service code through a page and component configuration module, and determining page configuration required by a page based on the service rule, wherein the page configuration comprises a page component and a page tool; based on the page configuration required by the page, acquiring a specified page component required by the configuration page from a pre-constructed component library, and acquiring a specified page tool required by the configuration page from a pre-constructed tool library; and generating a page template corresponding to the business code according to the specified page component and the specified page tool.
In an embodiment of the present specification, a service rule corresponding to a service code required by a user is obtained through a page and component configuration module, where it should be noted that the service rule may be set according to a user requirement. And determining the page configuration required by the page according to the set business rule corresponding to the user requirement, wherein the page configuration comprises a page component and a page tool. The component library and the tool library required by the display page are constructed in advance, and it needs to be noted that the component library and the tool library can be updated at any time. And based on the page configuration required by the page, always acquiring a specified page component and a specified page tool required by the configuration page in a component library and a tool library respectively, so as to generate a page template corresponding to the service code according to the specified page component and the specified page tool.
Generating a service code according to the code template through a code generator, which specifically comprises the following steps: reading the code template by a reading unit of the code generator; performing data verification on the data model in the code template through a data verification unit of the code generator according to a preset verification rule; and after the data verification is passed, replacing the specified characteristic value in the code template by the generating unit of the code generator to generate the service code.
After generating the service code, the method further comprises: the service code is written into a specified file by an editing unit of the code generator.
After the service code is written into the designated file, the method further comprises the following steps: and configuring code template storage location information of the service code, operating environment information of the code generator and storage location information of the service code by a code template configuration unit of the code generator.
In one embodiment of the present specification, the code generator further includes a reading unit, a data verification unit, a generation unit, an editing unit, and a code template configuration unit. And reading the code template or importing the code template through the reading unit, and performing data verification on the data model in the code template through the data verification unit according to a preset verification rule. It should be noted that the preset validation rule herein can perform data validation on the data model according to the data information set in the code template. For example, if the attribute is not null, when the corresponding entry in the data model is null, it indicates that the data verification is not passed. After the data verification is passed, replacing the characteristic value in the code template by a generating unit to generate a service code required by a user; and writing the generated service code into a specified file through an editing unit, configuring a storage position corresponding to a code template storage position of the service code through a code template configuration unit, and configuring the running environment information of the code generator and the storage position information of the service code.
In an embodiment of the present specification, after a data source corresponding to a service development requirement of a user is obtained, a code template corresponding to the user requirement is generated by a code generator according to data in the data source. It should be noted that the code template here is different from a conventional fixed template, and the code template in this embodiment is generated based on the business development requirements of users, that is, the generated code template is different when the requirements of different users are different, and it can be understood that the code template here is a dynamic template.
The deploying the service code through the micro-service deploying module specifically comprises: acquiring a project template which is constructed in advance, wherein the project template comprises a plurality of service units; determining a designated service unit corresponding to the service code, and filling the service code in the designated service unit of the project template according to the designated service unit corresponding to the service code to generate a project code; and deploying the project code in a one-key publishing mode.
In an embodiment of the present specification, after a service code is generated, the micro service deployment module deploys the service code, and the generated service code may be released by a part of function modules in a code integration deployment manner.
In one embodiment of the present specification, the generated service code may also be deployed in a form of one-key publishing of an item. Generally, each project has a project template, a plurality of function modules exist in the project template, which can also be understood as service units, and the position of each function module in the project template is known, and the corresponding function modules can be assembled according to the project template. After generating the business code, acquiring a project template corresponding to the project, determining a designated business unit corresponding to the business code, filling the business code in the designated business unit of the project template according to the designated business unit corresponding to the business code, and generating the project code; and deploying the project codes in a one-key publishing mode.
According to the technical scheme, the code template is generated through the code designer according to different project requirements, customized development is realized in a dynamic template generation mode, the project development becomes uniform standardization and project standardization through the template, the problem of mismatching generated by a fixed template is avoided by using the dynamic template generation mode, and the applicability and flexibility of code generation are improved; in addition, the micro-service deployment module is used for deploying the service codes, so that the efficiency and the development quality of a software development process are improved, the application development requirement which can be changed at any time is met, and the customized development requirement is met.
In an embodiment of the present specification, the code generation system includes a data source management module, a page and component configuration module, a code designer, a code generator, and a micro service deployment module. The data source management module is used for managing and maintaining different data source connections, providing a data model, managing various databases such as a relational database, a non-relational database and the like, and maintaining and managing database table structures and model structures. And configuring different data according to the difference of the parent-child table, the single table and the association table. The data source information is information configuration, various types of data source butt joint are supported, only data source related information needs to be maintained in the system, and the data source butt joint of different systems can be realized to generate a uniform code standard.
In an embodiment of the present specification, the code designer redesigns relevant elements of the corresponding page according to the business presentation requirement, so as to establish a corresponding relationship between the model and the business presentation. Specifically, the data model description entity is used for establishing or updating the data entity, setting the attribute of the data entity and the attribute of the field entity, and establishing the association relationship attribute between the entities. The entity comprises an entity name, introduction of the entity, a field, a type, a length, whether to fill, whether to key, a default value, whether to be empty and the like of the entity, wherein the attributes are required for configuring relevant data information by a code designer. In addition, the code designer is characterized by completing data processing before code generation, corresponding relation between database fields and entities, flow processing, function control, design flow configuration and template processing, and other processing modes such as whether check rules of related fields need to be configured or not.
In one embodiment of the present specification, the page and component configuration module sets the component properties of the user interface for each user interface component, and selects the components and tool configurations required for the relevant page. Taking the form as an example, the selectable components of the component library are minimum unit page elements, and can be configured with related layout, input box, drop-down box, time component, rich text and the like, and related tools can be configured with the check rule of the form. After the related configuration is completed, a related page template can be generated, and the existing template file can be customized and newly added or modified according to different projects, so that the rapid customized development of the page is realized. In addition, the page and component configuration module corresponds to the component model, is directly extracted from the component library for use according to the determined business correlation rule, establishes a logical relationship between the component model and the business unit to be processed, and assembles the component interface template according to the business rule, thereby realizing the business function in a wider range.
In one embodiment of the present description, a code generator comprises a code reader, a data validator, a generator, an editor, a template configuration set; wherein the reader is used for reading or importing the code template; the data verifier is used for performing data verification on the read model according to the specification; the generator replaces the corresponding characteristic value according to the special mark language configured in the template and forms a related code; the editor is used for writing the replaced codes into a file; the template configuration set is used for configuring information such as environment configuration of the code generation engine, template positions of the code generator, positions of generated items and codes and the like. Depending on a code template engine, calling each layer of models and code templates, configuring relevant parameters, completing a code automatic generation module, and generating a full amount of codes, so that development becomes agile, dynamic adjustment and change along with requirements can be realized, and the method has strong transportability and expansibility.
In one embodiment of the specification, the micro-service deployment module supports code integration deployment or project one-key publishing for the generated project code or module code. The mode of separating the front end from the back end is adopted, the release of partial function modules is realized based on the micro-service framework, the repeated project environment configuration is reduced, the operation and maintenance data monitoring of the deployment module can be realized, and the operation and maintenance personnel can conveniently monitor the project operation state. The code generation function module and the code engineering are based on front-end and back-end separation design, development and deployment are carried out in a micro-service architecture mode, and the micro-service architecture is matched with an integrated packaging tool for use, so that one-key code deployment can be realized more conveniently and rapidly.
The embodiment of the specification has the following beneficial effects: firstly, based on the technical characteristics of template engine development, customized development can be realized for different project requirements, prototype delivery can be quickly realized, the efficiency and the development quality of a software development process are improved, and the template makes the project development become unified standardization and project normalization; in addition, a visual development mode is adopted, so that what you see is what you get, a unified template can be conveniently configured by using a standard component library and a tool library, different templates can be customized according to different scene requirements, and the system is easy to operate; in addition, various modes such as one-key release of the generated project and project integration of the generated partial function code module are supported, the development period is shortened, and the development cost is saved.
An embodiment of the present specification further provides a code generating device based on a micro service architecture, and fig. 2 is a schematic structural diagram of the code generating device based on the micro service architecture provided in the embodiment of the present specification, and as shown in fig. 2, the device includes: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to:
acquiring a data source to be operated, and determining a data model corresponding to the data source to be operated; configuring data information for the data model through a code designer, and generating a code template required by a user; and generating a service code according to the code template through a code generator so as to deploy the service code through the micro-service deployment module.
Embodiments of the present specification also provide a non-volatile computer storage medium storing computer-executable instructions configured to:
acquiring a data source to be operated, and determining a data model corresponding to the data source to be operated; configuring data information for the data model through a code designer, and generating a code template required by a user; and generating a service code according to the code template through a code generator so as to deploy the service code through the micro-service deployment module.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiments of the apparatus, the device, and the nonvolatile computer storage medium, since they are substantially similar to the embodiments of the method, the description is simple, and for the relevant points, reference may be made to the partial description of the embodiments of the method.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The devices and the media provided in the embodiments of the present description correspond to the methods one to one, and therefore, the devices and the media also have beneficial technical effects similar to the corresponding methods.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The description has been presented with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the description. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of other like elements in a process, method, article, or apparatus comprising the element.
The above description is merely one or more embodiments of the present disclosure and is not intended to limit the present disclosure. Various modifications and alterations to one or more embodiments of the present description will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement or the like made within the spirit and principle of one or more embodiments of the present specification should be included in the scope of the claims of the present specification.

Claims (10)

1. A code generation method based on micro-service architecture is applied to a code generation system, the code generation system comprises a code designer, a code generator and a micro-service deployment module, and the method comprises the following steps:
acquiring a data source to be operated, and determining a data model corresponding to the data source to be operated;
configuring data information for the data model through a code designer, and generating a code template required by a user;
and generating a service code according to the code template through a code generator so as to deploy the service code through the micro-service deployment module.
2. The code generation method based on micro service architecture as claimed in claim 1, wherein the code generation system further comprises a page and component configuration module, and before generating the service code according to the code template by the code generator, the method further comprises:
acquiring a business rule corresponding to the business code through a page and component configuration module, and determining page configuration required by a page based on the business rule, wherein the page configuration comprises a page component and a page tool;
based on the page configuration required by the page, acquiring a specified page component required by the configuration page from a pre-constructed component library, and acquiring a specified page tool required by the configuration page from a pre-constructed tool library;
and generating a page template corresponding to the service code according to the specified page component and the specified page tool.
3. The code generation method based on the microservice architecture as claimed in claim 1, wherein the code generation system further comprises a data source management module, which obtains a data source to be operated, and determines a data model corresponding to the data source to be operated, specifically comprising:
connecting the data source to be operated corresponding to the data entity required by the user through a data source management module to obtain the data source to be operated;
determining data table structures of data tables respectively corresponding to the data entities in the data source to be operated;
and determining a data model corresponding to the data table based on the data table structures of the data tables respectively corresponding to the data entities, wherein the data model comprises a plurality of data entities.
4. The micro-service architecture based code generation method according to claim 3, wherein a code designer configures data information for the data model to generate a code template required by a user, and specifically comprises:
acquiring the association relation among the data tables and the corresponding relation between each data entity and the corresponding data table;
establishing an incidence relation between each data entity in the data model through the incidence relation among the data tables;
establishing data corresponding relations between the data model and a plurality of data tables based on the incidence relation between each data entity in the data model and the corresponding relation between each data entity and the corresponding data table;
and configuring data information for the data model according to the data corresponding relation between the data model and a plurality of data tables to generate a code template required by a user.
5. The code generation method based on the micro service architecture as claimed in claim 1, wherein generating the service code according to the code template by the code generator specifically includes:
reading the code template by a reading unit of the code generator;
performing data verification on the data model in the code template through a data verification unit of the code generator according to a preset verification rule;
and after the data verification is passed, replacing the specified characteristic value in the code template by the generation unit of the code generator to generate the service code.
6. The code generation method based on micro service architecture as claimed in claim 5, wherein after generating the service code, the method further comprises:
and writing the service code into a specified file through an editing unit of the code generator.
7. The code generation method based on the micro-service architecture according to claim 1, wherein deploying the service code by the micro-service deployment module specifically includes:
acquiring a pre-constructed project template, wherein the project template comprises a plurality of service units;
determining an appointed service unit corresponding to the service code, and filling the service code in the appointed service unit of the project template according to the appointed service unit corresponding to the service code to generate a project code;
and deploying the project code in a one-key publishing mode.
8. The microservice architecture-based code generation method according to claim 6, wherein after the service code is written into a designated file, the method further comprises:
and configuring code template storage position information of the service code, operation environment information of the code generator and storage position information of the service code by a code template configuration unit of the code generator.
9. A microservice architecture-based code generation apparatus, the apparatus comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
acquiring a data source to be operated, and determining a data model corresponding to the data source to be operated;
configuring data information for the data model through a code designer, and generating a code template required by a user;
and generating a service code according to the code template through a code generator so as to deploy the service code through a micro-service deployment module.
10. A non-transitory computer storage medium storing computer-executable instructions configured to:
acquiring a data source to be operated, and determining a data model corresponding to the data source to be operated;
configuring data information for the data model through a code designer, and generating a code template required by a user;
and generating a service code according to the code template through a code generator so as to deploy the service code through a micro-service deployment module.
CN202211581212.4A 2022-12-09 2022-12-09 Code generation method, device and medium based on micro-service architecture Pending CN115878092A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211581212.4A CN115878092A (en) 2022-12-09 2022-12-09 Code generation method, device and medium based on micro-service architecture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211581212.4A CN115878092A (en) 2022-12-09 2022-12-09 Code generation method, device and medium based on micro-service architecture

Publications (1)

Publication Number Publication Date
CN115878092A true CN115878092A (en) 2023-03-31

Family

ID=85766840

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211581212.4A Pending CN115878092A (en) 2022-12-09 2022-12-09 Code generation method, device and medium based on micro-service architecture

Country Status (1)

Country Link
CN (1) CN115878092A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116185372A (en) * 2023-04-26 2023-05-30 山东浪潮科学研究院有限公司 Back-end source code generation method, device, equipment and storage medium
CN117240928A (en) * 2023-11-10 2023-12-15 浪潮通用软件有限公司 Dynamic publishing method and device for website service, medium and equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116185372A (en) * 2023-04-26 2023-05-30 山东浪潮科学研究院有限公司 Back-end source code generation method, device, equipment and storage medium
CN117240928A (en) * 2023-11-10 2023-12-15 浪潮通用软件有限公司 Dynamic publishing method and device for website service, medium and equipment

Similar Documents

Publication Publication Date Title
CN109614568B (en) Page generation method and device
CN107273117B (en) Programming-friendly agile code automatic generation system
CN107291450B (en) Programming-friendly agile code automatic generation method
CN102449598B (en) Bag design and generation
CN115878092A (en) Code generation method, device and medium based on micro-service architecture
US11392393B2 (en) Application runtime configuration using design time artifacts
US11973760B2 (en) Hierarchical permissions model within a document
CN110058856A (en) Page configuration method and device
CN110825362A (en) Low-code application software development system and method
US20140040791A1 (en) Development platform for software as a service (saas) in a multi-tenant environment
CN107102848A (en) Provide user interface element
CN104424522B (en) A kind of transaction processing system and its configuration method
US20140059517A1 (en) Method and system for facilitating rapid development of end-to-end software applications
CN110389832A (en) ZooKeeper container cluster dispositions method, system, equipment and storage medium
CN110990274B (en) Data processing method, device and system for generating test cases
CN103744647A (en) Java workflow development system and method based on workflow GPD
CN102736915A (en) Automatic program generation device, method, and computer program
CN111414166A (en) Code generation method, device, equipment and storage medium
CN109144511B (en) Method and system for automatically generating numerical simulation graphical user interface
CN115993966B (en) Application development system and method
CN108469953A (en) A kind of generation method of page table list, server and storage medium
CN107294750A (en) A kind of distribution configuring management method and device for converging group energy self-identifying
CN107357588B (en) Object code generation method and device
CN115841236A (en) Business modeling method, device and medium for realizing quick response
CN113535141A (en) Database operation code generation method and device

Legal Events

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