Code generation method, device, equipment and storage medium based on custom module

By obtaining business field scenario requirements, developing and publishing business field template components, using a low-code development platform to splice components, and finally generating business field code, it solves the problem of low efficiency in user development component templates, realizes customized code generation, and improves development efficiency.

CN115202639BActive Publication Date: 2025-05-02PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210855840.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-20
Publication Date
2025-05-02
Estimated Expiration
2042-07-20

AI Technical Summary

Technical Problem

In the prior art, users are less efficient when developing component templates, mainly because the fixed template cannot meet the business needs of different users, resulting in the code template being unable to fit the user scenario.

Method used

By obtaining business field scenario requirements, developing business field template components, and using component market and low-code development platform for publishing and customization, extracting business semantics for component selection, performing component splicing, and finally generating business field code.

Benefits of technology

It realizes the generation of customized codes based on the user's specific business needs, improves the user's development efficiency, and solves the problem of template fixation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115202639B_ABST
    Figure CN115202639B_ABST
Patent Text Reader

Abstract

The present invention relates to artificial intelligence technology, and discloses a code generation method based on a custom module, including: obtaining business domain scenario requirements, and developing business domain template components according to the business domain scenario requirements; using a preset component market to publish the business domain template components, and using a preset low-code development platform to open the custom template; extracting the business semantics in the published business domain template components, and selecting business components according to the business semantics to obtain business domain components; splicing the custom template components according to the business domain components to obtain a component splicing template; generating business domain code according to the component splicing template. In addition, the present invention also relates to blockchain technology, and business domain scenario requirements can be stored in blockchain nodes. The present invention also proposes a code generation device, electronic device, and storage medium based on a custom module. The present invention can improve the development efficiency of component templates.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a code generation method, device, electronic device and computer-readable storage medium based on a custom module. Background Art

[0002] As people's needs become more diverse, different users have different business needs, and business needs have corresponding business scenarios. However, in order to reduce the workload of users downloading traditional templates to generate codes and then modify them, and to improve users' development efficiency, it is necessary to screen out components that meet user needs from a large number of components to generate codes.

[0003] Existing template code generation technologies mostly involve template manufacturers making generalized templates, and users selecting templates from the generalized templates, using the templates after selecting them, and finally generating code for the selected templates. In actual applications, different users have different business needs. Considering only fixed templates may result in code templates that cannot fit user scenarios due to generalization, which results in low efficiency in component template development for users. Summary of the invention

[0004] The present invention provides a method and device for generating a code based on a custom module and a computer-readable storage medium, the main purpose of which is to solve the problem of low efficiency in developing component templates for users.

[0005] To achieve the above object, the present invention provides a code generation method based on a custom module, comprising:

[0006] Obtaining business domain scenario requirements, and developing business domain template components according to the business domain scenario requirements;

[0007] Use the preset component market to publish the business domain template components, and use the preset low-code development platform to open the custom template;

[0008] Extracting business semantics from the published business domain template component, and selecting business components according to the business semantics to obtain business domain components;

[0009] Component splicing is performed on the custom template according to the business domain components to obtain a component splicing template;

[0010] Generate business domain code according to the component splicing template.

[0011] Optionally, developing a business domain template component according to the business domain scenario requirements includes:

[0012] Determine the business data and business interface style required by the business domain according to the business domain scenario requirements;

[0013] Writing component methods using the business data and the business interface style;

[0014] The business data and component methods are encapsulated to obtain the business domain template component.

[0015] Optionally, the publishing the business domain template component by using a preset component market includes:

[0016] Utilizing the component task publishing plug-in in the component market to publish the business domain template component to the task queue;

[0017] Obtaining component publishing tasks from the task queue using a preset task server;

[0018] Extracting component information from the component publishing task;

[0019] The business domain template component is published according to the component information.

[0020] Optionally, selecting a business component according to the business semantics to obtain a business domain component includes:

[0021] Annotate the business component according to the business semantics to obtain a business component label;

[0022] Calculating the matching degree between the service component label and the service component label in a preset database;

