Project code framework generation method and device and electronic equipment

By automatically identifying project types and components, and generating project code frameworks, the problem of low efficiency and accuracy in traditional build processes is solved, achieving efficient and accurate project code framework generation.

CN121523673APending Publication Date: 2026-02-13INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511674866.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-14
Publication Date
2026-02-13

AI Technical Summary

Technical Problem

Traditional project code framework construction relies on human labor, which is time-consuming and prone to errors, resulting in low efficiency and accuracy.

Method used

By receiving user instructions, parsing project information, automatically identifying project types and components, generating an initial code framework template, and generating the project code framework based on the populated parameters and component templates.

Benefits of technology

It enables automated generation of project code frameworks, improving build efficiency and accuracy while reducing human error.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121523673A_ABST
    Figure CN121523673A_ABST
Patent Text Reader

Abstract

The invention discloses a project code framework generation method and device and electronic equipment. The method relates to the field of computers, and comprises the following steps: receiving a project code framework generation instruction sent by a user side, and analyzing the project code framework generation instruction to obtain a target project and component information, the component information being used for indicating a function module added in the target project; identifying a project type of the target project, determining an initial code framework template according to the project type and the component information, and determining a component template according to the component information; and obtaining filling parameters, and generating a project code framework of the target project according to the filling parameters, the initial code framework template and the component template. Through the method and the device, the problem of low efficiency and accuracy of project code framework construction in related technologies is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and more specifically, to a method, apparatus, and electronic device for generating a project code framework. Background Technology

[0002] As financial institutions continuously upgrade their systems, the software they need to use is also constantly being updated. In software development projects, the first step is to build a project code framework, and then further development of the project is carried out based on the project code framework. Therefore, the efficiency of building a project code framework directly affects the speed of business innovation and the stability of the system.

[0003] However, traditional project building methods often rely too heavily on human labor. During the process of building the project code framework, developers need to perform a series of complex tasks. These tasks are not only time-consuming, but also prone to errors due to human factors (such as missing configuration items), which can lead to anomalies in the project code framework and subsequently cause development and maintenance problems.

[0004] There is currently no effective solution to the problem of low efficiency and accuracy in building project code frameworks using related technologies. Summary of the Invention

[0005] The main objective of this application is to provide a method, apparatus, and electronic device for generating project code frameworks, in order to solve the problem of low efficiency and accuracy in building project code frameworks in related technologies.

[0006] To achieve the above objectives, according to one aspect of this application, a method for generating a project code framework is provided. The method includes: receiving a project code framework generation instruction sent by a user terminal, and parsing the instruction to obtain target project and component information, wherein the component information indicates functional modules to be added to the target project; identifying the project type of the target project, determining an initial code framework template based on the project type and component information, and determining a component template based on the component information; obtaining population parameters, and generating the project code framework of the target project based on the population parameters, the initial code framework template, and the component template.

[0007] Optionally, determining the initial code framework template based on the project type and component information includes: obtaining templates associated with the project type from the template library to obtain N first code framework templates, where N is a positive integer; determining the components included in the component information to obtain M target components, where M is a positive integer; and selecting a second code framework template from the N first code framework templates that allows the configuration of M target components to obtain the initial code framework template.

[0008] Optionally, after determining the component template based on the component information, the method further includes: determining a dependent object for each target component and determining the version information of each dependent object to obtain M sets of version information, wherein each set of version information includes multiple versions of the dependent object; determining the version information of each dependent object from the M sets of version information based on the version compatibility relationship between the dependent objects to obtain M second versions; obtaining the code template of each dependent object under the corresponding second version to obtain M second code templates, and adding the M second code templates to the component template to obtain the updated component template.

[0009] Optionally, determining the component template based on the component information includes: obtaining compatibility information between M target components, determining the version of each target component based on the compatibility information, and obtaining M first versions; obtaining the code template of each target component under the corresponding first version, obtaining M first code templates, and determining the M first code templates as component templates.

[0010] Optionally, generating the project code framework of the target project based on the fill parameters, the initial code framework template, and the component template includes: determining the configuration position of each target component in the initial code framework template; configuring M first code templates in the initial code framework template according to the configuration position to obtain the target code framework template; and filling the fill parameters into the target code framework template to obtain the project code framework.

[0011] Optionally, obtaining the fill parameters includes: determining whether the project code framework generation instruction contains initial parameters; if the project code framework generation instruction contains initial parameters, determining the initial parameters as fill parameters; if the project code framework generation instruction does not contain initial parameters, obtaining the preset parameters under the project type, and determining the preset parameters as fill parameters.

[0012] Optionally, after obtaining the project code framework, the method further includes: generating test code for the project code framework based on the project type and the project code framework; testing the project code framework using the test code to obtain test results; and sending exception information to the user terminal if the test results indicate that there is an exception in the project code framework.

