Code file generation method and device, electronic equipment and storage medium

By receiving code file generation requests, determining the basic configuration information and obtaining code file configuration information, and automatically generating code files corresponding to the data table, solving the problems of low code development efficiency and inconsistency of code, and achieving efficient and unified code file generation.

CN119759410APending Publication Date: 2025-04-04RUN TECH CO LTD BEIJING
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411971084.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

During the code development process, there are a large number of duplicate code development, resulting in low development efficiency, and poor communication between front and back personnel may lead to code errors and increase development error rate. At the same time, the code developed by different personnel is inconsistent, resulting in inconsistent page display effect and requires rework and modification.

Method used

By receiving code file generation requests, the basic configuration information is determined, including the table name and data item information of the data table, the code file configuration information is obtained, including the template file, and the code file corresponding to the data table is generated based on this information, and packaged it into a target code file package.

Benefits of technology

It realizes automatic generation of code files, reduces the repetitive workload of code development, does not require relevant operators to have code development experience, improves code development efficiency, and solves the problems of code inconsistency and inconsistent display effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759410A_ABST
    Figure CN119759410A_ABST
Patent Text Reader

Abstract

The invention discloses a code file generation method and device, electronic equipment and a storage medium. Comprising the steps that a code file generation request is received, basic configuration information is determined based on the code file generation request, and the basic configuration information comprises the table name of at least one data table and data item information corresponding to each data table; code file configuration information is obtained, and the code file configuration information comprises at least one template file; for any data table in the basic configuration information, generating at least one code file corresponding to the data table based on the at least one template file and a table name and data item information corresponding to the data table; and generating a target code file package based on the at least one code file corresponding to each data table. According to the scheme, the at least one code file is automatically generated according to the information in the code file generation request and the at least one code template file, the code generation method simple in operation is achieved, the repeated workload of code development is reduced, and the code development efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a code file generation method, device, electronic device and storage medium. Background Art

[0002] In the process of code development, there will be a lot of repeated code development, especially for business systems or management systems. There are a large number of pages with the same layout in the system, which need to be developed one by one by developers. There is a lot of repetitive work, which makes the development efficiency low. Moreover, if there is a problem in the communication between the front-end and back-end personnel during the development process, the front-end and back-end codes developed cannot interact, which increases the error rate of code development. For front-end personnel who do not understand back-end development, they cannot generate front-end code files independently. In addition, for the same system, there will be inconsistencies in the codes developed by different personnel, which will lead to the corresponding visualization page display effect is not uniform, and rework and modification are required, which reduces development efficiency. Summary of the invention

[0003] The present invention provides a code file generation method, device, electronic device and storage medium to solve the problem of low code development efficiency.

[0004] According to one aspect of the present invention, there is provided a method for generating a code file, comprising:

[0005] receiving a code file generation request, and determining basic configuration information based on the code file generation request, wherein the basic configuration information includes a table name of at least one data table and data item information corresponding to each data table;

[0006] Obtaining code file configuration information, wherein the code file configuration information includes at least one template file;

[0007] For any data table in the basic configuration information, generating at least one code file corresponding to the data table based on at least one template file and the table name and data item information corresponding to the data table;

[0008] A target code file package is generated based on at least one code file corresponding to each data table.

[0009] Optionally, determining basic configuration information based on the code file generation request includes: parsing the code file generation request, extracting data objects in the code file generation request, and determining basic configuration information based on the data objects.

[0010] Optionally, determining basic configuration information based on the data object includes: if the data object is an Excel file, determining the basic configuration information based on the Excel file; if the data object is a data set name, obtaining corresponding basic configuration information based on the data set name.

[0011] Optionally, basic configuration information is determined based on an Excel file, including: traversing the data table information in a specified sheet page in the Excel file to obtain at least one table name; for any table name, obtaining data item information in a matching sheet page in the Excel file based on the table name, storing each table name and the corresponding data item information in a pre-declared collection object to obtain basic configuration information.

[0012] Optionally, at least one code file corresponding to a data table is generated based on at least one template file and the table name and data item information corresponding to the data table, including: for each template file, calling a template rendering function, rendering the template file and the data item information corresponding to the data table based on the template rendering function to obtain a rendered string, and generating a code file corresponding to the template file based on the rendered string; and setting the file name of the code file corresponding to the template file based on the table name corresponding to the data table to obtain the code file of the data table.