[0023] The business component label with the greatest matching degree is selected as the business domain component.

[0024] Optionally, the component splicing of the custom template according to the business domain components to obtain a component splicing template includes:

[0025] Acquire business processes based on the business domain requirements;

[0026] Determine the splicing rules of the business domain components according to the business process;

[0027] The custom templates are spliced ​​into the component splicing templates according to the splicing rules using a preset development framework.

[0028] Optionally, generating a business domain code according to the component splicing template includes:

[0029] Generate component text information of the component splicing template using a preset template engine;

[0030] Performing semantic analysis on the component text information to obtain a component syntax tree;

[0031] Performing structural transformation on the component syntax tree to obtain a component structure syntax tree;

[0032] The component structure syntax tree is structurally compiled to obtain business domain code.

[0033] Optionally, performing semantic analysis on the component text information to obtain a component syntax tree includes:

[0034] Using a preset compilation tool to perform lexical analysis on the component text information to obtain a token stream;

[0035] The token stream is parsed to obtain a component syntax tree.

[0036] In order to solve the above problems, the present invention also provides a code generation device based on a custom module, the device comprising:

[0037] A business domain template component development module is used to obtain business domain scenario requirements and develop business domain template components according to the business domain scenario requirements;

[0038] A business domain template component publishing module, used to publish the business domain template component using a preset component market, and to open a custom template using a preset low-code development platform;

[0039] A business domain component selection module is used to extract the business semantics in the published business domain template component and select the business component according to the business semantics to obtain the business domain component;

[0040] A component splicing module, used to perform component splicing on the custom template according to the business domain components to obtain a component splicing template;

[0041] The business domain code generation module is used to generate business domain code according to the component splicing template.

[0042] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:

[0043] at least one processor; and,

[0044] a memory communicatively connected to the at least one processor; wherein,

[0045] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the above-mentioned code generation method based on the custom module.

[0046] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned code generation method based on a custom module.

[0047] The embodiment of the present invention can collect business domain requirements, develop template components according to business domain requirements, and publish components through the component market. Users can open the custom template module through the low-code development platform, select components according to business domain requirements, implement templates through component splicing, and generate business domain codes according to the templates. Users can download the business domain codes and use them in specific business scenarios, which can effectively solve the problem of fixed generated templates and improve the user's development efficiency. Therefore, the code generation method based on custom templates proposed in the present invention can solve the problem of low efficiency in component template development for users. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 A flowchart of a method for generating code based on a custom module provided by an embodiment of the present invention;

[0049] Figure 2 A schematic diagram of a process for publishing a business domain template component provided by an embodiment of the present invention;

[0050] Figure 3 A schematic diagram of a process for selecting a business domain component provided by an embodiment of the present invention;

[0051] Figure 4 A functional module diagram of a code generation device based on a custom module provided by an embodiment of the present invention;

[0052] Figure 5 A schematic diagram of the structure of an electronic device for implementing the method for generating a code based on a custom module provided by an embodiment of the present invention.

[0053] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0054] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0055] The embodiment of the present application provides a code generation method based on a custom module. The execution subject of the code generation method based on the custom module includes but is not limited to at least one of the electronic devices that can be configured to execute the method provided by the embodiment of the present application, such as a server, a terminal, etc. In other words, the code generation method based on the custom module can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms.

[0056] Reference Figure 1 FIG. 1 is a flow chart of a method for generating code based on a custom module according to an embodiment of the present invention. In this embodiment, the method for generating code based on a custom module includes:

[0057] S1. Obtaining business domain scenario requirements, and developing business domain template components according to the business domain scenario requirements;

[0058] In an embodiment of the present invention, the business domain scenario requirements may have different business requirements in different business scenarios. For example, when handling certificate-related business, it is necessary to obtain information such as name, date of birth, and ID number; when handling bill-related business, that is, when handling invoices, it is necessary to obtain information such as the invoice code, invoice number, invoice date, and inspection number.