[0013] To achieve the above objectives, according to another aspect of this application, a project code framework generation apparatus is provided. The apparatus includes: a receiving unit, configured to receive a project code framework generation instruction sent by a user terminal, and parse the instruction to obtain target project and component information, wherein the component information indicates functional modules to be added to the target project; a first determining unit, configured to identify the project type of the target project, determine an initial code framework template based on the project type and component information, and determine a component template based on the component information; and a first generating unit, configured to obtain fill parameters, and generate the project code framework of the target project based on the fill parameters, the initial code framework template, and the component template.

[0014] Optionally, the first determining unit includes: a first obtaining module, used to obtain templates associated with the project type from the template library to obtain N first code framework templates, where N is a positive integer; a first determining module, used to determine the components contained in the component information to obtain M target components, where M is a positive integer; and a selecting module, used to select a second code framework template that allows the configuration of M target components from the N first code framework templates to obtain an initial code framework template.

[0015] Optionally, after determining the component template based on the component information, the device further includes: a second determining unit, configured to determine a dependent object of each target component and determine the version information of each dependent object to obtain M version information sets, wherein each version information set includes multiple version information of the dependent object; a third determining unit, configured to determine the version information of each dependent object from the M version information sets based on the version compatibility relationship between the dependent objects to obtain M second versions; and an obtaining unit, configured to obtain the code template of each dependent object under the corresponding second version to obtain M second code templates, and add the M second code templates to the component template to obtain the updated component template.

[0016] Optionally, the first determining unit includes: a second obtaining module, used to obtain compatibility information between M target components, and determine the version of each target component based on the compatibility information to obtain M first versions; and a third obtaining module, used to obtain the code template of each target component under the corresponding first version to obtain M first code templates, and determine the M first code templates as component templates.

[0017] Optionally, the first generation unit includes: a second determining module, used to determine the configuration position of each target component in the initial code framework template; a configuration module, used to configure M first code templates in the initial code framework template according to the configuration position to obtain the target code framework template; and a filling module, used to fill the target code framework template with filling parameters to obtain the project code framework.

[0018] Optionally, the first generation unit includes: a judgment module, used to judge whether the project code framework generation instruction contains initial parameters; a third determination module, used to determine the initial parameters as fill parameters if the project code framework generation instruction contains initial parameters; and a fourth acquisition module, used to acquire preset parameters under the project type if the project code framework generation instruction does not contain initial parameters, and determine the preset parameters as fill parameters.

[0019] Optionally, after obtaining the project code framework, the device further includes: a second generation unit, used to generate test code for the project code framework according to the project type and the project code framework; a testing unit, used to test the project code framework using the test code and obtain test results; and a sending unit, used to send exception information to the user terminal if the test results indicate that there is an exception in the project code framework.

[0020] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, the electronic device including a memory storing an executable program; and a processor for running the program, wherein the program executes the above-described method for generating the project code framework during runtime.

[0021] To achieve the above objectives, according to another aspect of this application, a computer program product is provided, including computer instructions that, when executed by a processor, implement the steps of the above-described method for generating the project code framework.

[0022] In this embodiment, a method is adopted that receives a project code framework generation instruction sent by a user terminal, parses the instruction to obtain target project and component information, wherein the component information is used to indicate the functional modules to be added to the target project; identifies the project type of the target project, determines an initial code framework template based on the project type and component information, and determines a component template based on the component information; obtains fill parameters, and generates the project code framework of the target project based on the fill parameters, the initial code framework template, and the component template. By automatically determining the target project and component information based on the project code framework generation instruction, and determining the initial code framework template and component template based on the project type and component information, a complete project code framework is automatically assembled based on the initial code framework template and component template. This achieves the purpose of automatically and accurately generating the project code framework, thereby improving the technical effect of increasing the efficiency and accuracy of project code framework generation, and solving the technical problem of low efficiency and accuracy in building project code frameworks in related technologies. Attached Figure Description

[0023] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0024] Figure 1 A hardware structure block diagram of a computer terminal for implementing a method for generating project code frameworks is shown.

[0025] Figure 2 This is a flowchart of the method for generating a project code framework according to Embodiment 1 of this application;

[0026] Figure 3 This is a flowchart of an optional project code framework generation method provided in Embodiment 1 of this application;

[0027] Figure 4 This is a schematic diagram of a project code framework generation device according to Embodiment 2 of this application;

[0028] Figure 5 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0029] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0030] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0032] It should be noted that the method, apparatus, and electronic device for generating the project code framework as defined in this disclosure can be used in the computer field, or in any field other than the computer field, such as the financial technology field. The application fields of the method, apparatus, and electronic device for generating the project code framework as defined in this disclosure are not limited.