[0013] Optionally, the basic configuration information also includes style configuration information corresponding to each data item information; after generating at least one code file corresponding to the data table based on at least one template file and the table name and data item information corresponding to the data table, it also includes: matching the statements in the code file with the data item information to obtain the style configuration information corresponding to the successfully matched data item information; updating the corresponding style configuration information in the code file based on the style configuration information corresponding to the successfully matched data item information.

[0014] Optionally, a target code file package is generated based on at least one code file corresponding to each data table, including: creating a corresponding file root directory based on each data table, adding at least one code file corresponding to each data table to the corresponding file root directory, and obtaining the target code file package.

[0015] According to another aspect of the present invention, there is provided a code file generating method, comprising:

[0016] Displaying a visualization operation page, and generating a corresponding business request in response to a user's operation on the visualization operation page, wherein the business request includes an address of a target server and business data;

[0017] Sending the service request to the target server, so that the target server generates corresponding feedback data according to the service data in the service request, and returns the feedback data, wherein the feedback data includes the target code file package;

[0018] Receive feedback data and display it on the visual operation page.

[0019] According to another aspect of the present invention, there is provided a code file generating device, comprising:

[0020] A basic configuration information determination module, configured to receive a code file generation request, and determine basic configuration information based on the code file generation request, wherein the basic configuration information includes a table name of at least one data table and data item information corresponding to each data table;

[0021] A code file configuration information acquisition module, used to acquire code file configuration information, wherein the code file configuration information includes at least one template file;

[0022] A code file generation module, used for generating, for any data table in the basic configuration information, at least one code file corresponding to the data table based on at least one template file and the table name and data item information corresponding to the data table;

[0023] The target code file package generating module is used to generate a target code file package based on at least one code file corresponding to each data table.

[0024] According to another aspect of the present invention, there is provided a code file generating device, comprising:

[0025] A business request generation module, used to display a visual operation page, and generate a corresponding business request in response to a user's operation on the visual operation page, wherein the business request includes the address of the target server and business data;

[0026] A business request sending module, used to send a business request to a target server, so that the target server generates corresponding feedback data according to the business data in the business request, and returns the feedback data, wherein the feedback data includes a target code file package;

[0027] The feedback data display module is used to receive feedback data and display the feedback data on a visual operation page.

[0028] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0029] at least one processor; and

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

[0031] The memory stores a computer program that can be executed by at least one processor. The computer program is executed by at least one processor so that the at least one processor can execute the code file generation method of any embodiment of the present invention.

[0032] According to another aspect of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the code file generation method of any embodiment of the present invention when executed.

[0033] The technical solution of the embodiment of the present invention receives a code file generation request, determines basic configuration information based on the code file generation request, wherein the basic configuration information includes the table name of at least one data table and data item information corresponding to each data table; obtains code file configuration information, wherein the code file configuration information includes at least one template file; for any data table in the basic configuration information, generates at least one code file corresponding to the data table based on at least one template file and the table name and data item information corresponding to the data table; generates a target code file package based on at least one code file corresponding to each data table. This solution automatically generates at least one code file based on the information in the code file generation request and at least one code template file, that is, automatically generates a code file corresponding to each data table, realizes a code file generation method with simple operation, reduces the repetitive workload of code development, does not require relevant operators to have relevant experience in code development, and improves code development efficiency.

[0034] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0036] Figure 1 is a flow chart of a code file generation method provided by Embodiment 1 of the present invention;

[0037] Figure 2 is a flow chart of a code file generation method provided by Embodiment 2 of the present invention;

[0038] Figure 3 It is a structural schematic diagram of a code file generating device provided by Embodiment 3 of the present invention;

[0039] Figure 4 It is a structural schematic diagram of a code file generating device provided by Embodiment 4 of the present invention;

[0040] Figure 5The present invention is a schematic diagram of the structure of an electronic device for implementing the code file generation method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0041] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme 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. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0042] It should be noted that 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.

[0043] Embodiment 1

[0044] Figure 1 This is a flowchart of a code file generation method provided by Embodiment 1 of the present invention. This embodiment is applicable to the case of automatically generating code files. The method can be executed by a code file generation device. The code file generation device can be implemented in the form of hardware and / or software. The code file generation device can be configured in a server and an electronic device provided by this solution. Figure 1 As shown, the method includes:

[0045] S110: Receive a code file generation request, and determine basic configuration information based on the code file generation request, wherein the basic configuration information includes a table name of at least one data table and data item information corresponding to each data table.

[0046] Among them, the code file generation request can be specifically understood as a request for generating a code file, which is a request sent by the data acquisition end to the data generation end. In this embodiment, the code file generation request specifically refers to a request for obtaining a code file sent by the client to the server, and the server receives the code generation file request. The basic configuration information required for generating a code file is stored in the code file request. The basic configuration information includes but is not limited to the table name of at least one data table and the data item information corresponding to each data table. The data table refers to the data table required for generating a code file. Each data table includes multiple data item information. The table name of the data table and the corresponding data item information are all corresponding to the data table in the database, so that the corresponding data table can be edited or imported at the front end, and the corresponding data table and data table related information can be obtained without accessing the back-end database. It should be noted that the code file generation request can store multiple data table information required for generating multiple code files, so that multiple code files can be generated in batches, which helps to improve the efficiency of code file generation.

[0047] Specifically, a pre-built detection method can be periodically executed through a set scheduled task to detect whether a code file generation request is received. When a code file generation request is detected, a pre-built data processing function is called to parse the code file generation request to obtain basic configuration information stored in the code file generation request, wherein the basic configuration information includes the table name of at least one data table and data item information corresponding to each data table.

[0048] Exemplarily, an interface monitoring method is constructed through the Koa framework, and a specific port (such as 3000) is monitored by opening the interface monitoring method in real time or opening the interface monitoring method at a scheduled time, and a code file generation request sent by a browser on the client is received, and the code file generation request can be an HTTP request. When a code file generation request is monitored, a pre-built data processing function is called to parse the data in the code file generation request to obtain basic configuration information.

[0049] Optionally, determining basic configuration information based on the code file generation request includes: parsing the code file generation request, extracting data objects in the code file generation request, and determining basic configuration information based on the data objects.

[0050] The data object specifically represents the data stored in the code file generation request, and the data object includes but is not limited to the Excel file and the data set name.

[0051] Specifically, the code file generation request is parsed by calling a data processing function to obtain a data object in the code file generation request, and then the basic configuration information is determined according to the data object.

[0052] Optionally, determining basic configuration information based on the data object includes: if the data object is an Excel file, determining the basic configuration information based on the Excel file; if the data object is a data set name, obtaining corresponding basic configuration information based on the data set name.

[0053] Specifically, different data objects correspond to different methods for determining basic configuration information. If the data object in the code file generation request is parsed as an Excel file, the Excel file processing method for processing the Excel file is called to read the basic configuration information from the Excel file. If the data object in the code file generation request is parsed as a data set name, the corresponding data set is matched in the data storage space in the server according to the data set name, and the corresponding basic configuration information is read from the data set. It should be noted that the data set stored in the data storage space in the server can receive a data modification request sent by the client for modification. The data modification request includes the data required to modify the data set to ensure that the data set stored in the data storage space in the server is the latest and most complete data set.

[0054] Optionally, basic configuration information is determined based on an Excel file, including: traversing the data table information in a specified sheet page in the Excel file to obtain at least one table name; for any table name, obtaining data item information in a matching sheet page in the Excel file based on the table name, storing each table name and the corresponding data item information in a pre-declared collection object to obtain basic configuration information.

[0055] The Excel file in the code file generation request includes multiple sheet pages, and the specified sheet page stores multiple data table information required for the code file to be generated, the data table information includes but is not limited to the data table name and the data table attribute information, and the data table attribute information includes but is not limited to the table remark information, table alias and storage folder. The data item information corresponding to any data table is set to the corresponding sheet page for storage, and the name of the sheet page storing the data item information corresponds to the table name of the data table stored in the specified sheet page.

[0056] Specifically, a pre-built Excel file reading method is called to read the Excel file, and the data table information in the specified sheet page in the Excel file is traversed to obtain at least one table name, and then the data item information in the corresponding sheet page is read according to the at least one table name read, and the read table name and the corresponding data item information are stored in a pre-declared data collection object in turn, and the data in the obtained data collection object is used as the basic configuration information. For example, the pre-declared data collection object can be named tableData, and the data corresponding to tableData is [{table name: {data item array: []}}], which is a nested data object collection. After storing the data of all sheet pages in the Excel file in tableData, tableData can be stored in the specified storage space in the server to facilitate subsequent direct retrieval.

