CN114911464A - Code generation method, device and equipment based on domain drive and storage medium - Google Patents

Code generation method, device and equipment based on domain drive and storage medium Download PDF

Info

Publication number
CN114911464A
CN114911464A CN202210505197.9A CN202210505197A CN114911464A CN 114911464 A CN114911464 A CN 114911464A CN 202210505197 A CN202210505197 A CN 202210505197A CN 114911464 A CN114911464 A CN 114911464A
Authority
CN
China
Prior art keywords
template
design
element data
design element
domain
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
CN202210505197.9A
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202210505197.9A priority Critical patent/CN114911464A/en
Publication of CN114911464A publication Critical patent/CN114911464A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to an artificial intelligence technology, and discloses a code generation method based on domain driving, which comprises the following steps: acquiring a project scheme through a preset on-line design interface, and performing element identification on the project scheme to obtain design element data; performing function design on a preset four-layer framework template according to the project scheme to obtain a function module of each level in the four-layer framework template; recognizing the dependence direction and the calling direction between each functional module according to the design element data, and configuring the four-layer framework template according to the dependence direction and the calling direction to obtain a standard framework template; and rendering the design element data to a standard architecture template through a preset template engine to obtain a target architecture code. In addition, the invention also relates to a block chain technology, and the generated architecture code can be stored in the nodes of the block chain. The invention also provides a code generation device based on the domain driver, an electronic device and a storage medium. The invention can improve the efficiency of system development.

Description