[0033] It should be noted that all information, user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, and displayed data) used in this application are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of related data all comply with the relevant laws, regulations, and standards of the relevant regions, have taken necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entry points for users to choose to authorize or refuse use. If the user chooses to refuse, the process will proceed to the expert decision-making process. For example, this system has an interface with relevant users or organizations. Before obtaining relevant information, a request to obtain the information needs to be sent to the aforementioned user or organization through the interface. After receiving consent from the aforementioned user or organization, the relevant information is obtained. Users can view the purpose of data use in real time through the authorization interface and have the right to withdraw authorization or delete data at any time. After the authorization is withdrawn, the system will terminate the relevant data processing within 24 hours.

[0034] The embodiments or examples disclosed herein are not exhaustive, but merely illustrative of some embodiments or examples, and are not intended to limit the scope of protection of this disclosure. Unless otherwise specified, each step in a particular embodiment or example can be implemented as an independent embodiment, and the steps can be arbitrarily combined. For example, a solution after removing some steps in a particular embodiment or example can also be implemented as an independent embodiment, and the order of the steps in a particular embodiment or example can be arbitrarily interchanged. Furthermore, optional methods or examples in a particular embodiment or example can be arbitrarily combined; moreover, embodiments or examples can be arbitrarily combined. For example, some or all steps of different embodiments or examples can be arbitrarily combined, and a particular embodiment or example can be arbitrarily combined with optional methods or examples of other embodiments or examples.

[0035] Example 1

[0036] According to an embodiment of this application, an embodiment of a method for generating a project code framework is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0037] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal for implementing a method for generating project code frameworks is shown. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, processing devices such as microprocessors or programmable logic devices), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface, a universal serial bus port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0038] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0039] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the project code framework generation method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the above-mentioned project code framework generation method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0040] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0041] The display may be, for example, a touchscreen LCD display that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).

[0042] Under the aforementioned operating environment, this application provides the following: Figure 2 The method for generating the project code framework is shown. Figure 2 This is a flowchart of the method for generating project code framework according to Embodiment 1 of this application, as follows: Figure 2 As shown, the method includes:

[0043] Step S201: Receive the project code framework generation instruction sent by the user terminal, and parse the project code framework generation instruction to obtain the target project and component information. The component information is used to indicate the functional modules to be added to the target project.

[0044] It should be noted that the execution entity in this embodiment can be a project code framework generation system. This system can generate the corresponding project code framework according to the generation instructions sent by the user, thereby improving the efficiency of project code framework generation.

[0045] It should be noted that the project code framework generation instruction is a request to create a project code framework, which includes the project's basic attributes and the required integrated functional modules. The target project refers to the specific software project the user intends to build using this system, and may include the project name, the preset architecture type, and the set of functional modules to be integrated. Component information refers to the detailed information listed in the project code framework generation instruction that defines the functional modules that the project needs to integrate, and may include database systems, caching solutions, logging frameworks, security components, etc.

[0046] Specifically, in the process of generating the project code framework, the system first receives the project code framework generation instruction sent from the user's end, and parses the instruction to obtain the basic information of the target project and the detailed list of required components contained in the instruction. That is, the technology stack and functional modules selected by the developer to build the project. The basic information of the target project may include information such as the target project name and type, and the detailed list of components may include the functional components that need to be created in the framework.

[0047] For example, if developers need to create a project code framework for a backend management system, the target project is the backend management system. Component information can include specific component information such as database, cache, and log processing modules. It should be noted that the specific application components can be adjusted according to the project creation environment, and this embodiment does not limit them.

[0048] Step S202: Identify the project type of the target project, determine the initial code framework template based on the project type and component information, and determine the component template based on the component information.

[0049] It's important to note that "project type" refers to the software engineering category or architectural style to which the target project belongs. The project type defines the basic framework of the project's structure and functionality, serving as the basis for selecting an appropriate template. The initial code framework template refers to the pre-defined code structure template under the project type, including the project's basic file and directory structure, configuration files, and the project startup class, providing a basic framework for subsequent component additions and customized configurations. Component templates are collections of code snippets and configuration examples for various functional modules. Each template contains configuration files and sample code for a specific component. Component templates supplement and refine the initial code framework template, giving it specific functional modules.

[0050] Specifically, after parsing the instructions and determining the target project and component information, the system needs to identify the type of the target project and select an initial code framework template that matches the project type from the preset template library. At the same time, the system determines the component templates suitable for each specified functional module one by one according to the component information list, so that the generated code framework not only meets the architectural requirements of the project, but also can integrate all the components selected by the user.

[0051] For example, after receiving and parsing the instruction, the system will identify the type of the target project, such as microservices or web applications. Based on the project type and component information, the system will automatically match the corresponding initial code framework template. The template contains the general code structure and configuration examples for the corresponding project type. For example, the template for microservices will contain basic startup classes, configuration classes, etc. Then, the system will further determine the required component templates based on the component information. Each component template corresponds to a specific functional module, such as a database connection template or a cache operation template. The template contains configuration examples and sample code for the component, enabling the project to correctly utilize the selected components.