[0057] In this embodiment, the data required to generate the code file can be stored in an Excel file to reduce the number of files, and then the data in the Excel file can be obtained by reading multiple sheets in the Excel file and stored in a data set, which not only ensures the integrity of the data but also reduces the number of files.

[0058] S120: Obtain code file configuration information, where the code file configuration information includes at least one template file.

[0059] Among them, the code file configuration information can be specifically understood as the configuration information required to generate the code text. In this embodiment, it specifically refers to the template file for generating the code file. The template files required to generate different types of code files are different. The types of code files include but are not limited to vue files and java files. The code file configuration information can be pre-configured in the server to determine the need to generate a code file of one file type or multiple file types. Each file type is set with a corresponding template file, and one or more template files are stored in the code file configuration information. Specifically, the code file configuration information is obtained from the storage space or configuration file, and the template files in the code file configuration information are read. Each template file will be used to generate a code file corresponding to the code file generation request.

[0060] In this embodiment, multiple template files are stored in the code file configuration information for generating multiple code files, so as to improve the flexibility and diversity of code file generation and meet the demand for generating multiple code files.

[0061] S130. For any data table in the basic configuration information, generate at least one code file corresponding to the data table based on at least one template file and the table name and data item information corresponding to the data table.

[0062] Specifically, the basic configuration information is traversed, and each data table and the corresponding data item information are rendered according to at least one template file by calling the pre-built code file generation function to generate at least one code file corresponding to each data table. Exemplarily, for each data table, the template processing function is called to render the template through the art-template template engine, and each data table and the corresponding data item information are rendered according to at least one template file to generate at least one code file corresponding to each data table.

[0063] Optionally, at least one code file corresponding to a data table is generated based on at least one template file and the table name and data item information corresponding to the data table, including: for each template file, calling a template rendering function, rendering the template file and the data item information corresponding to the data table based on the template rendering function to obtain a rendered string, and generating a code file corresponding to the template file based on the rendered string; and setting the file name of the code file corresponding to the template file based on the table name corresponding to the data table to obtain the code file of the data table.

[0064] Specifically, for each template file, the template rendering function is called, and the template file and the data item information corresponding to the data table are rendered through the template rendering function. The data table and the data item information in the data table are used as input parameters of the template rendering function. After being processed by the template rendering function, the rendered string is obtained, and a file is created through the File object, and the file is created in the preset file directory in the server, and the rendered string is written to the created file, so as to obtain the code file corresponding to the template file. According to the above method, the code files corresponding to multiple template files are obtained. The file name of each code file can be set according to the table name of the corresponding data table. It should be noted that if a file name with the same name as the table name already exists in the preset file directory, the content in the file corresponding to the file name is cleared, and the rendered string is written to the file.

[0065] S140: Generate a target code file package based on at least one code file corresponding to each data table.

[0066] Specifically, after obtaining at least one code file corresponding to each data table, each code file is added to a compressed folder to obtain a target code file package.

[0067] Optionally, a target code file package is generated based on at least one code file corresponding to each data table, including: creating a corresponding file root directory based on each data table, adding at least one code file corresponding to each data table to the corresponding file root directory, and obtaining the target code file package.

[0068] Specifically, a corresponding file root directory is created according to the table name corresponding to each data table, at least one code file corresponding to each data table is added to the corresponding file root directory, and then the file root directory and the corresponding code file are written into a compressed package to obtain a target code file package. Exemplarily, the generated code file path is found through a pre-built path function, and then a writable file stream is created using a file stream creation function (such as createWriteStream function), a zip file is created using an archiver object, and then the directory function is called to add each code file to the created zip file, generating a zip compressed package stream, that is, obtaining the target code file package, and then closing the file stream, and finally returning the file stream information.

[0069] On the basis of the above embodiment, the basic configuration information also includes style configuration information corresponding to each data item information; after generating at least one code file corresponding to the data table based on at least one template file and the table name and data item information corresponding to the data table, it also includes: matching the statements in the code file with the data item information to obtain the style configuration information corresponding to the successfully matched data item information; updating the corresponding style configuration information in the code file based on the style configuration information corresponding to the successfully matched data item information.