Code generation method, device and equipment based on domain drive and storage medium
Technical Field
The present invention relates to the field of artificial intelligence technologies, and in particular, to a method and an apparatus for generating a code based on a domain driver, an electronic device, and a computer-readable storage medium.
Background
With the deepening of informatization and digitization, various enterprise-level systems are built more and more, but in order to reduce the workload of developers and build systems which better meet the business requirements, development architecture needs to be utilized to develop the systems so as to design system codes conveniently.
Most of the existing development architectures are three-layer architectures, namely a presentation layer, a business logic layer and a data access layer. In practical application, the three-layer development architecture causes few butt joints between developers and business personnel, and the developers lack understanding of domain knowledge, so that the development quality is low, the advantages of object-oriented programming are difficult to exert, and the later code expansion is difficult, thereby causing the development efficiency of the system to be low.
Disclosure of Invention
The invention provides a code generation method and device based on a domain driver and a computer readable storage medium, and mainly aims to solve the problem of low efficiency in system development.
In order to achieve the above object, the present invention provides a code generation method based on domain driver, including:
acquiring a project scheme through a preset on-line design interface, and performing element identification on the project scheme to obtain design element data;
performing function design on a preset four-layer framework template according to the project scheme to obtain a function module of each level in the four-layer framework template;
recognizing a dependence direction and a calling direction between each functional module according to the design element data, and configuring the four-layer architecture template according to the dependence direction and the calling direction to obtain a standard architecture template;
and rendering the design element data to the standard architecture template through a preset template engine to obtain a target architecture code.
Optionally, the performing element identification on the project plan to obtain design element data includes:
segmenting the project plan into project information sentences;
segmenting the project information sentence into project information words;
constructing a project scheme matrix of the project scheme according to the project information words;
and inputting the project scheme matrix into a preset design element mapping set to obtain design element data.
Optionally, the performing a function design on a preset four-layer architecture template according to the project scheme to obtain a function module of each level in the four-layer architecture template includes:
extracting a business process from the project scheme;
identifying functional modules required by the business process;
and classifying and configuring the functional modules according to the levels to obtain the functional module of each level of the four-layer framework template.
Optionally, the identifying the functional module required by the business process includes:
splitting the business process implementation into a plurality of business steps;
extracting a plurality of service keywords from the service step;
and mapping the service key word corresponding to each service step with a preset function set to obtain a corresponding function module.
Optionally, the identifying the dependency direction and the call direction between each of the functional modules according to the design element data includes:
screening out limit context data from the design element data;
and obtaining the dependence direction and the calling direction between each functional module according to the bound context data.
Optionally, the rendering the design element data to the standard architecture template by a preset template engine to obtain an object architecture code includes:
determining placeholders for a plurality of code elements in the standard architecture template;
populating the placeholders with the design element data;
and rendering the filled standard architecture template by using the template engine to obtain the target architecture code.
Optionally, the populating the placeholders with the design element data includes:
filling bounding context data in the design element data into a portion of the placeholder for implementing partitioned microservices;
filling the aggregation data in the design element data into the part of the occupation space for realizing subpackage;
filling the field model data in the design element data into the position occupation part for realizing the database design;
filling command data in the design element data into the part of the placeholder for realizing the API function;
and filling event data in the design element data into the part of the placeholder for realizing asynchronous message processing.
In order to solve the above problem, the present invention further provides a domain-driven code generation apparatus, including:
the online interface design module is used for acquiring a project scheme through a preset online design interface and performing element identification on the project scheme to obtain design element data;
the functional module design module is used for carrying out functional design on a preset four-layer framework template according to the project scheme to obtain a functional module of each level in the four-layer framework template;
the architecture template configuration module is used for identifying the dependence direction and the calling direction between each functional module according to the design element data and configuring the four-layer architecture template according to the dependence direction and the calling direction to obtain a standard architecture template;
and the architecture code generation module is used for rendering the design element data to the standard architecture template through a preset template engine to obtain a target architecture code.
In order to solve the above problem, the present invention also provides an electronic device, 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 a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the domain-driven code generation method described above.
In order to solve the above problem, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is executed by a processor in an electronic device to implement the domain-driven code generation method described above.
The embodiment of the invention can realize the butt joint of business personnel and developers through the on-line design interface, achieve the effect of multi-person cooperation, conveniently acquire project schemes, further extract corresponding business processes, further obtain the function template of each level in the four-layer framework template, realize the customized design of the four-layer framework template, and enable the subsequent automatically generated codes to better meet the requirements of projects; the standard architecture template is obtained by configuring the dependence direction and the calling direction of the four-layer architecture template, so that the generated code can be ensured to conform to the field-driven design four-layer architecture, the expandability of the code is enhanced, and the robustness of the system is improved; the design element data is rendered into the standard architecture template through a preset template engine, so that automatic generation of codes is realized, archiving of drive design output is realized, the archived output element can be used as a basis for automatically generating the codes, the problem that the design output cannot correspond to the codes is solved, the analysis process, the design process and the code architecture are unified, and the unification of services and technologies is realized. Therefore, the domain-driver-based code generation method, the domain-driver-based code generation device, the electronic equipment and the computer-readable storage medium can solve the problem of low efficiency in system development.
Drawings
Fig. 1 is a schematic flowchart of a domain-driven code generation method according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating the identification of design element data according to an embodiment of the present invention;
fig. 3 is a schematic flow chart of a function determining module according to an embodiment of the present invention;
FIG. 4 is a functional block diagram of a domain-driven code generation apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device implementing the domain-driven-based code generation method according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a code generation method based on domain driving. The execution subject of the domain-driven-based code generation method includes, but is not limited to, at least one of electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiments of the present application. In other words, the domain-driven code generation method may be performed by software or hardware installed in a terminal device or a server device, and the software may be a block chain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like. The server may be an independent server, or may be a cloud server that provides basic cloud computing services such as cloud service, a cloud database, cloud computing, cloud functions, cloud storage, web service, cloud communication, middleware service, domain name service, security service, Content Delivery Network (CDN), and a big data and artificial intelligence platform.
Fig. 1 is a schematic flowchart of a domain-driver-based code generation method according to an embodiment of the present invention. In this embodiment, the method for generating a domain-driven code includes:
s1, acquiring a project scheme through a preset on-line design interface, and performing element identification on the project scheme to obtain design element data;
in the embodiment of the present invention, the obtaining of the project plan through the preset online design interface means that the online design interface is used to complete the docking between the service personnel and the developer, and further obtain the project plan designed by the developer according to the service requirements of the service personnel.
In the embodiment of the present invention, referring to fig. 2, the performing element identification on the project plan to obtain design element data includes:
s21, dividing the project scheme into project information sentences;
s22, dividing the item information sentence into item information words;
s23, constructing a project scheme matrix of the project scheme according to the project information words;
and S24, inputting the project scheme matrix into a preset design element mapping set to obtain design element data.
In detail, the design element mapping set is a data pool that includes mapping sets of various design element data and is obtained by matrixing the design element data obtained in advance, wherein the design element data obtained in advance may be obtained by crawling or searching in a webpage by using python or a database language.
In detail, the design element data includes, but is not limited to, domain event data, event command data, domain object data, bounding context data, and aggregation refinement data.
Specifically, the domain event data refers to data related to domain events, the domain events refer to events that occur in the domain and are of interest to domain experts, the domain events are components of a domain model and represent events occurring in the domain, and the domain events can be a step of a business process, such as order submission, customer payment for one hundred dollars, and order completion; the domain event can also be a timed event, such as the completion of a reconciliation every night or a follow-up action triggered after an event occurs, such as an event that a customer locks an account after losing a password three times.
In detail, the event command data refers to data related to a domain event command, the domain event command refers to an action triggered by a domain event, and the domain event command creates a domain event after being executed.
In detail, the domain object data refers to data related to a domain object, the domain object refers to a tangible or intangible business entity abstracted from the real world, and is also called an entity class, which represents a business state, runs through a presentation layer, a business layer and a persistence layer, and is finally persisted to a database, and the domain object can be regarded as a corresponding java class of a database table.
In detail, the aggregation refinement data refers to data related to aggregation refinement, the aggregation refinement refers to defining clear relationships and boundaries between objects and realizing cohesion of a domain model, objects within one aggregation have strong associations, the association design of the objects should be for the entities and the entities in one aggregation or between the entities and value objects, for example, in a domain for placing orders, order items and order states should be one aggregation, the orders and the order items are associated, and the orders and the order states are associated.
In the embodiment of the invention, the on-line design interface can realize the butt joint of business personnel and developers, achieve the effect of multi-person cooperation, and combine the business analysis process and the field drive design, thereby improving the software design efficiency.
S2, performing function design on a preset four-layer framework template according to the project scheme to obtain a function module of each level in the four-layer framework template;
in the embodiment of the present invention, referring to fig. 3, the performing a function design on a preset four-layer architecture template according to the project scheme to obtain a function module of each level in the four-layer architecture template includes:
s31, extracting a business process from the project scheme;
s32, identifying functional modules required by the business process;
and S33, classifying and configuring the functional modules according to the levels to obtain the functional module of each level of the four-layer framework template.
Specifically, the step of extracting the business process from the project plan is the same as the step of obtaining the design element data by performing element recognition on the project plan in S1.
In detail, the functional module required for identifying the business process includes:
splitting the business process implementation into a plurality of business steps;
extracting a plurality of service keywords from the service step;
and mapping the service key word corresponding to each service step with a preset function set to obtain a corresponding function module.
For example, if the service flow includes a step of identifying a command of a user, the extracted service keyword is an identification/user/command, and the function modules obtained after mapping with the preset function set are Requestobject and ClientImpl.
In the embodiment of the present invention, the preset four-layer architecture template is functionally designed according to the project scheme, and the function module of each level in the obtained four-layer architecture template can realize the customization of the four-layer architecture template, so that the names of different projects and different package names can be defined according to different projects, and the subsequent automatically generated codes can better meet the requirements of the projects.
S3, recognizing the dependence direction and the calling direction among the functional modules according to the design element data, and configuring the four-layer architecture template according to the dependence direction and the calling direction to obtain a standard architecture template;
in an embodiment of the present invention, the identifying, according to the design element data, a dependency direction and a call direction between each of the functional modules includes:
screening out limit context data from the design element data;
and obtaining the dependence direction and the calling direction between each functional module according to the bound context data.
In detail, the bounding context data refers to data related to a bounding context, where the bounding context is the boundary of a language, and for a domain model, the bounding context is the boundary of a model, and both correspond to the definition of a problem space, and for the architecture of a system, the bounding context also determines an application boundary and a technical boundary, and further determines the whole system and the solution data of each bounding context, so to speak, the bounding context is an important bridge connecting the problem space and the solution data space.
In detail, the identifying of the dependency direction and the call direction between each of the functional modules according to the design element data includes:
the display layer calls and depends on the functional module and data of the application service layer;
the application service layer calls and depends on the function module and data of the field layer;
the method comprises the following steps that a domain layer calls a functional module and data of an infrastructure layer, and the infrastructure layer depends on the functional module and data of the domain layer;
the infrastructure layer calls the data of the database.
In the embodiment of the invention, the four-layer architecture template is configured according to the dependence direction and the calling direction to obtain the standard architecture template, so that the generated code can be ensured to conform to the four-layer architecture of the field-driven design, the expandability of the code is enhanced, the robustness of the system is improved, and the corruption of the architecture is prevented.
S4, rendering the design element data to the standard architecture template through a preset template engine to obtain a target architecture code;
in an embodiment of the present invention, the rendering the design element data to the standard architecture template through a preset template engine to obtain an object architecture code includes:
determining placeholders for a plurality of code elements in the standard architecture template;
populating the placeholders with the design element data;
and rendering the filled standard architecture template by using the template engine to obtain the target architecture code.
In detail, the populating the placeholders with the design element data includes:
filling bounding context data in the design element data into a portion of the placeholder for implementing partitioned microservices;
filling the aggregation data in the design element data into the part of the occupation space for realizing subpackage;
filling the field model data in the design element data into the position occupation part for realizing the database design;
filling command data in the design element data into the part of the placeholder for realizing the API function;
and filling event data in the design element data into the part of the placeholder for realizing asynchronous message processing.
In this embodiment of the present invention, after obtaining the target architecture code, the method further includes:
acquiring a path of a storage folder of the target architecture code;
if the automatically generated target architecture code is detected, packaging and naming the storage folder;
and uploading the packaged storage folder to a preset data storage terminal.
In detail, the preset data storage end may be a data storage medium such as a block chain, a database, and the like.
In the embodiment of the invention, the preset template engine renders the design element data into the standard architecture template, so that the automatic generation of codes is realized, the workload of developers is reduced, the archiving of the design output is also realized, the archived output element can be used as a basis for automatically generating the codes, the problem that the design output cannot correspond to the codes is solved, the analysis process, the design process and the code architecture are unified, and the unification of services and technologies is realized.
The embodiment of the invention can realize the butt joint of business personnel and developers through the on-line design interface, achieve the effect of multi-person cooperation, conveniently acquire project schemes, further extract corresponding business processes, further obtain the function template of each level in the four-layer framework template, realize the customized design of the four-layer framework template, and enable the subsequent automatically generated codes to better meet the requirements of projects; the standard architecture template is obtained by configuring the dependence direction and the calling direction of the four-layer architecture template, so that the generated code can be ensured to conform to the field-driven design four-layer architecture, the expandability of the code is enhanced, and the robustness of the system is improved; the design element data is rendered into the standard architecture template through a preset template engine, so that automatic generation of codes is realized, archiving of drive design output is realized, the archived output element can be used as a basis for automatically generating the codes, the problem that the design output cannot correspond to the codes is solved, the analysis process, the design process and the code architecture are unified, and the unification of services and technologies is realized. Therefore, the domain-driven-based code generation method provided by the invention can solve the problem of low efficiency in system development.
Fig. 4 is a functional block diagram of a domain-driven code generation apparatus according to an embodiment of the present invention.
The domain-driven code generation apparatus 100 according to the present invention may be installed in an electronic device. According to the implemented functions, the domain-driven-based code generation apparatus 100 may include an online interface design module 101, a functional module design module 102, an architecture template configuration module 103, and an architecture code generation module 104. The module of the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the online interface design module 101 is configured to obtain a project scheme through a preset online design interface, and perform element identification on the project scheme to obtain design element data;
the functional module design module 102 is configured to perform functional design on a preset four-layer architecture template according to the project scheme, so as to obtain a functional module of each level in the four-layer architecture template;
the architecture template configuration module 103 is configured to identify a dependency direction and a calling direction between each of the functional modules according to the design element data, and configure the four-layer architecture template according to the dependency direction and the calling direction to obtain a standard architecture template;
the architecture code generation module 104 is configured to render the design element data to the standard architecture template through a preset template engine, so as to obtain a target architecture code.
In detail, when the modules in the domain-based driver code generation apparatus 100 according to the embodiment of the present invention are used, the same technical means as the domain-based driver code generation method described in fig. 1 to fig. 3 are used, and the same technical effect can be produced, which is not described herein again.
Fig. 5 is a schematic structural diagram of an electronic device implementing a domain-driven code generation method according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program, such as a domain-based driven code generation program, stored in the memory 11 and executable on the processor 10.
In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same function or different functions, and includes one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device by running or executing programs or modules (for example, executing a domain-based driver code generation program, etc.) stored in the memory 11 and calling data stored in the memory 11.
The memory 11 includes at least one type of readable storage medium including flash memory, removable hard disks, multimedia cards, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disks, optical disks, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, for example a removable hard disk of the electronic device. The memory 11 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only to store application software installed in the electronic device and various types of data, such as codes based on a domain-driven code generation program, but also to temporarily store data that has been output or is to be output.
The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
The communication interface 13 is used for communication between the electronic device and other devices, and includes a network interface and a user interface. Optionally, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which are typically used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable, among other things, for displaying information processed in the electronic device and for displaying a visualized user interface.
Only electronic devices having components are shown, and those skilled in the art will appreciate that the structures shown in the figures do not constitute limitations on the electronic devices, and may include fewer or more components than shown, or some components in combination, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management and the like are realized through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The domain-based code generation program stored in the memory 11 of the electronic device 1 is a combination of a plurality of instructions, and when running in the processor 10, can realize:
acquiring a project scheme through a preset on-line design interface, and performing element identification on the project scheme to obtain design element data;
performing function design on a preset four-layer framework template according to the project scheme to obtain a function module of each level in the four-layer framework template;
recognizing a dependence direction and a calling direction between each functional module according to the design element data, and configuring the four-layer architecture template according to the dependence direction and the calling direction to obtain a standard architecture template;
and rendering the design element data to the standard architecture template through a preset template engine to obtain a target architecture code.
Specifically, the specific implementation method of the instruction by the processor 10 may refer to the description of the relevant steps in the embodiment corresponding to the drawings, which is not described herein again.
Further, the integrated modules/units of the electronic device 1 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. The computer readable storage medium may be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
The present invention also provides a computer-readable storage medium, storing a computer program which, when executed by a processor of an electronic device, may implement:
acquiring a project scheme through a preset on-line design interface, and performing element identification on the project scheme to obtain design element data;
performing function design on a preset four-layer framework template according to the project scheme to obtain a function module of each level in the four-layer framework template;
recognizing a dependence direction and a calling direction between each functional module according to the design element data, and configuring the four-layer architecture template according to the dependence direction and the calling direction to obtain a standard architecture template;
and rendering the design element data to the standard architecture template through a preset template engine to obtain a target architecture code.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a string of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, which is used for verifying the validity (anti-counterfeiting) of the information and generating a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A domain-driven code generation method, the method comprising:
acquiring a project scheme through a preset on-line design interface, and performing element identification on the project scheme to obtain design element data;
performing function design on a preset four-layer framework template according to the project scheme to obtain a function module of each level in the four-layer framework template;
recognizing a dependence direction and a calling direction between each functional module according to the design element data, and configuring the four-layer architecture template according to the dependence direction and the calling direction to obtain a standard architecture template;
and rendering the design element data to the standard architecture template through a preset template engine to obtain a target architecture code.
2. The domain-driven-based code generation method of claim 1, wherein the performing element recognition on the project plan to obtain design element data comprises:
segmenting the project scheme into project information sentences;
segmenting the project information sentence into project information words;
constructing a project scheme matrix of the project scheme according to the project information words;
and inputting the project scheme matrix into a preset design element mapping set to obtain design element data.
3. The domain-driven-based code generation method according to claim 1, wherein the performing a function design on a preset four-layer architecture template according to the project plan to obtain a function module of each level in the four-layer architecture template includes:
extracting a business process from the project scheme;
identifying functional modules required by the business process;
and classifying and configuring the functional modules according to the levels to obtain the functional module of each level of the four-layer framework template.
4. The domain-driven-based code generation method of claim 3, wherein the identifying the functional modules required by the business process comprises:
splitting the business process implementation into a plurality of business steps;
extracting a plurality of service keywords from the service step;
and mapping the service key word corresponding to each service step with a preset function set to obtain a corresponding function module.
5. The domain-driven-based code generation method according to claim 1, wherein the identifying a dependency direction and a call direction between each of the functional modules from the design element data includes:
screening out limit context data from the design element data;
and obtaining the dependence direction and the calling direction between each functional module according to the bound context data.
6. The method for generating code based on domain driving according to claim 1, wherein the rendering the design element data into the standard architecture template through a preset template engine to obtain target architecture code comprises:
determining placeholders for a plurality of code elements in the standard architecture template;
populating the placeholders with the design element data;
and rendering the filled standard architecture template by using the template engine to obtain the target architecture code.
7. The domain-driven code generation method of any one of claims 1 to 6, wherein the populating the placeholders with the design element data comprises:
filling bounding context data in the design element data into a portion of the placeholder for implementing partitioned microservices;
filling the aggregation data in the design element data into the part of the occupation space for realizing subpackage;
filling the field model data in the design element data into the part of the occupation space for realizing the database design;
filling command data in the design element data into the part of the placeholder for realizing the API function;
and filling event data in the design element data into the part of the placeholder for realizing asynchronous message processing.
8. A domain-driven-based code generation apparatus, the apparatus comprising:
the online interface design module is used for acquiring a project scheme through a preset online design interface and performing element identification on the project scheme to obtain design element data;
the functional module design module is used for carrying out functional design on a preset four-layer framework template according to the project scheme to obtain a functional module of each level in the four-layer framework template;
the architecture template configuration module is used for identifying the dependence direction and the calling direction between each functional module according to the design element data and configuring the four-layer architecture template according to the dependence direction and the calling direction to obtain a standard architecture template;
and the architecture code generation module is used for rendering the design element data to the standard architecture template through a preset template engine to obtain a target architecture code.
9. An electronic device, characterized in that the electronic device comprises:
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 a computer program executable by the at least one processor to enable the at least one processor to perform the domain-based driven code generation method of any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the domain-based code generation method according to any one of claims 1 to 7.
CN202210505197.9A 2022-05-10 2022-05-10 Code generation method, device and equipment based on domain drive and storage medium Pending CN114911464A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210505197.9A CN114911464A (en) 2022-05-10 2022-05-10 Code generation method, device and equipment based on domain drive and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210505197.9A CN114911464A (en) 2022-05-10 2022-05-10 Code generation method, device and equipment based on domain drive and storage medium

