Method and system for automatically generating software codes
Through the method and system of automatically generating software code, and using menu tables, field tables and data link models, the problems of long development cycle, large resource occupation, and difficult to guarantee code quality in software development are solved, and efficient and maintainable code generation is achieved.
Patent Information
- Application Number
- CN202510048487.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2045-01-13
AI Technical Summary
In software development, the existing technology has problems such as long development cycle, large resource usage, large investment in code review and quality assurance, insufficient handling of complex logic and customized requirements, and difficult to ensure code consistency and maintainability in large-scale multi-team collaboration projects.
Provides a method and system for automatically generating software code. By setting the cross-travel relationship between menu tables, field tables and tables, importing the data link model for statement decomposition, and automatically generating code. The system includes menu tables, field tables and software generation tools, and uses the data link model to automatically generate code based on the imported module menus and field definitions.
It significantly reduces the workload of manual coding, shortens the development cycle, reduces the dependence on professional and technical personnel, reduces labor costs, and improves the maintainability and consistency of codes.
Smart Images

Figure CN119960760A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software development, and in particular to a method and system for automatically generating software codes. Background Art
[0002] The field of software development has undergone an evolution from traditional development models to agile, DevOps and low-code development. Agile development refers to reducing the impact of changing requirements by regularly delivering working software increments; DevOps (a combination of Development and Operations) is a culture and practice that emphasizes close cooperation and communication between software development (Dev) and information technology operations (Ops) teams, that is, through continuous integration and continuous deployment, rapid feedback and rapid time to market are achieved; low-code development (Low-Code Development) is a method to simplify the application development process through a graphical interface and pre-built modules, that is, using a low-code development platform to provide visual programming tools and pre-built application templates, so that developers can build applications without writing a lot of code, lowering the development threshold, and through a visual interface and pre-set components, non-professional developers can also participate in application development.
[0003] Traditional models such as the waterfall model and the incremental model are characterized by phased development and strict document control, but they have problems such as long development cycles and high resource consumption. The emergence of agile development and DevOps, by emphasizing iterative collaboration and the integration of development and operation, has increased the speed of development, but still requires a lot of resources to be invested in code review and quality assurance, and there are still problems such as lack of processing of complex logic and customized requirements. At the same time, existing technologies still find it difficult to ensure code consistency and maintainability when dealing with large-scale, multi-team collaborative projects. Summary of the invention
[0004] The present invention provides a method and system for automatically generating software codes, which improves development efficiency and saves labor costs.
[0005] A first object of the present invention is to provide a method for automatically generating software codes.
[0006] A second object of the present invention is to provide a system for automatically generating software codes.
[0007] To achieve the first object of the present invention, a method for automatically generating software code comprises the following steps:
[0008] S11, setting a menu table, a field table and a traversal relationship between tables, wherein the menu table has column title content, module title content and module table name content, wherein multiple column titles in the column title content are grouped together and correspond to a module title, and the module title corresponds to the module table name one by one;
[0009] The field table has custom field content and module table name content, and the custom field corresponds to the module table name;
[0010] The inter-table traversal relationship is used to realize the traversal of the menu table and the field table;
[0011] S12, importing the menu table, field table and traversal relationship into the data link model, performing sentence decomposition using the built-in English-Chinese dictionary of the data link model, decomposing the sentences in the menu table and field table into words and graphic icons, and realizing traversal of the menu table and field table;
[0012] S13. The data link model automatically generates code based on the imported module menu and field definitions.
[0013] In the above scheme, the module title table name in the menu table corresponds to the module table name in the field segment. Data connection can be performed using database relationships or tools such as Excel or programming languages. In short, as long as the same fields in the menu table and the field table have the same data type and format, data connection can be achieved.
[0014] As a further technical solution, the menu table and the field table are Excel tables, or Google Sheets, or LibreOffice Calc.
[0015] As a further technical solution, the specific steps for implementing cross-table crossing are: decomposing the statements on the menu table and the field table into data elements, each of which corresponds to a data element ID, and using the data element ID as a data bridge to perform one-to-one or one-to-many cross-table management to form a cross-data chain.
[0016] As a further technical solution, the data link model is a large model of a digital factory developed by software, or an open source automation server, or a built-in continuous integration and continuous delivery tool, or a continuous integration and continuous deployment server software.
[0017] In the above solution, the open source automation server can be Jenkins, the built-in continuous integration and continuous delivery tool can be the built-in continuous integration and continuous delivery (or deployment) tool (GitLab CI / CD) of Arcfox, and the continuous integration and continuous deployment server software can be Bamboo.
[0018] As a further technical solution, when software is used to develop a large digital factory model, the steps of automatically generating software code are as follows:
[0019] S51, software development digital factory large model preset table management function, preset field management function, preset method interface function, preset customized form function and preset button management function, the preset function has software data content corresponding to the semantic content in the menu table and field table;
[0020] S52, importing the user's menu table, field table and inter-table traversal relationship into the software development digital factory big model, wherein the menu table and field table contain the menu module content input by the user;
[0021] S53, performing semantic parsing and table traversal according to the menu modules in the menu table and the field table, and generating target software data content using preset functions, wherein the target software data content includes functional requirements, business logic, database structure, and user interface layout;
[0022] S54, automatically calling a code generator and a model conversion tool according to the target software data content generated by semantic analysis, compiling the code adapted to the menu module, and generating the logical structure, database model and user interface of the software;
[0023] S55, verifying the logical structure, data model and user interface of the generated software according to the inspection rules and inspection standards preset in the software development digital factory macro model; if the verification fails, repeating S51 to S54 until the verification passes;
[0024] S56. Output compiled code, generate documentation, and prepare deployment packages.
[0025] In the above technical solution, the large model of the digital factory for software development already contains a library of various software automation tools and frameworks, and automatically matches the most suitable tools and frameworks according to the target software data content such as the functional requirements in the form through a matching algorithm.
[0026] In actual operation, specific matching methods include: rule-based matching, such as matching the keywords and descriptions in the functional requirements in the form with the tools and frameworks in the large model; or machine learning matching, such as using a machine learning model to train the model based on historical data to predict the match between project requirements and tools and frameworks; or performance benchmark testing, such as selecting the option with the best performance based on the test results. The specific automatic matching method is based on the user's own choice.
[0027] As a further technical solution, the method for implementing the menu module in the menu table is:
[0028] S61, designing a module menu matching the content of the menu table according to the business logic and menu items in the menu table;
[0029] S62, all module menus form a menu module of a menu table;
[0030] S63, introducing the designed menu module into the menu table through the import statement.
[0031] As a further technical solution, in step S53, the semantic parsing process includes preprocessing, information identification, and data mapping steps, specifically:
[0032] Get the content in the menu module, pre-process and clean invalid or redundant data and handle missing values;
[0033] According to the preset table management function and the preset field management function, the data information in the menu table and the preset fields is automatically identified, and the data in the menu table is converted into the fields of the database table or the cell values are converted into the properties of the user interface controls.
[0034] As a further technical solution, in step S54, the process of generating a software structure from the generated target software data content includes the steps of generating a business logic structure, generating a database model, and generating a user interface, specifically:
[0035] According to the business logic and the database architecture, the preset table management function, the preset field management function, the customized form function and the button management function are adopted, the preset method interface function, the code generator and the database architecture are called to automatically generate the logical structure and database model of the software, and the user interface framework interface is called to automatically generate the user interface.
[0036] As a further technical solution, in step S56, the process of outputting the target software file includes code output, documentation and deployment steps, specifically:
[0037] S91, compile the generated code file into an executable file or a library;
[0038] S92, submitting the version control system of the executable file or library to Git for tracking changes or collaboration;
[0039] S93, generating software development documents, wherein the software development documents include API documents and user manuals;
[0040] S94. Deploy the software code files to the target environment through installation, configuration and startup.
[0041] To achieve the second purpose mentioned above, the present invention provides a system for automatically generating software code, including a menu table, a field table and a software generation tool, wherein the menu table has column title content, module title content and module table name content, wherein a plurality of column titles in the column title content are grouped together and correspond to a module title, and the module title corresponds to the module table name one by one; the field table has custom field content and module table name content, and the custom field corresponds to the module table name; the traversal relationship is to connect the menu table and the field table, so as to realize the traversal of the menu table and the field table;
[0042] The data link model uses a large English-Chinese dictionary to decompose sentences, decomposing the sentences in the menu table and field table into words and graphic icons to achieve traversal of the menu table and field table; the data link model automatically generates code based on the imported module menus and field definitions.
[0043] In summary, through automated code generation and system architecture construction, the workload of manual coding is significantly reduced, the development cycle is shortened, the dependence on professional technicians is reduced, and the labor cost is reduced; at the same time, the style of the automatically generated code is unified, which improves the maintainability of the code.
[0044] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0046] Figure 1 A flowchart of a method for automatically generating software code provided in an embodiment of the present application;
[0047] Figure 2 An example diagram of a menu table in a method for automatically generating software code provided in an embodiment of the present application;
[0048] Figure 3 An example diagram of a field table in a method for automatically generating software code provided in an embodiment of the present application;
[0049] Figure 4 A schematic diagram of a flow chart of table traversal in a method for automatically generating software code provided in an embodiment of the present application;
[0050] Figure 5 A flowchart of another method for automatically generating software code provided in an embodiment of the present application
[0051] Figure 6A flowchart of a menu module in a method for automatically generating software code provided in an embodiment of the present application;
[0052] Figure 7 A flowchart of semantic parsing in a method for automatically generating software code provided in an embodiment of the present application;
[0053] Figure 8 A schematic diagram of a process of outputting target software in a method for automatically generating software code provided in an embodiment of the present application;
[0054] Fig. 9 A schematic diagram of the structure of a computer device provided in an embodiment of the present application.
[0055] Reference numerals:
[0056] 1 Computer device; 2 Processor; 3 Storage medium; 4 Bus. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, 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 described embodiments are only part of the embodiments of the present invention, not all of the embodiments.
[0058] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0059] In the description of the present application, it should be noted that if the terms "upper", "lower", etc. appear, the orientation or position relationship indicated is based on the orientation or position relationship shown in the drawings, or is the orientation or position relationship in which the product of the application is usually placed when used. It is only for the convenience of describing the present application and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application.
[0060] In addition, the terms "first", "second", etc. in the specification 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 data 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 that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0061] It should be noted that, in the absence of conflict, the features in the embodiments of the present application may be combined with each other.
[0062] Figure 1 A flowchart of a method for automatically generating software code provided in an embodiment of the present application; Figure 1 As shown, the method includes:
[0063] S11. Set the menu table, field table and table crossing relationship. The menu table contains column title content, module title content and module table name content. Multiple column titles in the column title content are grouped together and correspond to a module title. The module title corresponds to the module table name one by one.
[0064] Menu tables and field tables can be made with Excel tables, or with various spreadsheet processing software on the market, such as Google Sheets or LibreOffice Calc. LibreOffice Calc is a component of LibreOffice, a free and open-source spreadsheet processing tool that has the basic functions of Microsoft Excel. In short, any software that has the same powerful data processing and analysis capabilities can be used as a substitute for Excel.
[0065] like Figure 2 As shown, the column title content in the menu table can include systems such as YCWMS001, custom names such as Cloud Warehouse WMS, module title content such as Module 1, Module 2, Module 3, Module n, etc., module table name content such as Financial Management, Report Management, Comprehensive Management, Operation and Maintenance Management, etc., among which custom names such as Enterprise Mall and M01, Sales Management and M02, Procurement Management and M03, Contract Management and M04 correspond one to one.
[0066] Each module title name can also cascade to the next module name, such as module 1 includes module M01, M02, M11, module M12, module M13, module M14, module nn, etc. Each module 1 has a corresponding Chinese custom name; module 2 includes module M01 _ 01, M01 _ 02, M02 _ 01. Module M02 _ 02. Module M12 _ 10. Modules _ nn _ nn, etc. Each module 2 has a corresponding Chinese custom name; module 3 includes module M12 _ 01 _ 01. M12 _ 01 _ 02. M12 _ 01 _ 03.Mnn _ nn _ nn, etc.; in the above letters, M represents the abbreviation of module, n represents a single-digit integer, and nn represents a two-digit integer.
[0067] The field table has custom field content and module table name content, and the custom field corresponds to the module table name; the menu table and the field table are linked to realize the traversal of the menu table and the field table.
[0068] like Figure 3 As shown, the field table includes the module table name such as M01 _ 01, and the module title corresponding to the module table name, such as module M01 _ 01 corresponds to the module title product category, module M01 _ 02 corresponds to the module title Product Management, module M01 _ 03 corresponds to module title Order Management, module M12 _ 01 _ 01 corresponds to the title name of the customer's new addition, M12 _ 01 _ 02 The corresponding title name is Customer Review, M12 _ 01 _ 03The corresponding title name is customer files, etc.
[0069] like Figure 2 and Figure 3 As shown, the custom field content in the field table is as follows: module title, product category and label name M01 _ 01 corresponds to the custom name product category in the menu table and M01 under module 2 _01 corresponds to, because the same fields in the menu table and the bullet table have the same data type and format, the existing technology such as database relationship or use tools such as Excel or programming languages to connect the data. For example, in actual operation, using database relationship, there are primary keys and foreign keys to establish the relationship between tables; or table connection, in SQL query, you can use JOIN statement to connect two or more tables, and match according to the same fields; using tools such as Excel, use vlookup function, such as in Excel, you can use VLOOKUP function to find and return the value of the same field in another table as the current table; using INDEX and MATCH function combination, such as by combining INDEX and MATCH functions, to achieve functions similar to VLOOKUP function; using PowerQuery, merge the data of multiple worksheets into one query, and match and connect according to the same fields; in programming languages, such as Python and other programming languages to read and process multiple data tables, and match and connect according to the same fields.
[0070] The inter-table crossing relationship is achieved by connecting the menu table and the field table, thereby realizing the crossing of the menu table and the field table. Specifically, it can be achieved by cross-table reference or cross-table search.
[0071] S12, importing the menu table and the field table into the data link model, the data link model uses a built-in English-Chinese dictionary to perform sentence decomposition, decomposing the sentences in the menu table and the field table into words and graphic icons, and realizing the traversal of the menu table and the field table;
[0072] In step S12, if Figure 4 As shown, the steps of traversal between tables are: decompose the statements on the menu table and the field table into data elements, each of which corresponds to a data element ID, and use the data element ID as a data bridge to perform one-to-one or one-to-many traversal management between tables to form a traversal data chain.
[0073] In actual operation, through the English-Chinese dictionary, the sentences in the menu table and field table are decomposed into words, graphic icon services, and the graphic font library is moved into this platform, and icons are used to support the needs of mobile terminal icons. The data source is associated, and the data is loaded into this platform in the form of metadata and the platform data metadata is fed back.
[0074] For example, the words in the commodity classification and commodity management module units are decomposed into, for example, categories, names, codes, creation time, update time and other words and translated into corresponding English.
[0075] S13. The data link model automatically generates code based on the imported module menu and field definitions.
[0076] In step S13, the data link model can be a large model of a digital factory for software development, or an open source automation server, or a built-in continuous integration and continuous delivery tool, or a continuous integration and continuous deployment server software; the open source automation server can be Jenkins, the built-in continuous integration and continuous delivery tool can be the built-in continuous integration and continuous delivery (or deployment) tool (GitLab CI / CD) of Arcfox, and the continuous integration and continuous deployment server software can be Bamboo.
[0077] In a preferred embodiment, Figure 5 As shown, when software is used to develop a large digital factory model, the steps of automatically generating software code are as follows:
[0078] S51, software development digital factory large model preset table management function, preset field management function, preset method interface function, preset customized form function and preset button management function, the preset function has software data content corresponding to the semantic content in the menu table and field table;
[0079] Among them, in step S51, the preset table management function includes a table list unit, a table operation unit, a table import unit and a view creation unit, wherein the table list unit includes approval templates, platform advertisements, billboard information, billboard classification, button management, dictionary data, organization price, dictionary type, message, operation log, platform configuration, role information, etc. The table name and table type corresponding to the above table list unit are as shown in wl _ act _ template、BAS E TABLE,wl _ banner, BASETABLE, wl_bulletin _ board, BASE TABLE, etc.; the table operation units corresponding to the above table list units include importing table structure, creating views, deleting, refreshing, code generation, online deployment package and other table operations.
[0080] The preset field management function includes field list unit, field operation unit and logical operation unit; such as title, swagger external title, field name, mapping name as primary key code, primary key code, id, id, template name, template name, name, name, template content, template content, content, content, etc.; the field operation unit includes the addition, deletion, modification and query (CRUD) operations on the data in the database table, as well as the definition, verification, indexing and relationship management of the field; the type of the field is such as integer, string, date, etc., and special fields also include floating point numbers, decimal numbers, large text, IP addresses, URLs, etc.; when defining field parameters, you can set a variety of parameters to constrain and describe the behavior of the field, such as maximum length, default value, whether to allow empty, whether unique, whether to set an index, etc.; the logical operation of the field mainly involves the processing of Boolean values (true or false), and combining simple logical expressions through logical operators to form complex logical judgments. The preset method interface functions include method list unit, method operation unit, method list setting unit, method details setting unit, method button setting unit, and method sorting setting unit. Among them, the method list unit includes material code, location code, drop-down definition, order matching, document code, daily maintenance, material control, material details, storage and distribution rules, etc. The method names include showYcwms001M130207Main, showYcwms001M130206Main, showYcwms001M130205Main, showYcwms001M130202Main, etc. The preset table management function and preset field management function are realized by calling the preset method interface.
[0081] The preset customized form functions include method list units and method operation units, among which the method list includes material code, location code, order matching, material price, material details, document code, daily maintenance and other functional units, and the method operation unit includes operations such as deletion or copying; the preset button management functions include button list units, button operation units, button import units and other functional units, such as button insert (new function), button delete (delete function), button check (review function), button import (import function), button export (export function), button print (print function), etc.
[0082] The dictionary data, dictionary type and other functional units in the preset table list management function, the field list unit, field operation unit and logical operation unit such as field name, template name and other functional units in the preset field management function, through the preset method interface and the preset customized form function, can correspond to the preprocessing, information recognition and data mapping in the semantic parsing process, and realize the mapping of the identified field table and the target software data in the menu table to the corresponding fields or user interface control attributes of the database of the software development digital factory large model.
[0083] S52, importing the user's menu table and field table and the inter-table traversal relationship into the software development digital factory big model, wherein the menu table and field table contain the menu module content input by the user;
[0084] In step S52, if Figure 6 As shown, the method to implement the menu module is as follows:
[0085] S61. According to the business logic and menu items in the menu table, a module menu matching the contents of the menu table is designed.
[0086] According to the user's business function requirements, that is, the user's actual business logic, check the business logic and menu items in the menu table. For example, if the user's business function requirement is product order management, the user needs to check the menu items in the menu table, including customer management, order management, after-sales management, supplier management, purchase application, purchase plan, supplier side and other businesses, until the user designs and completes the module menu that meets the user's business function requirements.
[0087] S62, all module menus form a menu module of a menu table;
[0088] There are multiple menu modules in the menu table. For example, in the cloud warehouse WMS system, module M01 (Enterprise Mall) includes M01 _ 03 (Order Management); Module M02 (Sales Management) includes M02 _ 01(Customer Management) Module, M02 _ 02 (Order Management) Module, M02 _ 03 (after-sales management) module; M03 _ 01 (Supplier Management) Module, M03 _ 02 (Purchase Application) Module, M03 _ 03 (Purchase Plan) Module, M03 _ 04 (temporary procurement plan) module, M03 _ 05 (Share Control) Module, M03 _06 (supplier side) module, etc.; one of the large systems, such as the cloud warehouse WMS system, includes several menu modules such as the enterprise mall module, sales management module, procurement management module and other menu modules; each menu module, such as the sales management module, includes customer management, order management, after-sales management and other module menus; menu modules, such as the procurement module, include supplier management, procurement application, procurement plan, forest procurement plan, share control, supplier side and other module menus.
[0089] All the above menu modules form a menu module of a menu table. Users can reuse modular codes or data in different workbooks, reducing duplication of work.
[0090] S63. Introduce the designed menu module into the menu table through the import statement.
[0091] In steps S62 and S63, according to the menu structure obtained in step S61, the menu module can be introduced into the form through the import statement, thereby completing the construction of the menu module.
[0092] After implementing the menu module in the Excel form, you can easily check and configure the menu module according to the user's business needs such as project functions. Since each menu module can be modified and updated independently without affecting other parts, the menu module has high maintainability and readability, reduces the error rate, improves work efficiency, and makes the structure of the workbook clearer and easier to manage.
[0093] S53, performing semantic parsing and table traversal according to the menu modules in the menu table and the field table, and generating target software data content using preset functions, the target software data content including functional requirements, business logic, database structure and user interface layout;
[0094] In step S53, semantic parsing and table traversal are performed according to the menu module in the user form to generate target software data content, which includes functional requirements, business logic, database structure and user interface layout;
[0095] In the above steps, if Figure 7 As shown in the figure, the semantic parsing process includes preprocessing, information recognition, and data mapping steps, which are as follows:
[0096] Get the content in the menu module, pre-process and clean invalid or redundant data and handle missing values;
[0097] It can be understood as reading Excel files, such as using libraries (such as Apache POI and EasyExcel) in programming languages (such as JAVA) to read data in Excel files, and cleaning the data in Excel files, such as removing invalid or redundant data, processing missing values, and ensuring data consistency and accuracy.
[0098] According to the preset table management function and the preset field management function, the data information in the menu table and the preset fields is automatically identified, and the data in the menu table is converted into the fields of the database table or the cell values are converted into the properties of the user interface controls.
[0099] It can be understood that, through the software development digital factory big model and the rule engine, the preset software functions such as the preset table management function, preset field management function, preset method interface function, preset custom form function and preset button management function of the software development digital factory big model are automatically matched with the target software data content in the menu table, and the above-mentioned preset software functions have included and defined the software functions, database structure and user interface layout, that is, mapping the identified information data to the corresponding fields of the database or the user interface control properties.
[0100] It can be understood that after the software development digital factory large model is automatically matched, the fields in the Excel table are mapped to the corresponding elements in the software component process, such as converting table rows into fields in the database table, or converting cell values into properties of user interface controls.
[0101] In this embodiment, the software development digital factory model has a modular architecture, that is, different functional modules are designed independently; automated processing, that is, data cleaning, conversion and analysis are automatically completed through algorithm models and data mapping, reducing manual intervention and lowering error rates.
[0102] The software development digital factory model has functional modules such as data import module, data processing module, data analysis module and report generation module. Among them, the data import module includes multi-format support, such as support for importing from multiple data sources, including but not limited to CSV, Excel, database and API interface, and users can flexibly choose according to their needs; data mapping, such as providing an intuitive interface, users can customize the mapping of import fields to ensure that data is accurately imported into the target table; the data processing module includes data cleaning, such as automatic detection and processing of missing values, outliers, duplicate data, etc., to ensure data quality; data conversion, such as supporting multiple data conversion operations such as unit conversion, date formatting and classification coding to improve data consistency; the data analysis module includes statistical analysis, that is, built-in multiple statistical analysis tools, users can quickly generate data reports such as descriptive statistics and correlation analysis; visualization function, that is, support for intuitive presentation of analysis results through charts (such as bar charts, pie charts, line charts, etc.), to help users quickly understand data trends; the report generation module includes custom reports, such as users can customize report templates according to specific needs, and the system automatically fills in analysis results; real-time reports, such as supporting real-time data updates and dynamically generating reports to ensure that users obtain the latest business insights.
[0103] The software development digital factory big model has a built-in complete English-Chinese dictionary and custom algorithms. The English-Chinese dictionary includes automatic translation, such as automatic translation of various input fields and data items, so that multilingual users can use the system without obstacles; standardized naming, such as maintaining the standard names of data items through dictionaries, improving data consistency and readability; custom algorithms include intelligent recommendations, such as providing intelligent recommendation algorithms based on historical data and user behavior analysis to help users make better decisions; prediction functions, such as analyzing and modeling historical data through machine learning algorithms to achieve prediction of future data and enable enterprise data-driven decision support.
[0104] For example, a Java example is constructed to demonstrate how to automatically identify data information in a menu table and convert it into database table fields or convert cell values into properties of user interface controls according to the preset table management function and preset field management function. In this embodiment, the user has preset a menu table and a field table, wherein the menu table at least includes data or data structure information such as the field name and type to be converted, and the field table at least includes data or data structure information such as the type and properties of the defined field. The HashMap storing the field name and its corresponding database type is created through the PRESET_FIELDS statement, and then the database table is created. The specific process of creating the database table is as follows:
[0105] (1) The createDatabaseTable method uses StringBuilder to construct the CREATE TABLE SQL statement;
[0106] (2) Connect to the database and execute SQL using JDBC;
[0107] (3) You need to change the database connection information to your own database details.
[0108] It can be understood that after creating the data table, the user interface is generated. The specific creation steps are as follows:
[0109] (1) The createUserInterface method generates a Swing interface based on the field name and creates the corresponding label and text box.
[0110] (2) Contains a submit button, which can be used to add data submission logic after clicking it.
[0111] It can be understood that the above implementation of the function of automatically identifying the data information in the menu table and the preset fields according to the preset table management function and the preset field management function, and converting the data in the menu table into the fields of the database table or converting the cell values into the properties of the user interface controls is the basic function implementation. In actual development, input validation, exception handling and function extension should also be considered. Users can handle input validation, exception handling and function extension according to the existing technology, which will not be repeated here.
[0112] S54. Automatically call the code generator and model conversion tool according to the target software data content generated by semantic analysis, compile the code suitable for the menu module, and generate the logical structure, database model and user interface of the software.
[0113] The process of generating software structure from the generated target software data content includes the steps of logical structure generation, database model generation and user interface generation, specifically:
[0114] According to the business logic and the database architecture, the preset application development framework is adopted, the code generator and the database architecture are called, the logical structure and database model of the software are automatically generated, and the user interface framework interface is called to automatically generate the user interface.
[0115] The software development digital factory big model calls the code generator and model conversion tools such as database architecture according to the target software data content obtained by semantic analysis in step S53, and automatically creates the software class diagram, database architecture and user interface prototype.
[0116] S55, verifying the logical structure, data model and user interface of the generated software according to the inspection rules and inspection standards preset in the software development digital factory macro model; if the verification fails, repeating S51 to S54 until the verification passes;
[0117] It can be understood that the large model of the digital factory for software development calls the code generation interface such as the GPT series model, or calls the natural language processing algorithm such as GPT, RERT, etc. or the static code analysis algorithm to verify the generated software logic structure; calls the data model generation interface or the data verification interface or the database schema generation algorithm or the entity relationship diagram generation algorithm or the data verification algorithm to verify the data model of the generated software; calls the test case generation interface or the test execution interface or the test data generation algorithm or the test script generation algorithm or the automated testing algorithm to verify the user interface.
[0118] In actual operation, table analysis algorithms also include image-to-text models of image form type, text-to-text models of text form type, table models of table form type, or file parsing tools of file form type. The specific analysis algorithm is determined according to the user's own needs.
[0119] By automatically calling the above interfaces or algorithms to check the correctness, completeness and consistency of software logic, database model and user interface, the above verification may also include unit testing, integration testing and user acceptance testing. Among them, unit testing refers to: unit testing of generated software logic, integration testing refers to testing the interaction between different modules of the software, and user acceptance testing refers to whether the software product or system can meet the needs of users or businesses in the actual usage environment. The above tests can ensure that every part of the software works as expected.
[0120] S56. Output compiled code, generate documentation, and prepare deployment packages.
[0121] like Figure 8 As shown in the figure, the target software output file process includes code output, documentation and deployment steps, specifically:
[0122] S91, compile the generated code file into an executable file or a library;
[0123] Compilation is a translation process that translates source programs written in high-level programming languages into equivalent machine language target programs. This process includes six sequential logical steps: lexical analysis, syntax analysis, semantic analysis, code optimization, storage allocation, and code generation. The compiler converts the high-level language that people are familiar with into a binary language that computers can recognize, so that computers can execute these programs.
[0124] S92, submitting the version control system of the executable file or library to Git for tracking changes or collaboration;
[0125] Among them, Git is an open-source distributed version control system used to agilely and efficiently handle version management of projects of any size. On the premise that Git has been installed, in the root directory of the execution file or library, use the git init command to initialize the Git repository, use the git add command to add the above-mentioned execution files, the version control system that comes with the library, and related configuration files to the Git repository, use the git commit-m "commit information" command to commit the changes and attach the commit information. If you need to collaborate in a team, you can use the git remote add origin <remote warehouse address> command to add a remote warehouse, and then use the git push-u origin master command to push the changes in the local warehouse to the remote warehouse.
[0126] S93, generating software development documents, the software development documents including API documents and user manuals;
[0127] Among them, the software development digital factory large model automatically generates development documents based on the imported user menu table and field table. The development documents include API documents and user manuals. The API documents usually include interface overview, interface address, request parameters, corresponding format, error code, authentication and authorization, sample code and other contents. The user manual includes introduction, software overview, operating environment, installation and initialization, instructions for use, troubleshooting and problem solving, version updates and upgrades, additional information and resources, appendix and other contents, which are mainly used to help users get started quickly and use the software proficiently.
[0128] S94. Deploy the software code files to the target environment through installation, configuration and startup.
[0129] Step S94 includes the preparation phase, installation phase, configuration phase, startup phase and subsequent steps; the preparation phase includes collecting necessary files and dependencies, understanding the target environment, such as being familiar with the target environment's hardware and software configuration, network configuration, etc.; the installation phase includes operating system-level software packages, programming language dependency management tools, etc., copying the software code files to the specified directory of the target environment. If the software is packaged and released (such as Java's JAR package, Python's wheel package, etc.), the packaged files are directly deployed; then, according to the specific needs of the target environment, modify the software's configuration files, which usually include database connection information, network settings, log levels, etc.; during the configuration phase, it is necessary to configure the environment variables to ensure that the software can correctly find its dependencies and configuration files; for database configuration, create the necessary database and table structures, import any any initial data or configuration database connection information, as well as network configuration such as configuring firewall rules to allow network communication required by the software; during the startup phase, start the software with appropriate commands or scripts to ensure that no errors occur; and verify the installation, such as checking the software's log files to ensure that there are no errors or warning messages, and verifying whether the software works as expected by accessing the software's interface or using command line tools. If possible, performance testing is also required to ensure that the software has sufficient performance and stability in the target environment; subsequent steps involve document updates, such as updating any related deployment documents or guides to reflect changes and precautions for this deployment; monitoring and maintenance, such as setting up monitoring tools to track the software's operating status and performance indicators, and regularly updating the software to fix vulnerabilities or add new features; user training and support, such as providing necessary training and support to ensure that they can use the software correctly.
[0130] After introducing the method for automatically generating software codes according to the above embodiment, a system for generating software codes according to another embodiment will be described next.
[0131] A system for automatically generating software code includes a menu table, a field table and a software generation tool. The menu table has column title content, module title content and module table name content. In the column title content, multiple column titles are grouped together and correspond to a module title. The module title corresponds to the module table name one by one. The field table has custom field content and module table name content. The custom field corresponds to the module table name. The menu table and the field table are linked to realize the traversal of the menu table and the field table.
[0132] The data link model uses a built-in English-Chinese dictionary to decompose sentences, decomposing the sentences in the menu table and field table into words and graphic icons to achieve traversal of the menu table and field table; the data link model automatically generates code based on the imported module menus and field definitions.
[0133] Among them, the software generation tool can be a large model of a digital factory for software development, or an open source automation server (such as Jenkins), or a built-in continuous integration and continuous delivery tool (such as GitLab CI / CD), or a continuous integration and continuous deployment server software (such as Bamboo).
[0134] The above-mentioned system for automatically generating software code utilizes a software generation tool to implement the above-mentioned method for automatically generating software code. The principle and technical effect of implementing the automatic generation of software code are similar and will not be repeated here.
[0135] Fig. 9 This is a schematic diagram of a computer device 1 provided in an embodiment of the present application. The device can be integrated into a terminal device or a chip of a terminal device. The terminal can be a computer device 1 with a data processing function.
[0136] The computer device 1 includes a processor 2 , a storage medium 3 and a bus 4 .
[0137] The storage medium 3 stores program instructions executable by the processor 2. When the computer device 1 is running, the processor 2 communicates with the storage medium 3 via the bus 4, and the processor 2 executes the program instructions to execute the above method or system embodiment. The specific implementation method and technical effect are similar and will not be repeated here.
[0138] Optionally, the present invention also provides a program product, such as a computer-readable storage medium, comprising a program, which is used to execute the above method embodiment when executed by a processor.
[0139] In addition, each functional unit for automatically generating software code in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0140] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.
[0141] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A method for automatically generating software code, characterized in that: The following steps are involved: S11, setting a menu table, a field table and a traversal relationship between tables, wherein the menu table has column title content, module title content and module table name content, wherein multiple column titles in the column title content are grouped together and correspond to a module title, and the module title corresponds to the module table name one by one; The field table has custom field content and module table name content, and the custom field corresponds to the module table name through the table name; The inter-table traversal relationship is used to realize the traversal of the menu table and the field table; S12, importing the menu table, field table and traversal relationship into the data link model, performing sentence decomposition using the built-in English-Chinese dictionary of the data link model, decomposing the sentences in the menu table and field table into words and graphic icons, and realizing traversal of the menu table and field table; S13. The data link model automatically generates code based on the imported module menu and field definitions.
2. The method for automatically generating software code according to claim 1, characterized in that: The menu table and field table are Excel tables, Google Sheets, or LibreOffice Calc.
3. The method for automatically generating software code according to claim 1, characterized in that: The specific steps for implementing table traversal are as follows: The statements on the menu table and the field table are decomposed into data elements, each of which corresponds to a data element ID. The data element ID is used as a data bridge to perform one-to-one or one-to-many traversal management between tables to form a traversal data chain.
4. The method for automatically generating software code according to claim 1, characterized in that: The data link model is a large model of a digital factory developed by software, or an open source automation server, or a built-in continuous integration and continuous delivery tool, or a continuous integration and continuous deployment server software.
5. The method for automatically generating software code according to claim 4, characterized in that: When software is used to develop a large digital factory model, the steps for automatically generating software code are as follows: S51, software development digital factory large model preset table management function, preset field management function, preset method interface function, preset customized form function and preset button management function, the preset function has software data content corresponding to the semantic content in the menu table and field table; S52, importing the user's menu table and field table and the inter-table traversal relationship into the software development digital factory big model, wherein the menu table and field table contain the menu module content input by the user; S53, performing semantic parsing and table traversal according to the menu modules in the menu table and the field table, and generating target software data content using preset functions, wherein the target software data content includes functional requirements, business logic, database structure, and user interface layout; S54, automatically calling a code generator and a model conversion tool according to the target software data content generated by semantic analysis, compiling the code adapted to the menu module, and generating the logical structure, database model and user interface of the software; S55, verifying the logical structure, data model and user interface of the generated software according to the inspection rules and inspection standards preset in the software development digital factory macro model; if the verification fails, repeating S51 to S54 until the verification passes; S56. Output compiled code, generate documentation, and prepare deployment packages.
6. The method for automatically generating software code according to claim 1, characterized in that: The method for implementing the menu module in the menu table is: S61, designing a module menu matching the content of the menu table according to the business logic and menu items in the menu table; S62, all module menus form a menu module of a menu table; S63, introducing the designed menu module into the menu table through the import statement.
7. The method for automatically generating software code according to claim 1, characterized in that: In step S53, the semantic analysis process includes preprocessing, information identification, and data mapping steps, specifically: Get the content in the menu module, pre-process and clean invalid or redundant data and handle missing values; According to the preset table management function and the preset field management function, the data information in the menu table and the preset fields is automatically identified, and the data in the menu table is converted into the fields of the database table or the cell values are converted into the properties of the user interface controls.
8. The method for automatically generating software code according to claim 1, characterized in that: In step S54, the process of generating a software structure from the generated target software data content includes the steps of generating a business logic structure, generating a database model, and generating a user interface, specifically: According to the business logic and the database architecture, the preset table management function, the preset field management function, the customized form function and the button management function are adopted, the preset method interface function, the code generator and the database architecture are called to automatically generate the logical structure and database model of the software, and the user interface framework interface is called to automatically generate the user interface.
9. The method for automatically generating software code according to claim 1, characterized in that: In step S56, the process of outputting the target software file includes code output, documentation and deployment steps, specifically: S91, compile the generated code file into an executable file or a library; S92, submitting the version control system of the executable file or library to Git for tracking changes or collaboration; S93. Generate software development documents, which include API documents and user manuals; S94. Deploy the software code files to the target environment through installation, configuration and startup.
10. A system for automatically generating software code, characterized in that: It includes a menu table, a field table and a software generation tool. The menu table has column title content, module title content and module table name content. In the column title content, multiple column titles are grouped together and correspond to a module title. The module title corresponds to the module table name one by one. The field table has custom field content and module table name content. The custom field corresponds to the module table name. The menu table and the field table are linked to realize the traversal of the menu table and the field table. The data link model uses a large English-Chinese dictionary to decompose sentences, decomposing the sentences in the menu table and field table into words and graphic icons to achieve traversal of the menu table and field table; The data link model automatically generates code based on the imported module menu and field definitions.
Citation Information
Patent Citations
Method and apparatus for automatically generating software item encoding file by metadata
CN105224377A
Zero-code rapid software development method and system, medium and equipment
CN113590102A
Method for quickly configuring table fields, and page field generation mode and system
CN116956845A
Software system code automatic generation method and device, equipment and storage medium
CN118963765A
Cited By
Material purchasing business behavior management system
CN120543088A
A material procurement business behavior management system
CN120543088B
Register and memory operation code unified generation method
CN121166094A