[0070] Among them, style configuration information specifically refers to the appearance and layout of a web page, and is a set of attributes used to define the size, color, font and other visual effects of web page elements. In this embodiment, the style configuration information includes the style information required for the code file generation process, which is used to perform style rendering on each element in the code file to obtain a code file that meets the style requirements. The style configuration information can be added to the basic configuration information.

[0071] Specifically, after generating at least one code file corresponding to a data table based on at least one template file and the table name and data item information corresponding to the data table, if the style configuration information in the basic configuration information is obtained, the data items of each statement in the code file are matched with the style configuration information; if the data item information is matched in the style configuration information, the corresponding style configuration information in the code file is updated according to the style configuration information corresponding to the successfully matched data item information; specifically, the style of the data item in the code file is updated to the style configuration information of the successfully matched data item, thereby obtaining a code file that meets the style requirements.

[0072] In this embodiment, by setting style configuration information in the basic configuration information and rendering the style of the data items in the code file according to the style configuration information, the data items in the code file can be displayed according to the style in the style configuration information, thereby improving the uniformity of the display page at the visual effect level and improving the user experience.

[0073] The technical solution of this embodiment receives a code file generation request, determines basic configuration information based on the code file generation request, wherein the basic configuration information includes the table name of at least one data table and data item information corresponding to each data table; obtains code file configuration information, wherein the code file configuration information includes at least one template file; for any data table in the basic configuration information, generates at least one code file corresponding to the data table based on at least one template file and the table name and data item information corresponding to the data table; generates a target code file package based on at least one code file corresponding to each data table. This solution automatically generates at least one code file based on the information in the code file generation request and at least one code template file, that is, automatically generates a code file corresponding to each data table, realizes a code file generation method with simple operation, reduces the repetitive workload of code development, and does not require relevant operators to have relevant experience in code development, thereby improving code development efficiency.

[0074] Embodiment 2

[0075] Figure 2 This is a flowchart of a code file generation method provided by Embodiment 2 of the present invention. This embodiment is applicable to the case of automatically generating code files. This method can be executed by a code file generation device. The code file generation device can be implemented in the form of hardware and / or software. The code file generation device can be configured in the client and the electronic device provided by this solution. Figure 2 As shown, the method includes:

[0076] S210: Display a visualization operation page, and generate a corresponding business request in response to the user's operation on the visualization operation page, wherein the business request includes the address of the target server and business data.

[0077] Among them, the visual operation page specifically refers to the page displayed in the browser of the client. The user can log in to the visual operation page on any terminal device with the browser installed, regardless of the geographical location and the number of people. In the visual operation page, multiple operable areas are set, including a functional area and a data display area. The functional area is provided with multiple function buttons, including but not limited to a file upload button, an edit button and a code generation button. The data display area can display the data received by the browser. Preferably, the page display form of the data display area can be a nested table form, with the basic information and folding button of the record displayed on the outermost layer. The data details in the corresponding record can be viewed by clicking the folding button. An edit button is also set in the subpage corresponding to the data details. After the user clicks the edit button here, the editable content of the corresponding data details will be displayed in the form of a pop-up window. The user can edit and save the editable content to ensure the consistency of the data displayed on the visual operation page with the data stored in the backend database. The business request specifically refers to the request generated according to the user operation, including but not limited to a code file generation request, a file upload request and a data update request.

[0078] Specifically, the user can log in to the visualization operation page through the address corresponding to the visualization operation page. When the visualization operation page is successfully logged in, the visualization operation page is displayed on the client, and the user can perform operations on the visualization operation page. In response to the user's operations on the visualization operation page, the business request generation method is called, and the corresponding business data and target server address are obtained according to the performed operations. The business request generation method creates an HTTP request according to the business data and the target server address to obtain the corresponding business request, wherein the business request includes the address of the target server and the business data.

[0079] Exemplarily, the user configures a local file address on the visual operation page, the local file can be an Excel file, and obtains business data from the local file address. Alternatively, the user can download a file template on the visual operation page, edit the business data in the file template, and then use the business request generation method to create an HTTP request based on the obtained business data and the target server address, and send the request to the target server. It should be noted that in order to improve the efficiency of request transmission, Excel can be converted into a file stream and stored in the business request.