[0059] In the embodiment of the present invention, business domain scenario requirements can be obtained through questionnaires, user feedback, etc., wherein the business domain scenario requirements are business requirements corresponding to when users handle business, including but not limited to questionnaires, personal feedback, etc. of the target users.

[0060] In an embodiment of the present invention, developing a business domain template component according to the business domain scenario requirements includes: determining the business data and business interface style of the business domain requirements according to the business domain scenario requirements; writing a component method using the business data and the business interface style; and encapsulating the business data and component method to obtain the business domain template component.

[0061] Exemplarily, when the business domain scenario requirement may be to count the inventory of goods in a supermarket, the business data in this scenario can be obtained, such as the original inventory of goods, supermarket customer flow statistics, the number of goods sold, the number of goods returned, etc. According to the business domain scenario requirement, a specific page style can be obtained. For example, based on the statistical commodity inventory, a page style for the commodity inventory can be designed, such as the original commodity inventory input box.

[0062] In detail, a JAVA statement with a method writing function can be used to write a component method using the business data and the business interface style, wherein code component code is written according to the business data and the business interface style to obtain a component method.

[0063] In detail, the business data and component methods can be encapsulated using a preset encapsulation plug-in, wherein the encapsulation plug-in includes but is not limited to a Javascript encapsulation plug-in and a jQuery encapsulation plug-in, wherein a component is a simple encapsulation of data and methods and is the basic component unit of a front-end page. A page can be regarded as a combination of N components.

[0064] S2. Use the preset component market to publish the business domain template component, and use the preset low-code development platform to open the custom template;

[0065] In the embodiment of the present invention, the component market includes but is not limited to the plug-in market of vscode, which provides a development scaffolding, local development, debugging, and a market where components can be freely released.

[0066] In the embodiment of the present invention, Figure 2 As shown, the use of a preset component market to publish the business domain template component includes:

[0067] S21, using the component task publishing plug-in in the component market to publish the business domain template component to the task queue;

[0068] S22, using a preset task server to obtain a component publishing task from the task queue;

[0069] S23, extracting component information in the component publishing task;

[0070] S24. Publish the business domain template component according to the component information.

[0071] In detail, the component task publishing module is to create a URL (Uniform Locator) of a component publishing task package, send the component publishing task package to a task queue, obtain a component publishing task according to a task sequence number in the task queue, and thereby publish the component.

[0072] Specifically, a Python statement with information extraction function may be used to extract component information in the component publishing task, wherein the component information includes component name, component version information, component application scenario, and the like.

[0073] Furthermore, for example, the component market may have functions such as deleting, adding, editing, and listing components. When publishing a component, the publish function is clicked, and there is component information on the publishing page. Therefore, the business domain template component is published according to the component information.

[0074] In an embodiment of the present invention, the low-code development platform (LCDP) is a development platform that can quickly generate applications without coding (0 code) or with a small amount of code, and creates the principles of automatic code generation and visual programming, and a method of visual application development, so that developers with different experience levels can use a graphical user interface, drag components and model-driven logic to create web pages and mobile applications.

[0075] In detail, in the low-code development platform, users can open custom templates and select components according to business needs to complete the custom template and apply the custom template to actual business.

[0076] S3, extracting the business semantics in the published business domain template component, and selecting business components according to the business semantics to obtain business domain components;

[0077] In an embodiment of the present invention, the business semantics include metadata descriptions of business domain template components (including object hierarchies and verification logic, display logic, editability logic, and triggers in various business scenarios). Different business semantics exist in different scenarios. For example, when handling banking business, the business semantics correspond to the operations that need to be performed when handling banking business.

[0078] In detail, a semantic network model with semantic extraction function can be used to extract business semantics in the published business domain template component, wherein the semantic network model is a kind of symbol-network model in knowledge representation, which is a pre-stored model that has been stored in the semantic memory in advance. When it is necessary to extract semantic information, the business semantics in the business domain template component can be extracted along the business logic.

[0079] In the embodiment of the present invention, Figure 3 As shown, the business component is selected according to the business semantics to obtain the business domain component, including:

[0080] S31, annotating the business component according to the business semantics to obtain a business component label;

[0081] S32, calculating the matching degree between the business component label and the business component label in a preset database;

[0082] S33: Select the business component label with the greatest matching degree as the business domain component.

[0083] Specifically, the semantic annotation is centered on the predicate of the sentence and analyzes the relationship between each component and the predicate in the sentence, that is, the predicate-argument structure of the sentence. For example, in the business of price settlement in shopping, the business semantics can be adding to the shopping cart, order settlement, commodity inventory, etc. The required components include shopping cart components, order components, inventory components, and payment management components to form a shopping cart page. In the component market, components that constitute the shopping cart page must be selected from many components, and the business components are annotated according to the business semantics to obtain the business component labels required to constitute the shopping cart page. That is, when the commodity inventory is to be counted, the inventory components will be annotated to obtain the inventory component labels.

[0084] In detail, the calculating the matching degree between the business component label and the business component label in a preset database includes:

[0085] The matching degree between the service component label and the service component label in the preset database is calculated using the following algorithm:

[0086]

[0087] Wherein, P is the matching degree, t i is the i-th vector in the business component label, h i is the ith vector in the business component label in the database, and n is the number of vectors.

[0088] In one of the practical application scenarios of the present invention, due to the complexity of the information system, a business activity cannot usually be implemented with only one business component, but requires a combination of multiple business components to be implemented. The combination of business components can be based on each component accepting only a part of the activity input data as input, and outputting a part of the activity input data at the same time, and the input and output of each component are combined to just meet the input and output of the activity, that is, parallel combination.

[0089] S4, splicing the custom template according to the business domain components to obtain a component splicing template;

[0090] In an embodiment of the present invention, in the custom template, component selection can be performed according to business needs, and the user can decide whether the custom template contains the required business framework. For example, if the user wants to form a travel component in the custom template, the user can select a map component, a weather component, and a to-do component, and splice the map component, the weather component, and the to-do component in the custom template to obtain a component splicing template of the travel component.

[0091] In an embodiment of the present invention, the custom template is spliced ​​with components according to the business domain components to obtain a component splicing template, including: obtaining a business process according to the business domain requirements; determining a splicing rule of the business domain components according to the business process; and using a preset development framework to splice the custom template into the component splicing template according to the splicing rule.

[0092] For example, when the business domain requirement is to add new customers, the business processes including customer file creation, customer information verification, adding new customer files, and establishing customer relationships will be based on the needs of the new customers.

[0093] In detail, the development framework includes but is not limited to react (web development framework), which is mainly used to build UI. Various types of parameters can be passed in React, such as declaring code, rendering UI, static HTML elements, dynamic variables, and even interactive application components, to build encapsulated components that manage their own states, and then combine them to form a complex UI. The splicing rule can be to splice components according to the order of the business process.

[0094] S5. Generate business domain code according to the component splicing template.

[0095] In one of the actual application scenarios of the present invention, in the banking application software system, business relevance is required between various transactions, and it is difficult to directly express its business meaning with existing components; the realization of a business function in the banking application software system requires the coupling and association of multiple technical components, which increases the combination complexity of the technical component development application system. Therefore, it is necessary to develop components according to different business needs, select the components according to different business scenarios, and form a business component template to facilitate subsequent application in business scenarios.

[0096] In an embodiment of the present invention, generating business domain code based on the component splicing template includes: using a preset template engine to generate component text information of the component splicing template; performing semantic analysis on the component text information to obtain a component syntax tree; performing structural conversion on the component syntax tree to obtain a component structural syntax tree; and performing structural compilation on the component structural syntax tree to obtain business domain code.

[0097] In detail, the template engine includes but is not limited to FreeMaker. FreeMaker can make HTML static. The components in the component splicing template are composed of HTML. The template engine can be used to generate component text information from the component splicing template.

[0098] In detail, the semantic analysis of the component text information to obtain the component syntax tree includes: using a preset compilation tool to perform lexical analysis on the component text information to obtain a token stream; and performing syntax analysis on the token stream to obtain a component syntax tree.