Publications (1)

Publication Number Publication Date
CN114911464A true CN114911464A (en) 2022-08-16

Family

ID=82767482

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210505197.9A Pending CN114911464A (en) 2022-05-10 2022-05-10 Code generation method, device and equipment based on domain drive and storage medium

Country Status (1)

Country Link
CN (1) CN114911464A (en)

Similar Documents

Publication Publication Date Title
CN113961584A (en) Method and device for analyzing field blood relationship, electronic equipment and storage medium
CN113946690A (en) Potential customer mining method and device, electronic equipment and storage medium
CN113238929B (en) Code testing method and device based on Mock data, electronic equipment and storage medium
CN113806434B (en) Big data processing method, device, equipment and medium
CN114881616A (en) Business process execution method and device, electronic equipment and storage medium
CN114511038A (en) False news detection method and device, electronic equipment and readable storage medium
CN114185776A (en) Big data point burying method, device, equipment and medium for application program
CN114519084A (en) Block chain-based medical data inspection method, device, equipment and medium
CN114816371B (en) Message processing method, device, equipment and medium
CN115346095A (en) Visual question answering method, device, equipment and storage medium
CN114356379A (en) Backup-based service upgrading method, device, equipment and storage medium
CN114911479A (en) Interface generation method, device, equipment and storage medium based on configuration
CN114896164A (en) Interface optimization method and device, electronic equipment and storage medium
CN115827115A (en) H5 page jump method, device, equipment and storage medium of WeChat applet
CN115220740A (en) Database environment deployment method and device, electronic equipment and storage medium
CN114398282A (en) Test script generation method, device, equipment and storage medium
CN115310979A (en) Data payment method and device, electronic equipment and storage medium
CN114185522A (en) Page theme customizing method and device, electronic equipment and storage medium
CN114911464A (en) Code generation method, device and equipment based on domain drive and storage medium
CN115543214B (en) Data storage method, device, equipment and medium in low-delay scene
CN114860349B (en) Data loading method, device, equipment and medium
CN115617661A (en) Simulation system test method, simulation system test device, electronic equipment and storage medium
CN115098514A (en) Method and device for identifying scene based on annotation, electronic equipment and storage medium
CN114995940A (en) Bullet frame configuration and display method, device, equipment and storage medium
CN114581044A (en) Scheme configuration method and device, electronic equipment and readable storage medium

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