[0080] S220: Send the service request to the target server, so that the target server generates corresponding feedback data according to the service data in the service request, and returns the feedback data, wherein the feedback data includes a target code file package.

[0081] Specifically, the client sends a service request to the target server, and the target server processes data according to the received service request, and adds the feedback data obtained after processing the service request to the request return body, and returns it to the request sender. The feedback data includes but is not limited to the target code file package. It should be noted that the feedback data is specifically determined according to the data in the service request. If the service data in the service request is the data required to generate the code file, the feedback data is the target code file package.

[0082] In this embodiment, the business request can also be a request to obtain a data set, which is used to send a corresponding request to the server, obtain the corresponding data set from the server, and fill the data set as feedback data into the request return body and return it to the request sender.

[0083] S230: receiving feedback data, and displaying the feedback data on a visual operation page.

[0084] Specifically, when the business request sender receives feedback data corresponding to the business request, a prompt message indicating that the feedback data is successfully received is displayed on the visualization operation page, the feedback data is downloaded through the download button displayed on the visualization operation page, and the downloaded feedback data is parsed to display the feedback data in the data display area of ​​the visualization operation page.

[0085] In this embodiment, when the received feedback data is a target code file package, the code file can be stored in a corresponding project, and then the program in the code file can be directly run to view the execution effect corresponding to the code file.

[0086] The technical solution of this embodiment generates a corresponding business request in response to the user's operation on the visual operation page by displaying a visual operation page, wherein the business request includes the address and business data of the target server; sends the business request to the target server so that the target server generates corresponding feedback data according to the business data in the business request and returns the feedback data, wherein the feedback data includes the target code file package; receives the feedback data and displays the feedback data on the visual operation page. This solution generates business requests corresponding to each operation by operating on the visual operation page, wherein the business request includes the address and business data of the target server, so that the user can send a business request to the target server address and obtain the feedback data corresponding to the business request, wherein the feedback data includes the target code file package, and then display the code file and the corresponding code content in the target code file package on the visual operation page, so that the user can send a business request corresponding to the code file by logging in to the visual operation page to obtain the target code file package, without being affected by the geographical location and the number of personnel, and does not require the user to have code development technology, which greatly improves the simplicity and operability of generating code files, thereby improving the efficiency of generating code files.

[0087] Embodiment 3

[0088] Figure 3 Schematic diagram of the structure of a code file generating device provided by the third embodiment of the present invention. Figure 3 As shown, the device comprises:

[0089] A basic configuration information determination module 310 is used to receive a code file generation request and determine basic configuration information based on the code file generation request, wherein the basic configuration information includes a table name of at least one data table and data item information corresponding to each data table;

[0090] A code file configuration information acquisition module 320, used to acquire code file configuration information, wherein the code file configuration information includes at least one template file;

[0091] A code file generating module 330, configured to generate, for any data table in the basic configuration information, at least one code file corresponding to the data table based on at least one template file and the table name and data item information corresponding to the data table;

[0092] The target code file package generating module 340 is used to generate a target code file package based on at least one code file corresponding to each data table.

[0093] The technical solution of this embodiment receives a code file generation request through a basic configuration information determination module, determines basic configuration information based on the code file generation request, wherein the basic configuration information includes the table name of at least one data table and the data item information corresponding to each data table; the code file configuration information acquisition module acquires the code file configuration information, wherein the code file configuration information includes at least one template file; the code file generation module generates at least one code file corresponding to any data table in the basic configuration information based on at least one template file and the table name and data item information corresponding to the data table; the target code file package generation module generates a target code file package based on at least one code file corresponding to each data table. This solution automatically generates at least one code file according to the information in the code file generation request and at least one code template file, that is, automatically generates a code file corresponding to each data table, realizes a code file generation method with simple operation, reduces the repetitive workload of code development, and does not require relevant operators to have relevant experience in code development, thereby improving code development efficiency.

[0094] Based on the above embodiment, optionally, the basic configuration information determination module 310 includes a basic configuration information determination unit; the basic configuration information determination unit is used to parse the code file generation request, extract the data object in the code file generation request, and determine the basic configuration information based on the data object.

[0095] The basic configuration information determining unit is specifically used to determine the basic configuration information based on the Excel file if the data object is an Excel file; and to obtain the corresponding basic configuration information based on the data set name if the data object is a data set name.