[0052] Step S203: Obtain the filling parameters, and generate the project code framework of the target project based on the filling parameters, the initial code framework template, and the component template.

[0053] It should be noted that the populated parameters are provided by the user during the project creation process and are used to personalize the specific configuration parameters of the project code framework. These parameters may include database connection information, service port, environment variable settings, etc., so that the generated project framework can accurately reflect the user's needs and operating environment.

[0054] Specifically, after determining the initial code framework template and component template, the system needs to further obtain the population parameters and bind them with the dynamic placeholders in the template to generate a personalized code framework for the target project. By combining the population parameters, the initial code framework template, and the component template, the system uses a dynamic template engine to insert the parameter values ​​into the corresponding template placeholders to obtain a project code framework containing complete components and configurations. This completes the automatic generation of the project code framework, allowing business personnel to start writing business logic code without additional manual operations, thus improving the overall efficiency of the project process.

[0055] It should be noted that the project source code of the project code framework obtained in this embodiment encapsulates the example code, components, and parameter templates. If you need to add or delete examples carried in the project source code, you only need to add or delete templates in the configuration file of the project code framework, thereby improving the reusability of the project code framework.

[0056] The project code framework generation method provided in this application embodiment receives a project code framework generation instruction sent by a user terminal, parses the instruction to obtain target project and component information, wherein the component information is used to indicate the functional modules to be added to the target project; identifies the project type of the target project, determines an initial code framework template based on the project type and component information, and determines a component template based on the component information; obtains fill parameters, and generates the project code framework of the target project based on the fill parameters, the initial code framework template, and the component template. By automatically determining the target project and component information based on the project code framework generation instruction, and determining the initial code framework template and component template based on the project type and component information, a complete project code framework is automatically assembled from the initial code framework template and component template, achieving the purpose of automatically and accurately generating the project code framework. This improves the efficiency and accuracy of project code framework generation, thereby solving the technical problem of low efficiency and accuracy in building project code frameworks in related technologies.

[0057] To accurately select the initial code framework template, optionally, in the project code framework generation method provided in this application embodiment, determining the initial code framework template based on the project type and component information includes: obtaining templates associated with the project type from a template library to obtain N first code framework templates, where N is a positive integer; determining the components included in the component information to obtain M target components, where M is a positive integer; and selecting a second code framework template that allows the configuration of M target components from the N first code framework templates to obtain the initial code framework template.

[0058] Specifically, when determining the initial code framework template, since the initial code framework template needs to match the project type and be compatible with all components, the system needs to retrieve all first code framework templates that match the target project type from the template library. For example, assuming the user is creating a microservice project, the system will locate all first code framework templates that support the microservice architecture.

[0059] Furthermore, the system also needs to parse the components contained in the component information to obtain a component list. Based on the component list, it determines the first code framework template that is compatible with all the components on the component list, thus obtaining the initial code framework template. When using the initial code framework template to execute subsequent processes, it can combine the initial code framework template with all the components selected by the user while matching the target project, thereby improving the accuracy of the final project code framework.

[0060] This embodiment improves the accuracy of selecting the initial code framework template by filtering the code framework templates in the template library using project type and component information.

[0061] To ensure the components function correctly, optionally, in the project code framework generation method provided in this application embodiment, after determining the component template based on the component information, the method further includes: determining a dependent object for each target component and determining the version information of each dependent object to obtain M version information sets, wherein each version information set includes multiple version information of the dependent object; determining the version information of each dependent object from the M version information sets based on the version compatibility relationship between the dependent objects to obtain M second versions; obtaining the code template of each dependent object under the corresponding second version to obtain M second code templates, and adding the M second code templates to the component template to obtain the updated component template.

[0062] It's important to note that dependencies refer to external software packages or libraries required to implement the target component's functionality. The version information set contains multiple version information for each dependency, reflecting its version space, including historical versions and the latest version. Version compatibility refers to the version compatibility requirements between dependencies, ensuring all dependencies can work together under specific versions and preventing project build failures due to version conflicts. The second version refers to the dependency version selected from the version information set based on version compatibility, suitable for the current project build, ensuring the normal implementation of component functionality and smooth project build. The second code template refers to the code template obtained by the system based on the determined second version of the dependency.

[0063] Specifically, after determining the component template, it is also necessary to determine the dependent objects of each target component. Each target component can have one or more dependent objects. Since each dependent object may have multiple different versions, after determining the dependent objects of the target component, it is also necessary to determine the version information of the dependent objects so that the compatibility between the dependent objects of multiple target components can be improved.

[0064] For example, taking the database component as an example, the system will identify mysql-connector-java as its key dependency object and extract the version information set of this dependency object from the system database, which may include multiple version information such as 5.1.48, 8.0.17, and 8.0.23.

