Low-code design method and device
By dividing the system modules and supporting multiple data sources and user-uploaded templates, the problem of insufficient flexibility and customization of low-code tools is solved, and efficient automatic generation of codes in different languages across platforms is achieved, simplifying the development process and ensuring code quality.
Patent Information
- Application Number
- CN202410389921.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-23
- Publication Date
- 2025-09-23
AI Technical Summary
Existing low-code tools/platforms have problems such as limited flexibility, insufficient customization, dependence on vendor support, code generation being tied to the platform, inability to generate code in different languages, and low template creation efficiency.
The system is divided into metadata preparation module, metadata module, template module, configuration information module, context module and low-code main module. Data interaction and processing are carried out through these modules, supporting multiple data sources, generating codes in different languages, and allowing users to upload templates for customization.
It realizes the generation of code in different languages independent of the platform, supports the generation of single files and entire project files, improves the flexibility and efficiency of code generation, simplifies the development process, reduces the difficulty of maintenance, and ensures code quality and style consistency.
Smart Images

Figure CN120687083A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of computer technology and software technology, and in particular to a low-code design method and device for automatically generating code. Background Art
[0002] For the convenience of writing, the relevant terms or abbreviations are explained first.
[0003] Template file:
[0004] Template files contain special characters in addition to general text. These characters are replaced with values in corresponding variables to generate different files. This helps developers reduce repetitive work, improve efficiency, and ensure that generated files or code conform to consistent styles and standards. Developers can choose the appropriate template based on their specific needs.
[0005] template:
[0006] It includes template files and template projects. A template project can include multiple template files and non-template files.
[0007] Tags / Labels:
[0008] In the template file, specific characters need to be processed or replaced with specific values. The same template can generate different codes by inputting different metadata.
[0009] Metadata:
[0010] Low-code tools generate code with the following basic information: table name, field information (field name, whether required, whether used in the display list or the insert list), project name, package name (space name), whether to generate a JAR or WAR file, whether to use Spring Boot or Spring Cloud, etc. The information may only contain part of the information, and the information may vary depending on the language, project type, technology, etc.
[0011] Code:
[0012] When code does not cause confusion, it can be understood as the code itself or the file where the code is located.
[0013] Low-code devices:
[0014] Refers to tools, platforms, systems or devices that can reduce programming / coding and automatically generate code (these names can be used as synonyms and are not strictly distinguished).
[0015] SUID:
[0016] Query, modify, add, delete, is a combination of the first letters of the four SQL operations Select, Update, Insert, and Delete, and is synonymous with CRUD.
[0017] Coding complexity C(n):
[0018] Coding complexity refers to the trend in the amount of code required to solve a problem as the problem size n increases. If the amount of code required increases proportionally with the problem size n, the coding complexity of the problem is O(n). If the amount of code required remains constant regardless of the problem size n, the coding complexity of the problem is O(l). Therefore, the coding complexity C(n) can be expressed as a function O, reflecting the relationship between the coding effort required to solve the problem and the problem size.
[0019] With the development of information technology, rapidly changing demands are in conflict with stagnant coding techniques. Traditional application development methods are cumbersome and time-consuming. Low-code technology has emerged to provide developers with a faster and more efficient way to develop applications. Through visual modeling and automated code generation, low-code tools can help developers quickly build applications, reduce development costs, and improve efficiency.
[0020] However, existing low-code tools / platforms still have many shortcomings, including:
[0021] 1) Limited flexibility: The code of the low-code platform needs to be introduced, and the generated code is bound and coupled with the specific platform, making the generated code highly dependent on the generated platform, and even needs to be deployed to a specific cloud environment when running.
[0022] 2) Insufficient customization and poor scalability: The components and functions provided by some low-code tools / platforms may not fully meet specific business needs and require additional custom development; but on the other hand, the generated code is not easy to expand.
[0023] 3) Dependence on vendor support: Applications developed using low-code tools / platforms usually rely on support and updates from the corresponding vendors. Once the vendor stops maintenance, it may affect the stability and functional expansion of the application.
[0024] 4) Code can only be generated based on a template file, not the entire executable project file. Only system-preset type files can be generated; generating code / files in different languages is not supported.
[0025] 5) Special templates need to be created, and directly runnable code cannot be used as a template; template creation is inefficient, and it takes a long time to create a specific template from executable code; template upgrades are inconvenient, and when there are many code changes, it is more troublesome to synchronize template updates. Summary of the Invention
[0026] The present invention provides a low-code design method and device for realizing automatic code generation, aiming to solve at least one of the above-mentioned technical problems.
[0027] Therefore, one object of the present invention is to provide a method for solving the above-mentioned problem; another object of the present invention is to provide a device for solving the above-mentioned problem.
[0028] In order to achieve the above first object, the present invention proposes the following technical solutions:
[0029] Divide the system into at least the metadata preparation module, metadata module, template module, configuration information module, context module, low-code main module, and preview and download module. The metadata preparation module and metadata module exchange data through interfaces. The multiple templates listed may all use data from the configuration information module and context module.
[0030] 1) The metadata preparation module is responsible for collecting basic metadata information and processing it.
[0031] The metadata preparation module is responsible for processing the received information, as long as the collected data is ultimately converted into the data format required by the metadata module interface. Therefore, the metadata preparation module can support data from multiple sources and in different formats.
[0032] 2) The metadata module receives and processes the data from the metadata preparation module, converting it into the target metadata format. The data provided by the metadata preparation module is generally simple in structure and must be processed in the metadata module to suit the processing logic of the low-code tool.
[0033] 3) The template module receives templates, sample files, sample projects, files obtained after visualization operations, etc. uploaded by users, and then processes them to obtain templates that meet the requirements; the template module can also have system default templates.
[0034] A template can be an executable file or project. The code in the template file can be judged by the name of a specific rule to determine whether it is a tag, so as to perform text replacement, whether to perform loop processing, etc.
[0035] Templates can be user-provided or system-default; they can be processed and converted into a format that can be processed by a template engine. Template functionality can also be implemented using code, in which case templates are unnecessary. For example, when generating JavaBean files, this can be achieved directly through code (using metadata) or by using a template engine to generate them using a combination of templates and metadata.
[0036] 4) The configuration information module manages and stores configuration-related information; the context module manages and stores context information used by the system.
[0037] 5) The low-code main module uses metadata, templates, configuration information, and context information to perform business logic processing and template engine processing, and generates the final code. Based on a working example, a template is converted, and then similar functions are generated based on the template using different metadata.
[0038] The template engine generally only processes a single template at a time. After obtaining the generated code from the template engine, it generally needs to undergo other processing to convert it into a file that meets the requirements.
[0039] The low-code main module can generate different codes based on different templates. When using templates in different computer languages, the same database table information can generate different codes, such as an Orders table that can generate SUID codes in different languages. Therefore, there is no need to modify the original program when generating codes in different languages.
[0040] 6) The preview and download module provides preview and download functions.
[0041] In order to achieve the above second purpose, the present invention proposes the following technical solutions:
[0042] The device disclosed herein includes at least: a metadata preparation module, a metadata module, a template module, a configuration information module, a context module, a low-code main module, and a preview and download module. The metadata preparation module and the metadata module exchange data via an interface. The multiple templates listed may all utilize data from the configuration information module and the context module.
[0043] The metadata preparation module allows metadata to be obtained from various sources or channels, such as database tables, SQL scripts, visual form modeling, code files (such as JavaBean files), text / language, and text or language processed by AI (such as ChatGPT). Basic metadata information can be obtained by using one or more of these sources, or through multiple processing methods in different ways. This basic information is converted into the data format required by the metadata module interface. The metadata preparation module and the metadata module exchange data through the interface.
[0044] The metadata module receives and processes the data sent by the metadata preparation module, and obtains metadata in the target format after conversion.
[0045] The template module receives user-uploaded templates, sample files, sample projects, and files generated after visualization operations, and then processes them to generate templates that meet the requirements. The template module can also have system default templates. Runnable code can be used as a template, supporting both single template files and template project files for entire projects.
[0046] The configuration information module manages and stores configuration-related information; the context module manages and stores context information used by the system.
[0047] The low-code main module uses metadata, templates, configuration information, and context information to perform business logic processing and template engine processing; and generates final code; it can generate both single files and entire project files.
[0048] The preview and download module provides preview and download functions.
[0049] The low-code main module is connected to other modules. It uses the data provided by the metadata module and the template module. After generating the code, it is provided to the preview and download module for preview and download.
[0050] The beneficial effects achieved by the present invention are:
[0051] The tool supports both single template files and template project files for entire projects; both single files and entire project files can be generated. Template files and template project files are customizable, allowing users to upload their own templates and then generate code based on them. The tool also allows you to set default commonly used template files or template projects to simplify the code generation process.
[0052] Templates can be executable files or projects, making them easier to create. You can create templates just like you would develop a program, making it easier to adjust code formatting and debug programs for errors. It also makes it easier to compare generated code with the template.
[0053] Files or projects can be generated in multiple languages; there is no need to develop a tool for each language; with language as the research object, the coding complexity is O(l).
[0054] The generated code can run without relying on the generation platform; the generated code is the same as manually written code, but faster; the controllability of the code does not weaken due to the use of low-code tools; and the maintainability is not more difficult to maintain due to automatic generation. On the contrary, the generated code uses the format and style of the template, which is easier to maintain.
[0055] Can be generated multiple times.
[0056] Programmers are no longer code porters. Code like CRUD can be generated with one click. It is executable code from the beginning, and business logic can be added directly on top of it.
[0057] Save time writing demos (preliminary discussions can be repeated any number of times), save time developing general functions and CRUD functions, save time testing and debugging basic functions of interfaces (the time savings are more obvious in the front-end and back-end separation mode).
[0058] The template contains code for testing, and test code can also be generated through low-code tools.
[0059] After the table is created, the system automatically completes the SUID function, and the basic functions are completed without the programmer having to write code.
[0060] By defining the code style of the template, you can generate code with a unified code style; the code style and quality are easy to control.
[0061] The software generated for the first time can be executable and truly usable software.
[0062] Basic functions do not require manual testing or interface debugging, simplifying the entire development process. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 , the relationship diagram of the main modules of the device;
[0064] Figure 2 , an example of a simple page for entering basic metadata information through the interface;
[0065] Figure 3 ,An example of a rich page for entering metadata basic information through the interface;
[0066] Figure 4 , the engineering structure diagram of the runnable Java project;
[0067] Figure 5 , you can run the project query operation to access the sample screenshot;
[0068] Figure 6 , preview the effect of running the generated code. DETAILED DESCRIPTION
[0069] The specific embodiment of the present invention provides a low-code design method and device for realizing automatic code generation.
[0070] The embodiment described below with reference to the accompanying drawings (when a specific language description is involved, Java language is used for description) is only one implementation of the present invention and should not be understood as limiting the present invention.
[0071] The device of the present invention at least includes: metadata preparation module, metadata module, template module, configuration information module, context module, low code main module, preview and download module. Figure 1 As shown, the configuration information module and context module are not shown in the figure. Other modules may interact with these two modules. The main logic of automatic code generation lies in the low-code main module, which also uses metadata and templates. The generated code is used by the preview and download modules.
[0072] The main modules and processes are briefly described below. The metadata preparation module is responsible for collecting basic metadata information and exchanging data with the metadata module through an interface. The metadata module receives and processes data from the metadata preparation module, converting it into metadata in the target format. The template module is responsible for managing and processing templates. The low-code main module uses metadata, templates, configuration information, and context information to perform business logic processing and template engine processing, and generates the final code. The preview and download module provides preview and download functions.
[0073] To extract metadata from data in various sources and formats, the basic metadata information is collected in the metadata preparation module. The metadata preparation module interacts with the metadata module through an interface. As long as the collected data is ultimately converted into a data format that meets the metadata module interface requirements, it is sufficient.
[0074] The following will first discuss each template one by one, and then provide a comprehensive discussion.
[0075] The configuration information module manages and stores configuration-related information; the context module manages and stores context information used by the system. Other modules may interact with these two modules.
[0076] Preparing the metadata module
[0077] In the metadata preparation module, metadata can be obtained from various sources or channels, such as database tables, SQL scripts, visual form modeling, code files (such as JavaBean files), text / language, and text or language obtained through AI processing. One or more of these sources can be used, or multiple processing methods can be used to obtain basic metadata information. This basic information is then converted into the data format required by the metadata module interface.
[0078] Some optional implementations are provided below.
[0079] Visual drag and drop and configuration operations can be used as an auxiliary method to collect metadata information and as one of the implementation methods for preparing metadata modules. It is not necessary to use it. Other methods can also be used, such as entering through the interface, or directly specifying the table name in the code. Other default methods are used to obtain the information from the table structure through the program. Figure 2 As shown, you can collect information such as basic package name, page module name, DB table name, naming conversion, whether to generate a complete project, project name, project template name, etc. If you want to collect more information, you can do the following Figure 3 The example of a rich page shown here can collect Figure 2 The information mentioned in the above can also collect Rest classes (Controller classes), service interfaces and implementation classes, Java beans, whether to generate front-end pages, whether certain fields are to be used on a certain page, whether query conditions are to be used, and other detailed customization functions. The field information is obtained through the table name and displayed for users to select visually.
[0080] Metadata module
[0081] There are no specific metadata formats. When preparing the metadata module, various tools such as AI can be used to extract basic metadata information. The metadata module then converts this information into the specific target format of the low-code main module interface; other relevant information obtained during the processing can also be added.
[0082] The data provided by the metadata module is generally simple in structure. In the metadata module, data needs to be processed to suit the processing logic of low-code tools. For example, JSON format data can be converted into a Map, project-related information can be collected and processed, and table and field information can be converted into structured information to facilitate loop traversal processing by the template engine. The specific structure is as follows:
[0083]
[0084] Template Module
[0085] The Template Module manages and processes templates. Templates can be uploaded by users or pre-prepared by low-code tools. Uploaded templates can be of various types, including executable code or projects, template files processed by a specific template engine, or a combination of the two. The system records the template type and applies specific processing methods.
[0086] Template projects can have files that are output as is, or files that are used as templates. Template projects can identify files as templates based on specific folder or file name rules. You can also define a file list to record which files do and do not need to be processed by the template engine; this can speed up code generation.
[0087] Based on a working example, convert it into a template, and then generate similar functions based on the template using different metadata.
[0088] In a project, some files that differ not because of metadata do not need to be converted into templates.
[0089] In a project, some files that differ due to different metadata can be converted into templates. This way, the same type of files can be generated using the templates with different metadata.
[0090] Template tag description. Different template engines generally use different tags.
[0091] For example, in the FreeMarker template engine, variable markers are composed of characters starting with "${" and ending with "}", such as ${entity? cap_first}, which means using the value of the variable entity, converting the first letter to uppercase, and then replacing the marker.
[0092] There are also other ways, as follows (specifically implemented in org.teasoft.honey):
[0093] public Result list(#{entityName?upl}#{entityName})
[0094] Here, #{entityName? upl} means using the value of the variable entityName, converting the first letter to uppercase, and then replacing the mark. If the value of the variable entityName passed in is orders, the text will be:
[0095] public Result list(Orders orders)
[0096] In addition, you can also use specific naming characters as tags.
[0097] The following describes how to convert a runnable project into a template.
[0098] This project is a demo project that can run normally and is accessible. The project structure diagram under the Eclipse tool is as follows: Figure 4The corresponding source code is shown in the last section - Java source code.
[0099] It is a spring boot project. Run DemoApplication and access the specified address in the browser to get the following Figure 5 The result is shown. This access is a query operation, and the specific data varies depending on the records in the database table.
[0100] How to convert executable code into a template.
[0101] Taking OrdersService.java as an example, perform the following steps:
[0102] 1) Confirm the name of the entity (database table) to be used, here it is orders; this name can be entered by the user.
[0103] 2) Case sensitive, replace Orders with #{entityName? upl}
[0104] 3) Case-sensitive, replace orders with #{entityName}
[0105] 4) Replace the package name com.example.aaa_loop_aaa.aaa_auto_package_aaa with #{packageName}
[0106] In this way, you can get a template that can be recognized by org.teasoft.honey.osql.autogen.GenFiles. The code is as follows.
[0107]
[0108] Similarly, OrdersRest.java and OrdersServiceImpl.java can be generated using the same method. Orders.java is a Java bean and can use a generic template. Different files require different characteristics. For example, for DemoApplication.java, simply replace its package name. (If only SUID templates are needed, this type of conversion is not necessary.) A similar method can be used to create templates for other template engines, such as FreeMarker.
[0109] The front-end page can also convert the executable code into a template file according to the characteristics of the page. and Tags, replace them with the following template code that FreeMarker can recognize.
[0110]
[0111] For other types of pages, you can also refer to the backend and frontend pages mentioned above to generate templates. You can also provide multiple similar example codes and use AI intelligent analysis to allow AI tools (such as ChatGPT) to generate corresponding templates. The tags and variables used in the template can be told to the AI in advance so that it can generate a template that meets the requirements. Based on a working example, a template is converted, and then similar functions are generated based on the template using different metadata.
[0112] When the demo project code is modified, the executable project code is re-uploaded to the low-code tool, and the tool reprocesses it without manually modifying the template. In this way, editing the template is the same as the actual development. There is no need to add extra work to edit the template of a certain template engine, and you can easily use the IDE tool to adjust the code format and debug the code.
[0113] The tool needs to determine, based on characteristics, which templates are used to regenerate files and which are generated only once during a project code generation. For example, templates exported from files in the top-level package com.example are used only once, while templates in the com.example.aaa_loop_aaa package need to be generated multiple times, for example, once for the Orders table and again for the History table.
[0114] When generating a project, you can use the directory structure of the uploaded project.
[0115] Taking "com.example.aaa_loop_aaa.aaa_auto_package_aaa" as an example, "com.example." can be replaced with the base package name, and "aaa_loop_aaa." is used to determine whether it is a template to be recycled.
[0116] "aaa_auto_package_aaa" is replaced with the package name of the specific function module. Alternatively, you can use:
[0117] A package name containing ".aaa_loop_aaa." indicates a reusable template; a package name containing ".aaa_one_aaa." indicates a one-time use of the template. The use of aaa_ and _aaa before and after the prefixes is to prevent program misjudgment. Of course, it's also possible to omit these prefixes and suffixes, allowing the user to specify which part of the package name is used as the base, which part is replaced by the dynamic package name, and which package contains the reusable template.
[0118] In addition, here's a solution for code that can't be recognized and run due to using a template engine identifier. In the following Service interface, the update method is generated only when editing is required. When using the FreeMarker template engine, adding an if tag for judgment results in a problematic Java program, preventing it from running.
[0119]
[0120] If the relevant three lines of code are changed to:
[0121] / / [delete]<#if table.genEditPage? ? &&table.genEditPage>
[0122] public int update($_entity$$$entity);
[0123] / / [delete]< / #if>
[0124] The program will continue to run correctly. Comments and special markers are placed before the tags used in the template to ensure that the template code can run correctly. Before the template is passed to the specific template engine for processing, the comments and special markers are removed to meet the specific template engine's requirements. In this example, " / / [delete]" is added. Furthermore, this example uses a specific naming pattern as a marker, with a different number of special characters before and after each character to indicate the features that will be replaced with the markers used by the template engine.
[0125] Template files can also be generated through visual operations, particularly for page layouts. Drag and drop controls in the visual interface to generate page layout template files. When dragging controls in the visual interface, the values corresponding to each control are not specific text values, but rather special text names that the tool recognizes. These can be used as template files when generating pages.
[0126] Existing low-code platforms, many of which use visual forms to generate pages, can be seen as a re-edition of the web development tool Dreamweaver. By dragging components, pages are generated visually. Dreamweaver also has source code mode and split mode. In split mode, components and their corresponding code can be viewed simultaneously. Improvements could further encapsulate more abstract components, such as data list display components (which can include search functions, paging components, etc., or these functions can be made into separate components), table data editing components, and table data insertion components. This component corresponds to more code. If the component-specific code is changed to code that can be processed by a template engine, template files can be generated in this way. Therefore, front-end pages can be customized to generate personalized pages, or a general class of pages can be made into templates. Back-end code can also use this approach, such as defining a SUID Controller control class control. When the control is dragged to a specified location, the corresponding SUID code or SUID template is generated.
[0127] For complex functions that low-code devices cannot predict, you can add interface references to the business logic. The specific logic is left to the user to add separately, and by default, only an empty implementation of the interface is provided to ensure the program can run normally. Interface references can be pre-set in the template.
[0128] Low-code main module
[0129] In the low-code main module, code can be generated based on metadata, template projects, configuration information, and context information. Before generating code, some business logic needs to be processed. For example, relevant information is obtained from the configuration information and context information, and the metadata is reprocessed to obtain data that meets the business and specific template engine requirements. For options that affect project generation, it is necessary to judge and then use different processing logic. For example, when generating java-related projects, choosing jar or war, choosing Gradle or Maven, the processing logic will be very different. After preparing the data, select the template corresponding to the current code to be generated, pass the metadata to the template engine, and generate the code. For a single file, the relevant data needs to be sorted so that the template engine can determine which part of the file needs to be generated; for loop processing, the low-code main module needs to assemble data of related structures. If the entire project is generated, it involves: copying the project, directly copying files that do not require template processing, generating corresponding code files according to different templates, etc.
[0130] There is no need to change the original program when generating code in different languages; from a macro perspective, you can extract the changing files from a project and convert them into templates, and then use these templates to generate other similar files based on different metadata.
[0131] The preview and download module provides preview and download functions. You can preview the generated code and even preview the effect of running the generated code (such as Figure 6 (as shown) and try out the code generation feature in the tool. Preview the generated code, usually on the page where you can view the code in advance to determine whether it needs to be downloaded.
[0132] Download function: package and download one file, multiple files, or the entire project.
[0133] One of the better solutions is to convert a working example into a template, and then generate similar functions based on the template using different metadata.
[0134] Low-code tools can optimize traditional development processes. Save time writing demos (preliminary discussions can be repeated any number of times), save time developing general functions and CRUD functions, and save time testing and interface debugging of basic functions (the time savings are even more obvious in the front-end and back-end separation mode). When using directly runnable project code as a template, and the project is a tested and qualified program, other programs with similar functions generated using the template (only the metadata is different, or only the tables are different) are also qualified programs. Therefore, while saving the time spent on repeatedly developing code with highly similar functions, it can also save most of the time spent on steps such as testing and debugging.
[0135] The template contains code for testing, and test code can also be generated through low-code tools.
[0136] When using table-driven code generation, a simple default method is used. After creating a table, the table name is passed to the device, and the device automatically implements the SUID function, completing basic functions without the programmer having to write code. Directly generated project code can be used as a demo, eliminating the need to write demos that can only be viewed but not run. What you see is the software that can be run. The software generated the first time can be runnable and truly usable. By defining the code style of the template, code with a unified code style can be generated, making the code style and quality easier to control.
[0137] You can generate the code by following these steps:
[0138] Step 1: Enter the table name and other related information through the device's interface or screen. Step 2: Prepare the metadata module, which can query the database for the corresponding table's fields, types, and other information and convert the data into the specified format. Step 3: Use the default template or upload a template. Step 4: After processing, the device generates code. Step 5: Use the device's preview and download functions. Steps 2 and 4 are completed automatically by the device.
[0139] The above discussion of the embodiment has described the various possibilities of each step in a relatively comprehensive manner; however, in actual use, there may be a fully functional mode and a simplified mode. For example, in the simplified mode, only the table name is passed in, and the others are in the default mode, and the low-code device can automatically generate code for the user. The configuration information of the database can be written in the configuration file. The system can pre-set some configuration information, such as the generated language: java, generated war / jar: jar, etc. Users can enter relevant information according to their own situation or configure it in the configuration file so that the user's setting information overwrites the system's default settings under the current user.
[0140] Some features, depending on the situation, are optional.
[0141] The front-end interface is optional. If you don't need to generate a front-end page, you don't need to design its layout and style. If the metadata base information is not obtained from a database, such as from Java beans or form modeling, you can create a database table based on the situation.
[0142] Optionally, low-code tools can include functional modules that support integration with other systems and application deployment, providing a convenient deployment process. While this convenience comes at the cost of tying the application to a specific platform environment, it's best to consider this as an optional feature rather than a mandatory one for the versatility of low-code tools.
[0143] The issue of low-code tools generating codes for different computer languages is related to whether the tool is powerful and efficient. If each additional code generation support for a language requires the implementation of a low-code tool or the update of the tool code, the coding complexity of this problem is O(n); if the code generation support for n languages is the same as the low-code tool for generating one language (no need to change the low-code tool), then the coding complexity of this problem is O(l).
[0144] Because the language of the code generated by the device of the present invention is related to the template, uploading templates of different languages does not require program modification. Therefore, the coding complexity of the device for this problem is O(l). For example, there is the following template in Python:
[0145]
[0146] If the entityName variable passed in is user, the following Python code can be generated:
[0147]
[0148]
[0149] Although the embodiments of the present invention have been shown and described, they are not intended to limit the present invention. It will be apparent to those skilled in the art that various modifications and variations may be made to the present invention, including those implemented in different computer languages. Without departing from the principles and design of the present invention, various changes, modifications, substitutions, and variations of these embodiments should all be included within the scope of the claims of the present invention.
[0150] Java source code
[0151] The Java project source code used as an example in the embodiment is shown below.
[0152]
[0153]
[0154]
[0155]
Claims
1. A low-code design method, comprising a configuration information module and a context module, respectively used to store relevant configuration information of the device and the context information used, a preview and download module for previewing code and interface effects, and a file download function, characterized in that: include: Prepare metadata modules to exchange data with each other through interfaces; Prepare metadata modules to support data from different sources and in different forms, and convert data into the data format required by the metadata module interface; The metadata module receives and processes the data sent by the metadata preparation module, and obtains the metadata in the target format after conversion; The template module receives templates, sample files, sample projects, and files obtained after visualization operations uploaded by users, and then processes them to obtain templates that meet the requirements; the template module can have system default templates; The low-code main module uses metadata, templates, configuration information, and context information to perform business logic processing and template engine processing; And generate the final code; Runnable code that can be used as a template; Supports single template files and template project files for the entire project; It can generate both a single file and the entire project file; Based on templates of different languages, codes of different languages can be generated; when generating codes of different languages, there is no need to change the original program. When language is used as the research object, the coding complexity is 0(1).
2. The method according to claim 1, characterized in that The code that can run the template can be converted and then used by the specific template engine.
3. The method according to claim 1, characterized in that Use comments and special tags before the tags used in the template to ensure that the template code can still run correctly; before the template is passed to the specific template engine for processing, delete the comments and special tags to make the template meet the requirements of the specific template engine.
4. The method according to claim 1, characterized in that The directory structure of the generated project is determined by the directory structure of the uploaded template project.
5. A low-code device comprising: The configuration information module and the context module are used to store the relevant configuration information of the device and the context information used, respectively. The preview and download module is used to preview the code and interface effects, as well as download files. It is characterized by including: Prepare metadata modules to support data from different sources and convert data into the data format required by the metadata module interface; prepare metadata modules to interact with each other through the interface; The metadata module receives and processes the data sent by the metadata preparation module, and obtains the metadata in the target format after conversion; The template module receives templates, sample files, sample projects, and files obtained after visualization operations uploaded by users, and then processes them to obtain templates that meet the requirements; the template module can have system default templates; The low-code main module uses metadata, templates, configuration information, and context information to perform business logic processing and template engine processing, and generates the final code; Runnable code can be used as a template; it supports single template files as well as template project files for the entire project; It can generate both single files and entire project files; Based on templates of different languages, codes of different languages can be generated; when generating codes of different languages, there is no need to change the original program. When language is used as the research object, the coding complexity is 0(1).
6. The device according to claim 5, characterized in that Generate the code by following these steps: Step 1: Input table name and other related information through the interface or screen provided by the device; Step 2: Prepare metadata module to query the field information of the corresponding table in the database and convert the data into the specified format; Step 3: Use the default template or upload a template; Step 4: After the device is processed, a code is generated; Step 5: Use the preview and download functions provided by the device; Steps 2 and 4 are completed automatically by the device.
7. The device according to claim 5, characterized in that Use comments and special tags before the tags used in the template to ensure that the template code can still run correctly; before the template is passed to the specific template engine for processing, delete the comments and special tags to meet the requirements of the specific template engine.
8. The device according to claim 5, characterized in that The directory structure of the generated project is determined by the directory structure of the uploaded template project.