[0096] The basic configuration information determination unit is also specifically used to traverse the data table information in the specified sheet page in the Excel file to obtain at least one table name; for any table name, based on the table name, obtain the data item information in the matching sheet page in the Excel file, store each table name and the corresponding data item information in a pre-declared collection object, and obtain the basic configuration information.

[0097] Optionally, the code file generation module 330 is specifically used to call the template rendering function for each template file, render the data item information corresponding to the template file and the data table based on the template rendering function, obtain the rendered string, and generate the code file corresponding to the template file based on the rendered string; and set the file name of the code file corresponding to the template file based on the table name corresponding to the data table to obtain the code file of the data table.

[0098] Optionally, the basic configuration information also includes style configuration information corresponding to each data item information; after generating at least one code file corresponding to the data table based on at least one template file and the table name and data item information corresponding to the data table, the device is also used to match the statements in the code file with the data item information, and obtain the style configuration information corresponding to the successfully matched data item information; based on the style configuration information corresponding to the successfully matched data item information, the corresponding style configuration information in the code file is updated.

[0099] Optionally, the target code file package generation module 340 is specifically used to create a corresponding file root directory based on each data table, add at least one code file corresponding to each data table to the corresponding file root directory, and obtain the target code file package.

[0100] The code file generating device provided in the embodiment of the present invention can execute the code file generating method provided in the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method.

[0101] Embodiment 4

[0102] Figure 4 Schematic diagram of the structure of a code file generating device provided by the fourth embodiment of the present invention. Figure 4 As shown, the device comprises:

[0103] The business request generation module 410 is used to display the visual operation page and generate a corresponding business request in response to the user's operation on the visual operation page, wherein the business request includes the address of the target server and business data;

[0104] The business request sending module 420 is used to send the business request to the target server, so that the target server generates corresponding feedback data according to the business data in the business request and returns the feedback data, wherein the feedback data includes a target code file package;

[0105] The feedback data display module 430 is used to receive feedback data and display the feedback data on a visual operation page.

[0106] The technical solution of this embodiment is to display the visual operation page through the business request generation module, and generate the corresponding business request in response to the user's operation on the visual operation page, wherein the business request includes the address and business data of the target server; the business request sending module sends the business request to the target server, so that the target server generates corresponding feedback data according to the business data in the business request, and returns the feedback data, wherein the feedback data includes the target code file package; the feedback data display module receives the feedback data and displays the feedback data on the visual operation page. This solution generates business requests corresponding to each operation by operating on the visual operation page, and the business request includes the address and business data of the target server, so that the user can send the business request to the target server address and obtain the feedback data corresponding to the business request, and the feedback data includes the target code file package, and then display the code file and the corresponding code content in the target code file package on the visual operation page, so that the user can send the business request corresponding to the code file by logging in to the visual operation page to obtain the target code file package, without being affected by the geographical location and the number of personnel, and does not require the user to have code development technology, which greatly improves the simplicity and operability of generating code files, thereby improving the efficiency of generating code files.

[0107] The code file generating device provided in the embodiment of the present invention can execute the code file generating method provided in the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method.

[0108] Embodiment 5

[0109] Figure 5 1 is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0110] like Figure 5As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0111] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0112] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a code file generation method.

[0113] In some embodiments, the code file generation method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the code file generation method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the code file generation method in any other appropriate manner (e.g., by means of firmware).

[0114] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0115] The computer program for implementing the code file generation method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0116] Embodiment 6

[0117] Embodiment 6 of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to cause a processor to execute a code file generation method, the method comprising:

[0118] receiving a code file generation request, and determining basic configuration information based on the code file generation request, wherein the basic configuration information includes a table name of at least one data table and data item information corresponding to each data table;

[0119] Obtaining code file configuration information, wherein the code file configuration information includes at least one template file;

[0120] For any data table in the basic configuration information, generating at least one code file corresponding to the data table based on at least one template file and the table name and data item information corresponding to the data table;

[0121] A target code file package is generated based on at least one code file corresponding to each data table.

[0122] In this embodiment, the computer instructions are also used to cause the processor to execute another code file generation method, which includes:

[0123] Displaying a visualization operation page, and generating a corresponding business request in response to a user's operation on the visualization operation page, wherein the business request includes an address of a target server and business data;