[0065] Furthermore, after obtaining the version information set of the dependent objects of each target component, the system will perform intelligent matching of version information based on the version compatibility relationship between each dependent object. At this time, it is necessary to analyze the dependency relationship of each component so that the versions of all dependent objects can coexist and work together to avoid version conflicts, thereby obtaining a second version of each dependent object. Through the analysis of version compatibility relationship, the system can avoid version conflicts between dependent objects and improve the usability of the constructed project code framework.

[0066] For example, if the version information of dependency A of target component A includes version 1, version 2, and version 3, and the version information of dependency B of target component A includes version 1, version 2, and version 3, and if both version 1 of dependency A and version 2 of dependency B correspond to the current version of target component A, then the second version of dependency A is determined to be version 1, and the second version of dependency B is determined to be version 2, thereby ensuring compatibility between dependency A and dependency B.

[0067] Finally, after obtaining the second version of each dependency, the code template of each dependency object under the corresponding second version can be obtained, and the second code template can be added to the component template, thereby improving the completeness of the content and functions in the component template.

[0068] This embodiment improves version compatibility between dependent objects by selecting the versions that each target component depends on, and adds the code templates of dependent objects to the component template, thereby improving the completeness of the content and functions in the component template.

[0069] To accurately select target components, optionally, in the project code framework generation method provided in this application embodiment, determining the component template based on component information includes: obtaining compatibility information between M target components, and determining the version of each target component based on the compatibility information to obtain M first versions; obtaining the code template of each target component under the corresponding first version to obtain M first code templates, and determining the M first code templates as component templates.

[0070] It's important to note that compatibility information refers to version compatibility rules between target components, ensuring all components can work together seamlessly during integration without being affected by version conflicts. The first version refers to the base version determined by the system based on the component information, used to build the target components. This aims to meet project requirements while guaranteeing version compatibility between components. Code templates are predefined code snippets and configuration examples used to quickly generate the basic structure of functional modules, facilitating subsequent code writing and configuration adjustments by developers.

[0071] Specifically, after obtaining the component information, the information of each target component can be retrieved from the component information, and then the component template for each target component can be selected. However, since there may be multiple versions of a target component, and the component templates are different for different versions, it is necessary to determine the version information of each target component, thereby improving the accuracy of the selected component template.

[0072] When determining the version information of each target component, compatibility information between multiple target components can be obtained, and the version of each target component, i.e., the first version, can be determined based on the compatibility information.

[0073] For example, if target component A has versions 1-3 and target component B has versions 1-3, in order to improve the compatibility between target components, it can be determined from the compatibility information that version 2 of target component A and version 3 of target component B are compatible. Then, when determining the version information of the target components, version 2 of target component A and version 3 of target component B can be determined as the first version, and the first code template under the first version can be obtained, thereby ensuring the accuracy and usability of the project code framework obtained by using the first code template as the component template.

[0074] It should be noted that the first code template also supports template customization and extension, allowing users to customize the template to suit different project needs.

[0075] This embodiment ensures compatibility between target components in the project code framework after the project code framework is generated by determining the version of the target components, thereby ensuring the normal operation and use of the project code framework.

[0076] To ensure the accurate generation of the project code framework, optionally, in the project code framework generation method provided in this application embodiment, generating the project code framework of the target project based on the fill parameters, the initial code framework template, and the component template includes: determining the configuration position of each target component in the initial code framework template; configuring M first code templates in the initial code framework template according to the configuration position to obtain the target code framework template; and filling the fill parameters into the target code framework template to obtain the project code framework.

[0077] It should be noted that the configuration location is the specific location or file path in the initial code framework template used to place the code and configuration of the specific target component, ensuring that the component can be correctly integrated into the project structure.

[0078] Specifically, when building the project code framework, the initial code framework template needs to be analyzed first to determine the configuration location of each target component. When determining the configuration location, it is necessary to identify the blank areas reserved for component code and configuration in the template, such as the location of configuration files under the "src / main / resources / config" directory and the location of code files under the "src / main / java / com.example" directory. By determining the configuration location, the system can ensure that component code and configuration are properly embedded into the project structure, ensuring the correct implementation of component functions and the consistency of the project.

[0079] Furthermore, after determining the configuration location of each target component, the system will configure the first code template of each target component into the initial code framework template according to the configuration location, forming the target code framework template. In the process of configuring the first code template into the initial code framework template, it is necessary to ensure that each code template and configuration file can be seamlessly connected to the correct position in the project structure.

[0080] Finally, the system identifies placeholders or variables in the template, replaces them according to the population parameters, and adds the population parameters to the target code framework template, resulting in the final project code framework. This parameter population ensures that the project code framework can be directly used by users, reducing manual configuration work for developers and improving the efficiency and accuracy of project building.