[0099] Specifically, the semantic analysis is a process of parsing text information of a component into a component syntax tree. The semantic analysis may include lexical analysis and grammatical analysis. The compilation tool includes but is not limited to Babel.

[0100] Furthermore, the structural conversion of the component syntax tree may be performed by performing operations such as adding nodes, updating nodes, and removing nodes on the nodes in the component syntax tree, so as to convert the component syntax tree.

[0101] Specifically, compilation is the process of using compilation tools to generate a target program from a source program written in a source language. The compilation tool can be used to convert a source program with a higher version syntax into a source program with a lower version syntax. For example, the compilation tool can be used to convert a component written in JavaScript with a higher version syntax into a backward-compatible JavaScript syntax, perform structural transformation on the JavaScript syntax, and compile the structural syntax tree to obtain the business domain code.

[0102] The embodiment of the present invention can collect business domain requirements, develop template components according to business domain requirements, and publish components through the component market. Users can open the custom template module through the low-code development platform, select components according to business domain requirements, implement templates through component splicing, and generate business domain codes according to the templates. Users can download the business domain codes and use them in specific business scenarios, which can effectively solve the problem of fixed generated templates and improve the user's development efficiency. Therefore, the code generation method based on custom templates proposed in the present invention can solve the problem of low efficiency in component template development for users.

[0103] like Figure 4 , which is a functional module diagram of a code generation device based on a custom module provided by an embodiment of the present invention.

[0104] The code generation device 100 based on the custom module of the present invention can be installed in an electronic device. According to the functions to be implemented, the code generation device 100 based on the custom module can include a business domain template component development module 101, a business domain template component publishing module 102, a business domain component selection module 103, a component splicing module 104 and a business domain code generation module 105. The module of the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.

[0105] In this embodiment, the functions of each module / unit are as follows:

[0106] The business domain template component development module 101 is used to obtain business domain scenario requirements and develop business domain template components according to the business domain scenario requirements;

[0107] The business domain template component publishing module 102 is used to publish the business domain template component using a preset component market, and to open a custom template using a preset low-code development platform;

[0108] The business domain component selection module 103 is used to extract the business semantics in the published business domain template component, and select the business component according to the business semantics to obtain the business domain component;

[0109] The component splicing module 104 is used to perform component splicing on the custom template according to the business domain components to obtain a component splicing template;

[0110] The business domain code generation module 105 is used to generate business domain code according to the component splicing template.

[0111] In detail, each module described in the code generation device 100 based on the custom module in the embodiment of the present invention is used in the same manner as described above. Figures 1 to 3 The code generation method based on custom modules described in the above is the same technical means and can produce the same technical effects, so I will not go into details here.

[0112] like Figure 5 , is a schematic diagram of the structure of an electronic device for implementing a method for generating a code based on a custom module provided by an embodiment of the present invention.

[0113] The electronic device 1 may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a code generation program based on a custom module.

[0114] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes various functions and processes data of the electronic device by running or executing programs or modules stored in the memory 11 (for example, executing a code generation program based on a custom module, etc.), and calling data stored in the memory 11.

[0115] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of an electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 can not only be used to store application software and various types of data installed in the electronic device, such as the code of a code generation program based on a custom module, but also can be used to temporarily store data that has been output or is to be output.

[0116] The communication bus 12 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.

[0117] The communication interface 13 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally 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, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.

[0118] The figure only shows an electronic device with components. Those skilled in the art will understand that the structure shown in the figure does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0119] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

[0120] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0121] The code generation program based on the custom module stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:

[0122] Obtaining business domain scenario requirements, and developing business domain template components according to the business domain scenario requirements;

[0123] Use the preset component market to publish the business domain template components, and use the preset low-code development platform to open the custom template;

[0124] Extracting business semantics from the published business domain template component, and selecting business components according to the business semantics to obtain business domain components;

[0125] Component splicing is performed on the custom template according to the business domain components to obtain a component splicing template;