[0124] Sending the service request to the target server, so that the target server generates corresponding feedback data according to the service data in the service request, and returns the feedback data, wherein the feedback data includes the target code file package;

[0125] Receive feedback data and display it on the visual operation page.

[0126] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0127] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0128] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0129] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0130] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0131] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A code file generation method, characterized in that: include: receiving a code file generation request, and determining basic configuration information based on the code file generation request, wherein the basic configuration information includes a table name of at least one data table and data item information corresponding to each of the data tables; Acquire code file configuration information, wherein the code file configuration information includes at least one template file; For any data table in the basic configuration information, generating at least one code file corresponding to the data table based on the at least one template file and the table name and data item information corresponding to the data table; A target code file package is generated based on at least one code file corresponding to each of the data tables.

2. The method according to claim 1, characterized in that The determining basic configuration information based on the code file generation request includes: The code file generation request is parsed, a data object in the code file generation request is extracted, and basic configuration information is determined based on the data object.

3. The method according to claim 2, characterized in that The determining basic configuration information based on the data object includes: If the data object is an Excel file, determining the basic configuration information based on the Excel file; If the data object is a data set name, corresponding basic configuration information is obtained based on the data set name.

4. The method according to claim 3, characterized in that The determining the basic configuration information based on the Excel file includes: Traverse the data table information in the specified sheet page in the Excel file to obtain at least one table name; For any of the table names, the data item information in the matching sheet page is obtained in the Excel file based on the table name, and each of the table names and the corresponding data item information is stored in a pre-declared collection object to obtain the basic configuration information.

5. The method according to claim 1, characterized in that The generating at least one code file corresponding to the data table based on the at least one template file and the table name and data item information corresponding to the data table comprises: For each of the template files, calling a template rendering function, rendering the template file and the data item information corresponding to the data table based on the template rendering function to obtain a rendered string, and generating a code file corresponding to the template file based on the rendered string; And based on the table name corresponding to the data table, the file name of the code file corresponding to the template file is set to obtain the code file of the data table.

6. The method according to claim 1, characterized in that The basic configuration information also includes style configuration information corresponding to each of the data item information; After generating at least one code file corresponding to the data table based on the at least one template file and the table name and data item information corresponding to the data table, the method further includes: Match the statements in the code file with the data item information to obtain style configuration information corresponding to the successfully matched data item information; and update the corresponding style configuration information in the code file based on the style configuration information corresponding to the successfully matched data item information.

7. The method according to claim 1, characterized in that The generating a target code file package based on at least one code file corresponding to each of the data tables comprises: A corresponding file root directory is created based on each of the data tables, and at least one code file corresponding to each of the data tables is added to the corresponding file root directory to obtain the target code file package.

8. A code file generation method, characterized in that: include: Displaying a visual operation page, and generating a corresponding service request in response to a user's operation on the visual operation page, wherein the service request includes an address of a target server and service data; Sending the service request to the target server, so that the target server generates corresponding feedback data according to the service data in the service request, and returns the feedback data, wherein the feedback data includes a target code file package; The feedback data is received, and the feedback data is displayed on the visualization operation page.

9. A code file generating device, characterized in that: include: A basic configuration information determination module, configured to receive a code file generation request, and determine basic configuration information based on the code file generation request, wherein the basic configuration information includes a table name of at least one data table and data item information corresponding to each of the data tables; A code file configuration information acquisition module, used to acquire code file configuration information, wherein the code file configuration information includes at least one template file; A code file generating module, configured to generate, for any data table in the basic configuration information, at least one code file corresponding to the data table based on the at least one template file and the table name and data item information corresponding to the data table; The target code file package generating module is used to generate a target code file package based on at least one code file corresponding to each of the data tables.

10. A code file generating device, characterized in that: include: A business request generation module, used to display a visual operation page, and generate a corresponding business request in response to a user's operation on the visual operation page, wherein the business request includes an address of a target server and business data; A service request sending module, used to send the service request to the target server, so that the target server generates corresponding feedback data according to the service data in the service request, and returns the feedback data, wherein the feedback data includes a target code file package; The feedback data display module is used to receive the feedback data and display the feedback data on the visual operation page.

11. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the code file generation method according to any one of claims 1 to 7 or 8.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the code file generation method according to any one of claims 1 to 7 or 8 when executed.