[0081] This embodiment identifies the configuration location and adds the filling parameters and target components to the initial code framework template to obtain the project code framework, thereby ensuring the accuracy of the project code framework.

[0082] To ensure the accuracy of the filling parameters, optionally, in the project code framework generation method provided in this application embodiment, obtaining the filling parameters includes: determining whether the project code framework generation instruction contains initial parameters; if the project code framework generation instruction contains initial parameters, determining the initial parameters as filling parameters; if the project code framework generation instruction does not contain initial parameters, obtaining preset parameters under the project type, and determining the preset parameters as filling parameters.

[0083] It should be noted that initial parameters are those that may be included in the project code framework generation instructions. These parameters contain necessary configuration details for project operation, such as database connection information, service port settings, and environment variables, and are used to customize the project code framework. Preset parameters are a set of default parameters predefined by the system for specific project types. When the user does not provide initial parameters, the system will use these parameters as default configurations to ensure the basic functionality and compatibility of the project framework.

[0084] Specifically, after receiving the project code framework generation instruction, the system needs to parse the parameter fields in the instruction to check for user-defined configuration information, thereby determining whether the instruction contains initial parameters. If the instruction carries initial parameters, the system can directly identify these initial parameters as filler parameters for the personalized generation of the project code framework.

[0085] When the project code framework generation instruction does not include initial parameters, the system will determine the type of project created by the user and obtain the preset parameters for that project type. These preset parameters may include common database connection settings, default service ports, standard environment variables, etc., thus ensuring that the project can still run normally even if the user does not provide parameters.

[0086] This embodiment uses different methods to determine the filling parameters, thereby ensuring the accuracy of the filling parameters and avoiding the occurrence of abnormal project code framework due to the absence of filling parameters.

[0087] To ensure the accuracy of the project code framework, optionally, in the project code framework generation method provided in this application embodiment, after obtaining the project code framework, the method further includes: generating test code for the project code framework according to the project type and the project code framework; testing the project code framework with the test code to obtain test results; and sending exception information to the user terminal if the test results indicate that the project code framework has an anomaly.

[0088] Specifically, to ensure the accuracy of the project code framework, test code is also required to test the project code framework. First, based on the project type and the generated project code framework, the components and functional modules in the project code framework need to be analyzed. Based on the interface definitions of these components, a test case set is built to obtain the corresponding test code, thereby ensuring that the test code fully covers the core functions and component interactions of the project code framework and ensuring the accuracy of the test operations.

[0089] Furthermore, after obtaining the test code, the project code framework can be comprehensively tested by executing the test code to verify its functionality, performance, and stability, thereby obtaining detailed test results. If any abnormal information is found during the test, this information can be compiled into a report and sent to the user terminal in a timely manner to ensure that the user can receive feedback quickly and take measures to solve the problem.

[0090] This embodiment ensures the accuracy of the project code framework by generating test code and testing the project code framework.

[0091] Figure 3 This is a flowchart of the optional project code framework generation method provided in Embodiment 1 of this application, as follows: Figure 3As shown, users can create a project code framework through the following process: First, create a project, which requires inputting the target project information, selecting the project components and dependent objects to be created, and inputting the population parameters. After inputting the above information, the system can generate the project code framework based on the target project information, project components, dependent objects, and population parameters. This allows business personnel to start writing business logic code without additional manual operations, improving the overall efficiency of the project process.

[0092] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0093] Example 2

[0094] This application also provides a project code framework generation apparatus. It should be noted that the project code framework generation apparatus of this application can be used to execute the project code framework generation method provided in the above embodiments. The following describes the project code framework generation apparatus provided in this application.

[0095] According to an embodiment of this application, an apparatus for implementing the above-described method for generating project code framework is also provided. Figure 4 This is a schematic diagram of a project code framework generation device according to Embodiment 2 of this application, as shown below. Figure 4 As shown, the device includes:

[0096] The receiving unit 41 is used to receive the project code framework generation instruction sent by the user terminal, and parse the project code framework generation instruction to obtain the target project and component information, wherein the component information is used to indicate the functional modules to be added to the target project.

[0097] The first determining unit 42 is used to identify the project type of the target project, determine the initial code framework template based on the project type and component information, and determine the component template based on the component information.

[0098] The first generation unit 43 is used to obtain the filling parameters and generate the project code framework of the target project based on the filling parameters, the initial code framework template and the component template.

[0099] The project code framework generation device provided in this application embodiment receives a project code framework generation instruction sent by a user terminal through a receiving unit 41, and parses the project code framework generation instruction to obtain target project and component information. The component information is used to indicate the functional modules to be added to the target project. A first determining unit 42 identifies the project type of the target project, determines an initial code framework template based on the project type and component information, and determines a component template based on the component information. A first generating unit 43 obtains filling parameters and generates the project code framework of the target project based on the filling parameters, the initial code framework template, and the component template. By automatically determining the target project and component information according to the project code framework generation instruction, and determining the initial code framework template and component template based on the project type and component information, a complete project code framework is automatically assembled based on the initial code framework template and component template. This achieves the purpose of automatically and accurately generating the project code framework, thereby improving the technical effect of increasing the efficiency and accuracy of project code framework generation and solving the technical problem of low efficiency and accuracy in building project code frameworks in related technologies.

