Scaffold-based code template generation method and device, server and medium
By dynamically loading template resources of local and remote code platforms on the scaffolding server, the problem of low software application R&D efficiency in the existing technology is solved, the richness and efficient loading of component code templates are achieved, and the R&D efficiency is improved.
Patent Information
- Application Number
- CN202510844883.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-23
- Publication Date
- 2025-09-19
AI Technical Summary
In the prior art, scaffolding template file resources are limited, resulting in low software application development efficiency and inability to achieve dynamic loading of component templates.
By obtaining the current project generation request and basic configuration metadata of the target task project on the scaffolding server, and using preset object encapsulation rules and template matching rules, the template resources of the local and remote code platforms are dynamically loaded to generate rich component code templates.
It realizes the dynamic loading of software code templates, improves the R&D efficiency of software applications, provides richer component code templates, and improves development efficiency.
Smart Images

Figure CN120669966A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a scaffolding-based code template generation method, device, server, and medium. Background Art
[0002] With the gradual development of artificial intelligence technology, the development and iteration speed of software applications is getting faster and faster. Therefore, how to improve the efficiency and quality of application development has become extremely important.
[0003] In the prior art, application development is usually carried out using a scaffolding approach. Specifically, application development is achieved by reusing code through application engineering templates and component code templates integrated in the scaffolding.
[0004] However, due to the limited template file resources in scaffolding, dynamic loading of component templates cannot be achieved if only scaffolding is used for application development, resulting in low application development efficiency. Therefore, how to achieve dynamic loading of software code templates and improve development efficiency is currently an urgent problem to be solved. Summary of the Invention
[0005] The present invention provides a scaffolding-based code template generation method, device, server and medium, which can solve the problem of low R&D efficiency of software applications in the prior art.
[0006] According to one aspect of the present invention, a method for generating a code template based on a scaffold is provided. The method is executed by a scaffold server and includes:
[0007] Get the current project generation request and basic configuration metadata corresponding to the target task project;
[0008] Encapsulating the current project generation request and basic configuration metadata based on a preset object encapsulation rule to obtain a context object corresponding to the target task project, and summarizing and processing the context object and the current project generation request to obtain a project description object corresponding to the target task project;
[0009] Based on the project description object and the preset template matching rules, the basic engineering template and component template set corresponding to the target task project are determined, and the basic engineering template and component template set are aggregated and processed to obtain the target project extension template corresponding to the target task project; wherein the preset template matching rules include local template matching rules and code platform template matching rules.
[0010] According to another aspect of the present invention, a scaffold-based code template generation device is provided, which is executed by a scaffold server and includes:
[0011] The data acquisition module is used to obtain the current project generation request and basic configuration metadata corresponding to the target task project;
[0012] An object aggregation module is used to encapsulate the current project generation request and basic configuration metadata based on preset object encapsulation rules to obtain a context object corresponding to the target task project, and to aggregate the context object and the current project generation request to obtain a project description object corresponding to the target task project;
[0013] A template generation module is used to determine the basic engineering template and component template set corresponding to the target task project based on the project description object and the preset template matching rules, and to summarize and process the basic engineering template and component template set to obtain the target project extension template corresponding to the target task project; wherein the preset template matching rules include local template matching rules and code platform template matching rules.
[0014] According to another aspect of the present invention, a scaffolding server is provided, comprising:
[0015] at least one processor; and
[0016] a memory communicatively connected to the at least one processor; wherein,
[0017] 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 scaffolding-based code template generation method described in any embodiment of the present invention.
[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the scaffolding-based code template generation method described in any embodiment of the present invention when executed.
[0019] According to another aspect of the present invention, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the method for generating a code template based on a scaffolding according to any embodiment of the present invention is implemented.
[0020] The technical solution of the embodiment of the present invention encapsulates the current project generation request and basic configuration metadata corresponding to the target task project through preset object encapsulation rules to obtain the context object corresponding to the target task project, and summarizes and processes the context object and the current project generation request to obtain the project description object corresponding to the target task project. Furthermore, based on the project description object and the preset template matching rules including the local template matching rules and the code platform template matching rules, the basic engineering template and the component template set corresponding to the target task project are determined, and the basic engineering template and the component template set are summarized and processed to obtain the target project extension template corresponding to the target task project. Since it is connected with the reusable code platform on the basis of the local template stored on the scaffolding server, the problem of low R&D efficiency of software applications in the prior art is solved, dynamic loading of software code templates can be realized, richer component code templates are provided, and R&D efficiency is improved.
[0021] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 This is a flowchart of a scaffolding-based code template generation method provided in accordance with the first embodiment of the present invention;
[0024] Figure 2 This is a flowchart of a scaffolding-based code template generation method provided in accordance with a second embodiment of the present invention;
[0025] Figure 3 Schematic diagram of a scaffolding-based code template generation process provided according to the second embodiment of the present invention;
[0026] Figure 4 is a flowchart of an optional scaffolding-based code template generation method provided according to embodiment 2 of the present invention;
[0027] Figure 5 1 is a schematic structural diagram of a scaffolding-based code template generation device provided according to a third embodiment of the present invention;
[0028] Figure 6It is a structural diagram of a scaffolding server for implementing the scaffolding-based code template generation method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first", "second", "objective", "foundation", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] It is worth noting that in the technical solution of this application, the information collected is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data comply with the relevant laws, regulations and standards of relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse; if the user chooses to refuse, the expert decision-making process will be entered.
[0032] Example 1
[0033] Figure 1 This is a flowchart of a scaffolding-based code template generation method provided in the first embodiment of the present invention. This embodiment is applicable to the case of dynamically loading code templates for software application projects. The method can be executed by a scaffolding-based code template generation device. The scaffolding-based code template generation device can be implemented in the form of hardware and / or software. The scaffolding-based code template generation device can be configured in a scaffolding server. Figure 1 As shown, the method includes:
[0034] S110: Obtain the current project generation request and basic configuration meta-information corresponding to the target task project.
[0035] A task project may refer to a software application development project. A target task project may refer to a task project that needs to be implemented. Typically, the target task project can be determined based on actual application requirements. Basic configuration metadata may refer to a core data set used to define and manage project generation rules. Typically, basic configuration metadata is structured data predefined and stored by the scaffolding server. For example, basic configuration metadata may include the default behavior, constraints, and configurable items of a project template.
[0036] The current project generation request may refer to a code engineering generation request initiated to complete a target task project. Typically, a user may initiate the current project generation request in a client. Optionally, the current project generation request may include: a target architecture type, a target component identifier set, and a target parameter set corresponding to the target task project. The architecture type may refer to the high-level organizational structure design pattern of the project code. For example, the architecture type may define the project's core layering, modularization, and interaction logic. Generally, selecting a different architecture type directly impacts the code structure, technology stack, and best practices of the generated scaffolding. The target architecture type may refer to the architecture type that matches the target task project selected by the user. The component identifier may refer to a string identifier used to uniquely identify a reusable functional module. The target component identifier may refer to the component identifier required by the target task project selected by the user. The target component identifier set may refer to the set of target component identifiers corresponding to the target task project. The target parameters may refer to the configuration parameters required by the target task project selected by the user. For example, the target parameters may include the language type, project name identifier, initial project version number, and packaging method. The target parameter set may refer to the set of target parameters corresponding to the target task project.
[0037] S120. Encapsulate the current project generation request and basic configuration metadata based on preset object encapsulation rules to obtain a context object corresponding to the target task project, and aggregate the context object and the current project generation request to obtain a project description object corresponding to the target task project.
[0038] Among them, the preset object encapsulation rules may refer to pre-set rules for limiting the generation process of context objects. Exemplarily, the preset object encapsulation rules may include operation objects and specific operation processes, etc. The context object may refer to a data structure used to store temporary states, user inputs, and intermediate calculation results in a single project generation process. Generally, the context object may include a target architecture type and a target parameter set corresponding to the target task project. The project description object may refer to a data structure used to describe the standardized structure of the project. Generally, the project description object may also include a component list corresponding to a target component identifier set in the target task project.
[0039] S130. Determine the basic engineering template and component template set corresponding to the target task project based on the project description object and the preset template matching rules, and summarize and process the basic engineering template and component template set to obtain the target project extension template corresponding to the target task project; wherein the preset template matching rules include local template matching rules and code platform template matching rules.
[0040] Among them, the preset template matching rules may refer to pre-set rules for limiting the template matching process. Exemplarily, the preset template matching rules may include local template matching rules and code platform template matching rules. Local template matching rules may refer to pre-set rules for limiting the template matching process stored locally on the scaffolding server. Exemplarily, the local template matching rules may be: if the template in the project description object is a locally stored template, the template can be directly obtained from the local storage. The code platform template matching rules may refer to pre-set rules for limiting the remote code template matching process stored on the code platform. Exemplarily, the code platform template matching rules may be: if the template in the project description object is a template stored on the code platform, a template loading request may be sent to the code platform to accept the code template fed back by the code platform.
[0041] Among them, the project template may refer to a predefined structure used to quickly generate a complete project skeleton. Exemplarily, the project template may include the overall directory layout, basic configuration, common dependencies and standardized files of the project. The basic project template may refer to the project template corresponding to the target task project. The component template may refer to a code snippet or file used to generate a specific functional module. Usually, a component template focuses on a single function. For example, database access or user authentication. The component template set may refer to a set of all component templates corresponding to the target task project. The target project extension template may refer to the final displayed project template obtained by summarizing the basic project template and the component template set.
[0042] In an optional embodiment, after the basic engineering template and component template set are aggregated to obtain the target project extension template corresponding to the target task project, the method may further include: compressing the target project extension template to obtain a project code compression package corresponding to the target task project, and sending the project code compression package to the target client. The compression process may refer to the process of reducing the file size of the target project extension template according to a pre-set packaging method. The project code compression package may refer to the compressed package obtained after the target project extension template is compressed. The client may refer to an integrated tool installed on the developer's local computer that provides code writing, debugging, compilation and project management. Typically, the client may be an application of an integrated development environment. The target client may refer to the client that initiates the current project generation request.
[0043] Specifically, after obtaining the target project extension template corresponding to the target task project, the target project extension template can be compressed to obtain the corresponding project code compression package, and the project code compression package can be returned to the target client, so that the developer can be guided by the application wizard in the target client to select the decision engineering template and component template, thereby ensuring the quality of R&D. It is worth noting that in the embodiment of the present invention, in order to reduce the storage burden, the local target project extension template can be deleted after the project code compression package is generated, and the embodiment of the present invention does not specifically limit this.
[0044] The technical solution of the embodiment of the present invention encapsulates the current project generation request and basic configuration metadata corresponding to the target task project through preset object encapsulation rules to obtain the context object corresponding to the target task project, and summarizes and processes the context object and the current project generation request to obtain the project description object corresponding to the target task project. Furthermore, based on the project description object and the preset template matching rules including the local template matching rules and the code platform template matching rules, the basic engineering template and the component template set corresponding to the target task project are determined, and the basic engineering template and the component template set are summarized and processed to obtain the target project extension template corresponding to the target task project. Since it is connected with the reusable code platform on the basis of the local template stored on the scaffolding server, the problem of low R&D efficiency of software applications in the prior art is solved, dynamic loading of software code templates can be realized, richer component code templates are provided, and R&D efficiency is improved.
[0045] Example 2
[0046] Figure 2The flowchart of a scaffolding-based code template generation method provided in the second embodiment of the present invention is a refinement of the above-mentioned embodiment. In this embodiment, the operation of encapsulating the current project generation request and basic configuration metadata based on the preset object encapsulation rules to obtain the context object corresponding to the target task project is specifically refined. Specifically, it may include: performing field loading processing on the basic configuration metadata based on the preset field configuration rules to determine the configuration field set corresponding to the basic configuration metadata; parsing the current project generation request based on the preset parsing rules to obtain the metadata information set corresponding to the target task project; merging the target configuration fields in the configuration field set based on the target metadata information in the metadata information set to obtain the context object corresponding to the target task project. Figure 2 As shown, the method includes:
[0047] S210: Obtain the current project generation request and basic configuration meta-information corresponding to the target task project.
[0048] S220: Perform field loading processing on the basic configuration meta-information based on preset field configuration rules to determine a configuration field set corresponding to the basic configuration meta-information.
[0049] The term "preset field configuration rule" may refer to a pre-defined rule for locating default parameters in the basic configuration metadata. A configuration field may refer to a field with a default value included in the basic configuration metadata. A configuration field set may refer to a set of configuration fields included in the same basic configuration metadata.
[0050] S230: Parse the current project generation request based on preset parsing rules to obtain a metadata information set corresponding to the target task project.
[0051] Among them, the preset parsing rules may refer to pre-set rules for parsing the current project generation request. Exemplarily, the preset parsing rules may be pre-edited parsing codes. Generally, the current project generation request can be converted into structured data through the preset parsing rules. Metadata information may refer to information related to template rules and constraints in the current project generation request. Exemplarily, the metadata information may include the target architecture type and target parameter set corresponding to the target task project. The metadata information set may refer to a set consisting of various metadata information in the same current project generation request.
[0052] S240: Merge the target configuration fields in the configuration field set based on the target metadata information in the metadata information set to obtain a context object corresponding to the target task item.
[0053] The target metadata information may refer to the metadata information selected for information merging in the metadata information set. Exemplarily, the target metadata information may be any metadata information in the metadata information set. The target configuration field may refer to a configuration field in the configuration field set that corresponds to the location of the target metadata information. Exemplarily, the target configuration field may be a configuration field in the configuration field set that has the same meaning as the target metadata information field.
[0054] Specifically, after obtaining the current project generation request and basic configuration meta-information corresponding to the target task project, the basic configuration meta-information can be subjected to field loading processing according to the preset field configuration rules to determine the configuration field set corresponding to the basic configuration meta-information. At the same time, the current project generation request is parsed using the preset parsing rules to obtain the metadata information set corresponding to the target task project. Afterwards, the target configuration field that matches the target metadata information in the metadata information set is determined in the configuration field set, and the target configuration field in the basic configuration meta-information is overwritten or extended using the target metadata information. Finally, the overwritten or extended basic configuration meta-information is retained as the context object corresponding to the target task project. Thus, by overwriting or extending the basic configuration meta-information with the default value using the metadata information in the current project generation request, a context object that matches the current project generation request can be generated, providing an effective basis for subsequent operations.
[0055] S250: Parse the current project generation request based on preset parsing rules to obtain a class object set corresponding to the target task project.
[0056] A class object may refer to a specific entity generated by instantiating a component. For example, a class object may be any target component instance in a target component identifier set. A class object set may refer to a set of class objects corresponding to the same target component identifier set. For example, a class object set may be a list of components corresponding to the target component identifier set.
[0057] S260: Assemble and process the class object set and the context object to obtain a project description object corresponding to the target task project.
[0058] Specifically, after generating a context object corresponding to the target task project, the class object collection contained in the current project generation request can be dynamically populated into the context object to obtain the project description object corresponding to the target task project. Thus, by adding the component objects in the current project generation request to the context object, dynamic object requirements matching the current project generation request can be generated, providing an effective foundation for subsequent operations.
[0059] S270: Match the project description object in the local template library based on the local template matching rule to obtain a basic engineering template and a first component template corresponding to the target task project.
[0060] The local template library may refer to a database in the scaffolding server for locally storing code templates. The first component template may refer to a local component code template in the local template library that matches the target task project.
[0061] S280: Matching the project description object in the reusable code platform based on the code platform template matching rule to obtain a second component template corresponding to the target task project.
[0062] The reusable code platform may refer to a platform that provides full-process support services, including registration, retrieval, and usage, for code reuse and shared development during application development. Typically, the reusable code platform enables centralized management and operation of remote reusable code information. The second component template may refer to a remote component code template within the reusable code platform that matches the target task project.
[0063] S290: Combine and process the first component template and the second component template as a component template set corresponding to the target task project.
[0064] Specifically, after generating a project description object corresponding to the target task project, the architecture type in the project description object can be used to load the corresponding scaffolding server-side architecture submodule template into the local template library as the basic engineering template corresponding to the target task project. Different basic engineering templates can typically contain different submodule sets. Subsequently, the component list in the project description object is traversed to determine the data source of the target component code template corresponding to each target component in the component list. If the data source of the target component code template is the local template library, the target component code template can be directly matched in the local template library, and the matched target component code template is used as the first component template. If the data source of the target component code template is a reusable code platform, a protocol request, such as the Hypertext Transfer Protocol, can be created based on information such as the target component identifier of the target component in the component list, and the protocol request is sent to the reusable code platform to obtain the target component code template as the second component template corresponding to the target task project. Finally, the first component template and the second component template are combined to form the component template set corresponding to the target task project. Thus, by docking with the reusable code platform and building dynamic component template loading capabilities, a richer set of component code templates can be obtained, greatly improving R&D efficiency.
[0065] S2100: Fill the target component template in the component template set into the basic project template to obtain the basic project extension template corresponding to the target task project.
[0066] The target component template may refer to a component code template selected from a component template collection for template filling. For example, the target component template may be any component code template from the component template collection. The base project extension template may refer to a project extension template initially generated by filling a base project template with a target component template from the component template collection.
[0067] S2110: Render and process the basic project extension template to obtain a target project extension template corresponding to the target task project.
[0068] The rendering process may refer to an operation of visually displaying the basic project extension template. For example, the rendering process may be an operation of adjusting template rendering variables in the basic project extension template.
[0069] Specifically, after obtaining the component template set and the base project template corresponding to the target task project, the target component templates in the component template set can be sequentially added to the base project template to obtain the base project extension template corresponding to the target task project. The base project extension template is then rendered to obtain the target project extension template corresponding to the target task project. Thus, by adding the component templates to the project template and executing Generate File, a rendered code file can be generated for user convenience.
[0070] The technical solution of the embodiment of the present invention performs field loading processing on the basic configuration metadata corresponding to the target task project through preset field configuration rules, determines the configuration field set corresponding to the basic configuration metadata, and parses the current project generation request based on the preset parsing rules to obtain the metadata information set corresponding to the target task project, and merges the target configuration fields in the configuration field set based on the target metadata information in the metadata information set to obtain the context object corresponding to the target task project. Further, the current project generation request is parsed based on the preset parsing rules to obtain the class object set corresponding to the target task project, and the class object set and the context object are assembled to obtain the project description object corresponding to the target task project. Furthermore, the project description object is matched in the local template library based on the local template matching rules to obtain the basic engineering template and the first component template corresponding to the target task project. The project description object is matched in the reusable code platform based on the code platform template matching rules to obtain the second component template corresponding to the target task project, and the first component template and the second component template are combined to form the component template set corresponding to the target task project. Finally, the target component template in the component template set is filled into the basic engineering template to obtain the basic project extension template corresponding to the target task project. The base project extension template is then rendered and processed to obtain the target project extension template corresponding to the target task project. By integrating with the reusable code platform based on the local templates stored on the scaffolding server, this solves the low R&D efficiency problem of software applications in existing technologies, enabling dynamic loading of software code templates, providing a richer set of component code templates, and improving R&D efficiency.
[0071] Figure 3Shown is a schematic diagram of a code template generation process based on scaffolding provided by an embodiment of the present invention. Specifically, first, the developer completes the engineering architecture selection and ticking components corresponding to the target task project through the application wizard on the integrated development environment client (equivalent to the target client). Then, the integrated development environment client initiates a code engineering generation request to the scaffolding server, i.e., the current project generation request. Afterwards, the scaffolding server determines the basic engineering template and local component code template corresponding to the target task project in the local template library based on the current project generation request and basic configuration meta-information, i.e., the first component template, and determines the remote component code template corresponding to the target task project in the reusable code platform, i.e., the second component template. Further, the local component code template and the remote component code template are filled into the basic engineering template by the scaffolding server, and the basic project extension template corresponding to the target task project is obtained, the template generation code is completed, and the basic project extension template is rendered and processed by the code generator in the scaffolding server to obtain the target project extension template corresponding to the target task project. Finally, the target project extension template is compressed to obtain the project code compression package corresponding to the target task project, and the project code compression package is sent to the integrated development environment client. It is worth noting that in an embodiment of the present invention, the scaffolding server metadata configures the three-coordinate information of the reusable asset component, and at the same time cooperates with the front-end interface transformation of the integrated development environment client, thereby providing a selection of reusable asset components in the integrated development environment client.
[0072] Figure 4The flowchart of an optional scaffolding-based code template generation method provided by an embodiment of the present invention is shown. Specifically, first, the current project generation request and basic configuration metadata corresponding to the target task project are obtained. Afterwards, field loading processing is performed on the basic configuration metadata based on preset field configuration rules to determine the configuration field set corresponding to the basic configuration metadata. The current project generation request is parsed based on preset parsing rules to obtain a metadata information set corresponding to the target task project. The target configuration fields in the configuration field set are merged based on the target metadata information in the metadata information set to obtain a context object corresponding to the target task project. Furthermore, the current project generation request is parsed based on preset parsing rules to obtain a class object set corresponding to the target task project. The class object set and context object are assembled to obtain a project description object corresponding to the target task project. Further, according to the architecture type in the project description object, the corresponding scaffolding server architecture submodule template is loaded into the local template library as the basic engineering template corresponding to the target task project to generate engineering code. The component list in the project description object is traversed to determine the data source corresponding to each target component in the component list. If the data source of the target component is a local template library, the target component code template corresponding to the target component can be directly matched in the local template library, and the matched target component code template can be used as the first component template. If the data source of the target component is a reusable code platform, a protocol request, such as the Hypertext Transfer Protocol, can be created based on information such as the target component identifier of the target component in the component list, and the protocol request can be sent to the reusable code platform to obtain the target component code template corresponding to the target component as the second component template corresponding to the target task project. Further, the first component template and the second component template are combined and processed as a component template set corresponding to the target task project, and the target component templates in the component template set are sequentially filled into the project code to obtain the basic project extension template corresponding to the target task project. Finally, the basic project extension template is rendered and processed to obtain the target project extension template corresponding to the target task project. The target project extension template is then compressed and processed to obtain a project code compression package corresponding to the target task project, and the project code compression package is sent to the target client. Thus, by extending and transforming the scaffolding service, docking with the reusable asset platform can be achieved, and the corresponding component template code can be dynamically loaded.
[0073] Example 3
[0074] Figure 5 This is a schematic diagram of a scaffold-based code template generation device provided in the third embodiment of the present invention. Figure 5 As shown, the device includes: a data acquisition module 310, an object aggregation module 320 and a template generation module 330;
[0075] The data acquisition module 310 is used to obtain the current project generation request and basic configuration metadata corresponding to the target task project;
[0076] An object aggregation module 320 is configured to encapsulate the current project generation request and basic configuration metadata based on a preset object encapsulation rule to obtain a context object corresponding to the target task project, and aggregate the context object and the current project generation request to obtain a project description object corresponding to the target task project;
[0077] The template generation module 330 is used to determine the basic engineering template and component template set corresponding to the target task project based on the project description object and the preset template matching rules, and summarize and process the basic engineering template and component template set to obtain the target project extension template corresponding to the target task project; wherein the preset template matching rules include local template matching rules and code platform template matching rules.
[0078] The technical solution of the embodiment of the present invention encapsulates the current project generation request and basic configuration metadata corresponding to the target task project through preset object encapsulation rules to obtain the context object corresponding to the target task project, and summarizes and processes the context object and the current project generation request to obtain the project description object corresponding to the target task project. Furthermore, based on the project description object and the preset template matching rules including the local template matching rules and the code platform template matching rules, the basic engineering template and the component template set corresponding to the target task project are determined, and the basic engineering template and the component template set are summarized and processed to obtain the target project extension template corresponding to the target task project. Since it is connected with the reusable code platform on the basis of the local template stored on the scaffolding server, the problem of low R&D efficiency of software applications in the prior art is solved, dynamic loading of software code templates can be realized, richer component code templates are provided, and R&D efficiency is improved.
[0079] Optionally, the current project generation request includes: a target architecture type, a target component identifier set, and a target parameter set corresponding to the target task project.
[0080] Optionally, the object aggregation module 320 may be used to:
[0081] Performing field loading processing on the basic configuration meta-information based on preset field configuration rules to determine a configuration field set corresponding to the basic configuration meta-information;
[0082] Parsing the current project generation request based on preset parsing rules to obtain a metadata information set corresponding to the target task project;
[0083] The target configuration fields in the configuration field set are merged based on the target metadata information in the metadata information set to obtain a context object corresponding to the target task item.
[0084] Optionally, the object aggregation module 320 may be used to:
[0085] Parsing the current project generation request based on preset parsing rules to obtain a class object set corresponding to the target task project;
[0086] Assemble and process the class object set and the context object to obtain a project description object corresponding to the target task project.
[0087] Optionally, the template generation module 330 may be used to:
[0088] Matching the project description object in the local template library based on the local template matching rule to obtain the basic engineering template and the first component template corresponding to the target task project;
[0089] Matching the project description object in the reusable code platform based on the code platform template matching rule to obtain a second component template corresponding to the target task project;
[0090] The first component template and the second component template are combined and processed as a component template set corresponding to the target task project.
[0091] Optionally, the template generation module 330 may be used to:
[0092] Filling the target component template in the component template set into the basic project template to obtain the basic project extension template corresponding to the target task project;
[0093] The basic project extension template is rendered and processed to obtain a target project extension template corresponding to the target task project.
[0094] Optionally, the scaffolding-based code template generation device may also include: a project compression module, which is used to compress and process the target project extension template after the basic engineering template and component template set are aggregated to obtain the target project extension template corresponding to the target task project, to obtain a project code compression package corresponding to the target task project, and send the project code compression package to the target client.
[0095] The scaffolding-based code template generation device provided in the embodiment of the present invention can execute the scaffolding-based code template generation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0096] Example 4
[0097] Figure 6 The structure diagram of the scaffolding server 410 that can be used to implement an embodiment of the present invention is shown. The components, their connections and relationships, and their functions shown herein are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0098] like Figure 6 As shown, the scaffolding server 410 includes at least one processor 420 and a memory, such as a read-only memory (ROM) 430, a random access memory (RAM) 440, etc., which is communicatively connected to the at least one processor 420. The memory stores a computer program that can be executed by the at least one processor. The processor 420 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 430 or the computer program loaded from the storage unit 490 to the random access memory (RAM) 440. Various programs and data required for the operation of the scaffolding server 410 can also be stored in the RAM 440. The processor 420, ROM 430, and RAM 440 are connected to each other via a bus 450. An input / output (I / O) interface 460 is also connected to the bus 450.
[0099] Multiple components in the scaffolding server 410 are connected to the I / O interface 460, including: an input unit 470, such as a keyboard and mouse; an output unit 480, such as various types of displays and speakers; a storage unit 490, such as a magnetic disk and optical disk; and a communication unit 4100, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 4100 allows the scaffolding server 410 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0100] The processor 420 can be a variety of general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the processor 420 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 420 executes the various methods and processes described above, such as the scaffolding-based code template generation method.
[0101] The method includes:
[0102] Get the current project generation request and basic configuration metadata corresponding to the target task project;
[0103] Encapsulating the current project generation request and basic configuration metadata based on a preset object encapsulation rule to obtain a context object corresponding to the target task project, and summarizing and processing the context object and the current project generation request to obtain a project description object corresponding to the target task project;
[0104] Based on the project description object and the preset template matching rules, the basic engineering template and component template set corresponding to the target task project are determined, and the basic engineering template and component template set are aggregated and processed to obtain the target project extension template corresponding to the target task project; wherein the preset template matching rules include local template matching rules and code platform template matching rules.
[0105] In some embodiments, the scaffolding-based code template generation method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 490. In some embodiments, part or all of the computer program can be loaded and / or installed on the scaffolding server 410 via the ROM 430 and / or the communication unit 4100. When the computer program is loaded into the RAM 440 and executed by the processor 420, one or more steps of the scaffolding-based code template generation method described above can be performed. Alternatively, in other embodiments, the processor 420 can be configured to execute the scaffolding-based code template generation method by any other appropriate means (e.g., by means of firmware).
[0106] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0107] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0108] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0109] To provide interaction with a user, the systems and techniques described herein can be implemented on a scaffolding server having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the scaffolding server. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0110] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0111] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.
[0112] The present application also discloses a computer program product, comprising a computer program that, when executed by a processor, implements the scaffolding-based code template generation method provided in any of the embodiments of the present application. This program product and the scaffolding-based code template generation method disclosed in each embodiment of the present application are based on the same inventive concept and are therefore not described in detail here.
[0113] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.
[0114] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A code template generation method based on scaffolding, characterized in that: The method is executed by a scaffolding server, and includes: Get the current project generation request and basic configuration metadata corresponding to the target task project; Encapsulating the current project generation request and basic configuration metadata based on a preset object encapsulation rule to obtain a context object corresponding to the target task project, and summarizing and processing the context object and the current project generation request to obtain a project description object corresponding to the target task project; Based on the project description object and the preset template matching rules, the basic engineering template and component template set corresponding to the target task project are determined, and the basic engineering template and component template set are aggregated and processed to obtain the target project extension template corresponding to the target task project; wherein the preset template matching rules include local template matching rules and code platform template matching rules.
2. The method according to claim 1, characterized in that The current project generation request includes: a target architecture type, a target component identifier set, and a target parameter set corresponding to the target task project.
3. The method according to claim 1, characterized in that The encapsulation process of the current project generation request and basic configuration metadata based on the preset object encapsulation rule to obtain the context object corresponding to the target task project includes: Performing field loading processing on the basic configuration meta-information based on preset field configuration rules to determine a configuration field set corresponding to the basic configuration meta-information; Parsing the current project generation request based on preset parsing rules to obtain a metadata information set corresponding to the target task project; The target configuration fields in the configuration field set are merged based on the target metadata information in the metadata information set to obtain a context object corresponding to the target task item.
4. The method according to claim 1, wherein The aggregation and processing of the context object and the current project generation request to obtain a project description object corresponding to the target task project includes: Parsing the current project generation request based on preset parsing rules to obtain a class object set corresponding to the target task project; Assemble and process the class object set and the context object to obtain a project description object corresponding to the target task project.
5. The method according to claim 1, wherein The determining of the basic engineering template and component template set corresponding to the target task project based on the project description object and the preset template matching rule includes: Matching the project description object in the local template library based on the local template matching rule to obtain the basic engineering template and the first component template corresponding to the target task project; Matching the project description object in the reusable code platform based on the code platform template matching rule to obtain a second component template corresponding to the target task project; The first component template and the second component template are combined and processed as a component template set corresponding to the target task project.
6. The method according to claim 1, characterized in that The aggregating and processing the basic engineering template and the component template set to obtain the target project extension template corresponding to the target task project includes: Filling the target component template in the component template set into the basic project template to obtain the basic project extension template corresponding to the target task project; The basic project extension template is rendered and processed to obtain a target project extension template corresponding to the target task project.
7. The method according to claim 1, characterized in that After the basic engineering template and the component template set are aggregated and processed to obtain the target project extension template corresponding to the target task project, the method further includes: The target project extension template is compressed to obtain a project code compression package corresponding to the target task project, and the project code compression package is sent to the target client.
8. A code template generation device based on scaffolding, characterized in that: The device is executed by a scaffolding server, and includes: The data acquisition module is used to obtain the current project generation request and basic configuration metadata corresponding to the target task project; An object aggregation module is used to encapsulate the current project generation request and basic configuration metadata based on preset object encapsulation rules to obtain a context object corresponding to the target task project, and to aggregate the context object and the current project generation request to obtain a project description object corresponding to the target task project; A template generation module is used to determine the basic engineering template and component template set corresponding to the target task project based on the project description object and the preset template matching rules, and to summarize and process the basic engineering template and component template set to obtain the target project extension template corresponding to the target task project; wherein the preset template matching rules include local template matching rules and code platform template matching rules.
9. A scaffolding server, characterized in that: The scaffolding server includes: 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 to enable the at least one processor to execute the scaffolding-based code template generation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the scaffolding-based code template generation method according to any one of claims 1 to 7 when executed.
11. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the scaffolding-based code template generation method according to any one of claims 1 to 7.