[0126] Generate business domain code according to the component splicing template.

[0127] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, which will not be repeated here.

[0128] Furthermore, if the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).

[0129] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can implement:

[0130] Obtaining business domain scenario requirements, and developing business domain template components according to the business domain scenario requirements;

[0131] Use the preset component market to publish the business domain template components, and use the preset low-code development platform to open the custom template;

[0132] Extracting business semantics from the published business domain template component, and selecting business components according to the business semantics to obtain business domain components;

[0133] Component splicing is performed on the custom template according to the business domain components to obtain a component splicing template;

[0134] Generate business domain code according to the component splicing template.

[0135] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0136] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0137] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0138] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0139] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.

[0140] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0141] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0142] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

[0143] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A code generation method based on a custom module, characterized in that: The method comprises: Obtaining business domain scenario requirements, and developing business domain template components according to the business domain scenario requirements; Use the preset component market to publish the business domain template components, and use the preset low-code development platform to open the custom template; Extracting business semantics from the published business domain template component, and selecting business components according to the business semantics to obtain business domain components, wherein the business semantics includes metadata description of the business domain template component; Component splicing is performed on the custom template according to the business domain components to obtain a component splicing template; Generate business domain code according to the component splicing template; Wherein, developing a business domain template component according to the business domain scenario requirements includes: determining the business data and business interface style of the business domain scenario requirements according to the business domain scenario requirements; writing a component method using the business data and the business interface style; encapsulating the business data and the component method to obtain the business domain template component; The selecting business components according to the business semantics to obtain business domain components includes: labeling the business components according to the business semantics to obtain business component tags; calculating the matching degree between the business component tags and business component tags in a preset database; and selecting the business component tag with the greatest matching degree as the business domain component.

2. The code generation method based on a custom module according to claim 1, characterized in that: The using a preset component market to publish the business domain template component includes: Utilizing the component task publishing plug-in in the component market to publish the business domain template component to the task queue; Obtaining component publishing tasks from the task queue using a preset task server; Extracting component information from the component publishing task; The business domain template component is published according to the component information.

3. The code generation method based on a custom module according to claim 1, characterized in that: The step of performing component splicing on the custom template according to the business domain components to obtain a component splicing template includes: Obtain business processes based on the business domain scenario requirements; Determine the splicing rules of the business domain components according to the business process; The custom templates are spliced ​​into the component splicing templates according to the splicing rules using a preset development framework.

4. The method for generating code based on a custom module according to any one of claims 1 to 3, characterized in that: The generating of the business domain code according to the component splicing template includes: Generate component text information of the component splicing template using a preset template engine; Performing semantic analysis on the component text information to obtain a component syntax tree; Performing structural transformation on the component syntax tree to obtain a component structure syntax tree; The component structure syntax tree is structurally compiled to obtain business domain code.

5. The method for generating code based on a custom module according to claim 4, characterized in that: The semantic analysis of the component text information to obtain a component syntax tree includes: Using a preset compilation tool to perform lexical analysis on the component text information to obtain a token stream; The token stream is parsed to obtain a component syntax tree.

6. A code generation device based on a custom module, used to implement the code generation method based on a custom module as claimed in any one of claims 1 to 5, characterized in that: The device comprises: A business domain template component development module is used to obtain business domain scenario requirements and develop business domain template components according to the business domain scenario requirements; A business domain template component publishing module, used to publish the business domain template component using a preset component market, and to open a custom template using a preset low-code development platform; A business domain component selection module is used to extract the business semantics in the published business domain template component and select the business component according to the business semantics to obtain the business domain component; A component splicing module, used to perform component splicing on the custom template according to the business domain components to obtain a component splicing template; The business domain code generation module is used to generate business domain code according to the component splicing template.

7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the code generation method based on a custom module as described in any one of claims 1 to 5.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for generating code based on a custom module as described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Method for rapidly developing BI platform based on EXTJS

    CN103268227A

  • Project code automatic generation method and device, computer equipment and storage medium

    CN109828752A