[0100] Optionally, in the project code framework generation apparatus provided in this application embodiment, the first determining unit 42 includes: a first obtaining module, used to obtain templates associated with the project type from the template library to obtain N first code framework templates, where N is a positive integer; a first determining module, used to determine the components included in the component information to obtain M target components, where M is a positive integer; and a selecting module, used to select a second code framework template that allows the configuration of M target components from the N first code framework templates to obtain an initial code framework template.

[0101] Optionally, in the project code framework generation apparatus provided in this application embodiment, after determining the component template based on the component information, the apparatus further includes: a second determining unit, configured to determine a dependent object of each target component and determine the version information of each dependent object to obtain M version information sets, wherein each version information set includes multiple version information of the dependent object; a third determining unit, configured to determine the version information of each dependent object from the M version information sets based on the version compatibility relationship between each dependent object to obtain M second versions; and an obtaining unit, configured to obtain the code template of each dependent object under the corresponding second version to obtain M second code templates, and add the M second code templates to the component template to obtain the updated component template.

[0102] Optionally, in the project code framework generation apparatus provided in the embodiments of this application, the first determining unit 42 includes: a second obtaining module, used to obtain compatibility information between M target components, and determine the version of each target component according to the compatibility information to obtain M first versions; a third obtaining module, used to obtain the code template of each target component under the corresponding first version to obtain M first code templates, and determine the M first code templates as component templates.

[0103] Optionally, in the project code framework generation apparatus provided in the embodiments of this application, the first generation unit 43 includes: a second determining module, used to determine the configuration position of each target component in the initial code framework template; a configuration module, used to configure M first code templates in the initial code framework template according to the configuration position to obtain a target code framework template; and a filling module, used to fill the target code framework template with filling parameters to obtain a project code framework.

[0104] Optionally, in the project code framework generation apparatus provided in this application embodiment, the first generation unit 43 includes: a judgment module, used to judge whether the project code framework generation instruction contains initial parameters; a third determination module, used to determine the initial parameters as fill parameters when the project code framework generation instruction contains initial parameters; and a fourth acquisition module, used to acquire preset parameters under the project type when the project code framework generation instruction does not contain initial parameters, and determine the preset parameters as fill parameters.

[0105] Optionally, in the project code framework generation apparatus provided in this application embodiment, after obtaining the project code framework, the apparatus further includes: a second generation unit, used to generate test code for the project code framework according to the project type and the project code framework; a testing unit, used to test the project code framework through the test code and obtain test results; and a sending unit, used to send exception information to the user terminal when the test results indicate that there is an exception in the project code framework.

[0106] It should be noted that the receiving unit 41, the first determining unit 42, and the first generating unit 43 correspond to steps S201 to S203 in Embodiment 1. The instances and application scenarios implemented by each of these units and their corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1. It should also be noted that the modules or units described above can be hardware or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). These modules can also run as part of a device in the computer terminal 10 provided in Embodiment 1.

[0107] Example 3

[0108] Embodiments of this application may provide an electronic device. Figure 5 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 5 As shown, the electronic device may include: one or more ( Figure 5 (Only one is shown) processor 1002, memory 1004, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.

[0109] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0110] The processor can access information and applications stored in memory via a transmission device to perform the following steps: receiving a project code framework generation instruction sent by the user terminal, parsing the instruction to obtain target project and component information, wherein the component information is used to indicate functional modules to be added to the target project; identifying the project type of the target project, determining an initial code framework template based on the project type and component information, and determining a component template based on the component information; obtaining fill parameters, and generating the project code framework of the target project based on the fill parameters, the initial code framework template, and the component template.

[0111] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: obtain templates associated with the project type from the template library to obtain N first code framework templates, where N is a positive integer; determine the components included in the component information to obtain M target components, where M is a positive integer; select a second code framework template that allows the configuration of M target components from the N first code framework templates to obtain an initial code framework template.

[0112] The processor can also invoke information and applications stored in the memory via the transmission device to perform the following steps: determine a dependent object for each target component and determine the version information of each dependent object to obtain M sets of version information, wherein each set of version information includes multiple versions of the dependent object; determine the version information of each dependent object from the M sets of version information based on the version compatibility relationship between the dependent objects to obtain M second versions; obtain the code template of each dependent object under the corresponding second version to obtain M second code templates, and add the M second code templates to the component template to obtain the updated component template.

[0113] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: obtain compatibility information between M target components, and determine the version of each target component based on the compatibility information to obtain M first versions; obtain the code template of each target component under the corresponding first version to obtain M first code templates, and determine the M first code templates as component templates.

[0114] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: determine the configuration position of each target component in the initial code framework template; configure M first code templates in the initial code framework template according to the configuration position to obtain the target code framework template; fill the target code framework template with the filling parameters to obtain the project code framework.

[0115] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: determine whether the project code framework generation instruction contains initial parameters; if the project code framework generation instruction contains initial parameters, determine the initial parameters as fill parameters; if the project code framework generation instruction does not contain initial parameters, obtain the preset parameters under the project type, and determine the preset parameters as fill parameters.

[0116] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: generate test code for the project code framework according to the project type and project code framework; test the project code framework through the test code and obtain the test results; if the test results indicate that there is an anomaly in the project code framework, send the anomaly information to the user terminal.

[0117] Those skilled in the art will understand that Figure 5 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 5This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 5 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 5 The different configurations shown.

[0118] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0119] Example 4

[0120] Embodiments of this application also provide a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the project code framework generation method provided in Embodiment 1.

[0121] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.

[0122] Embodiments of this application also provide a computer program product, which, when executed on a data processing device, is adapted to perform the steps of a method for generating a project code framework.

[0123] Embodiments of this application also provide a computer-readable storage medium, which includes a stored executable program, wherein, when the executable program is running, it controls the device where the computer-readable storage medium is located to execute the above-described method for generating the project code framework.

[0124] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0125] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0126] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

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

[0128] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0129] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0130] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for generating a project code framework, characterized in that, include: The system receives a project code framework generation instruction sent by the user and parses the instruction to obtain target project and component information, wherein the component information is used to indicate the functional modules to be added to the target project. Identify the project type of the target project, determine the initial code framework template based on the project type and the component information, and determine the component template based on the component information; Obtain the fill parameters, and generate the project code framework of the target project based on the fill parameters, the initial code framework template, and the component template.

2. The method according to claim 1, characterized in that, The initial code framework template is determined based on the project type and component information, including: Retrieve templates associated with the project type from the template library to obtain N first code framework templates, where N is a positive integer; The components contained in the component information are determined to obtain M target components, where M is a positive integer; The initial code framework template is obtained by selecting a second code framework template that allows the configuration of the M target components from the N first code framework templates.

3. The method according to claim 2, characterized in that, After determining the component template based on the component information, the method further includes: Identify a dependent object for each target component and determine the version information of each dependent object to obtain M sets of version information, wherein each set of version information includes multiple versions of the dependent object; Based on the version compatibility relationship between each dependent object, the version information of each dependent object is determined from the M version information sets to obtain M second versions; Obtain the code templates for each dependent object in the corresponding second version, resulting in M ​​second code templates. Add the M second code templates to the component template to obtain the updated component template.

4. The method according to claim 2, characterized in that, Determining the component template based on the component information includes: Obtain compatibility information among the M target components, and determine the version of each target component based on the compatibility information to obtain M first versions; Obtain the code templates for each target component in the corresponding first version, resulting in M ​​first code templates, and determine the M first code templates as the component templates.

5. The method according to claim 4, characterized in that, Generating the project code framework for the target project based on the filling parameters, the initial code framework template, and the component template includes: Determine the configuration location of each target component within the initial code framework template; The M first code templates are configured in the initial code framework template according to the configuration position to obtain the target code framework template; The filling parameters are filled into the target code framework template to obtain the project code framework.

6. The method according to claim 1, characterized in that, Retrieving fill parameters includes: Determine whether the project code framework generation instructions contain initial parameters; If the initial parameter is included in the project code framework generation instruction, the initial parameter is determined as the filling parameter; If the initial parameters are not included in the project code framework generation instructions, the preset parameters under the project type are obtained, and the preset parameters are determined as the filling parameters.

7. The method according to claim 1, characterized in that, After obtaining the project code framework, the method also includes: Based on the project type and the project code framework, generate test code for the project code framework; The project code framework is tested using the test code, and the test results are obtained. If the test results indicate that there is an anomaly in the project code framework, the anomaly information will be sent to the user terminal.

8. A device for generating project code framework, characterized in that, include: The receiving unit is used to receive the project code framework generation instruction sent by the user terminal, and parse the project code framework generation instruction to obtain the target project and component information, wherein the component information is used to indicate the functional modules to be added to the target project; The first determining unit is used to identify the project type of the target project, determine an initial code framework template based on the project type and the component information, and determine a component template based on the component information. The first generation unit is used to obtain the filling parameters and generate the project code framework of the target project according to the filling parameters, the initial code framework template and the component template.

9. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the steps of the method for generating the project code framework according to any one of claims 1 to 7.

10. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, executes the method for generating the project code framework according to any one of claims 1 to 7.