WO2020258656A1 - Code segment generation method and apparatus, storage medium and computer device - Google Patents

Code segment generation method and apparatus, storage medium and computer device Download PDF

Info

Publication number
WO2020258656A1
WO2020258656A1 PCT/CN2019/117603 CN2019117603W WO2020258656A1 WO 2020258656 A1 WO2020258656 A1 WO 2020258656A1 CN 2019117603 W CN2019117603 W CN 2019117603W WO 2020258656 A1 WO2020258656 A1 WO 2020258656A1
Authority
WO
WIPO (PCT)
Prior art keywords
code
function
module
parameter
data
Prior art date
Application number
PCT/CN2019/117603
Other languages
French (fr)
Chinese (zh)
Inventor
侯丽
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020258656A1 publication Critical patent/WO2020258656A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms

Definitions

  • This application relates to the field of computer technology. Specifically, this application relates to a method, device, storage medium, and computer equipment for generating code segments.
  • the software development process is generally to select one or more open source frameworks familiar to developers, and organize the dependencies of these frameworks from scratch, and then write code based on these frameworks.
  • Most of the basic code is tedious and repetitive. Occupies most of the development time, it is easy to produce BUG (error), and the code writing habits of different developers are different, in the subsequent code maintenance process, maintenance is difficult.
  • the prior art often uses code generation tools to generate codes.
  • the code generation tools can generate codes based on pre-written templates and user-provided database structures, but code generation rules It is relatively fixed, and the functions implemented by the generated code are relatively single, which cannot meet user needs.
  • This application provides a code segment generation method, device, computer readable storage medium, and computer equipment.
  • the configuration file is generated according to the function module and code parameter module selected by the user, and the target code segment is generated according to the target code segment generated by the configuration file.
  • the personalized customization of segments improves the flexibility of target code segment generation.
  • the embodiment of the application first provides a method for generating a code segment, including:
  • the code function in the configuration file is read, the underlying code associated with the code function is retrieved from the database, and the underlying code is generated according to the code processing parameter rule Target code segment;
  • an embodiment of the present application also provides a code segment generation device, including:
  • the display code parameter configuration interface module is used to obtain the demand information generated by the code, and call and display the code parameter configuration interface according to the demand information;
  • a configuration file generation module configured to receive the code function selected by the user on the function module and the code processing parameter input on the code parameter module, and generate a configuration file according to the code function and the code processing parameter;
  • Generate target code segment module used to read the code function in the configuration file when receiving the code generation instruction, retrieve the underlying code associated with the code function from the database, and process the parameters according to the code The rules of the underlying code generate target code segments.
  • the embodiments of the present application also provide a computer-readable storage medium, the computer-readable storage medium is used to store computer instructions, when the computer instructions run on the computer, the computer can execute any of the above technologies The steps of the code segment generation method described in the program.
  • an embodiment of the present application also provides a computer device, and the computer device includes:
  • One or more processors are One or more processors;
  • the storage device is used to store one or more computer-readable instructions
  • the one or more processors When the one or more computer-readable instructions are executed by the one or more processors, the one or more processors implement the steps of the code segment generation method described in any one of the above technical solutions.
  • the code segment generation method displayed function modules and code parameter modules on the code parameter configuration interface, and sets the function modules and code parameter modules on the code parameter configuration interface, which is convenient for users to intuitively select And determine the code function and code processing parameters, and then obtain the configuration file containing the code function and code processing parameters.
  • the configuration file is determined according to the user's needs.
  • the target code segment generated according to the configuration file can meet the user's needs and achieve the target code segment Personalized customization improves the flexibility of target code segment generation.
  • the code segment generation method provided in the embodiments of this application generates a target code segment that meets user needs according to the configuration file. Since the code writing of the code function is unified, the generated target code has a certain degree of standardization, which avoids different developers The difference of the code helps to reduce the time consumed in the subsequent debugging and maintenance process and improve the efficiency of code development; and it can also generate code segments according to the user’s choice, which reflects the flexibility and practicality of code generation.
  • Figure 1 is an implementation environment diagram of a method for generating code segments provided by an embodiment of the application
  • FIG. 2 is a flowchart of a method for generating code segments provided by an embodiment of the application
  • FIG. 3 is a flowchart of displaying priority ordering of functional modules according to an embodiment of the application.
  • FIG. 4 is a flowchart of displaying priority ranking of functional modules according to another embodiment of the application.
  • FIG. 5 is a schematic structural diagram of an apparatus for generating code segments provided by an embodiment of this application.
  • FIG. 6 is a schematic structural diagram of a computer device provided by an embodiment of this application.
  • Fig. 1 is an implementation environment diagram of a method for generating code segments provided in an embodiment.
  • the implementation environment includes a user terminal and a server side.
  • the code segment generation method provided in this embodiment can be applied to the server side.
  • the server side obtains the requirement information for code generation, calls and displays the code parameter configuration interface according to the requirement information; sets the requirement on the code parameter configuration interface
  • the function module and code parameter module corresponding to the information; receive the code function selected by the user in the function module and the code processing parameter input in the code parameter module, and generate a configuration file according to the code function and code processing parameter; when received
  • code generation instructions read the code function in the configuration file, retrieve the underlying code associated with the code function from the database, and generate the target code segment from the underlying code according to the code processing parameter rule .
  • the background involved in this application document can be the server side, and the user terminal can be a smart phone, tablet computer, notebook computer, desktop computer, etc.
  • the server side can be implemented by a computer device with processing functions, but not Not limited to this.
  • the server and user terminals can use Bluetooth, USB (Universal Serial Bus (Universal Serial Bus) or other communication connection methods for network connection, this application is not limited here.
  • FIG. 2 is a flowchart of a method for generating a code segment provided by an embodiment of the application.
  • the method for generating a code segment can be applied to the above-mentioned server side and includes the following steps:
  • Step S210 Obtain the demand information generated by the code, call and display the code parameter configuration interface according to the demand information;
  • Step S220 setting the function module and the code parameter module corresponding to the demand information on the code parameter configuration interface
  • Step S230 receiving the code function selected by the user on the function module and the code processing parameter input on the code parameter module, and generating a configuration file according to the code function and the code processing parameter;
  • Step S240 When a code generation instruction is received, the code function in the configuration file is read, the underlying code associated with the code function is retrieved from the database, and the code processing parameter rule is The underlying code generates the target code segment.
  • the code generation requirement information is obtained, where the code generation requirement information may be the received code generation request. If the code generation request is received, it indicates that the user has a code generation requirement, and the code parameter configuration interface is retrieved and displayed. There are multiple functional modules and code parameter modules displayed on the code parameter configuration interface. The functional modules contain multiple code functions to indicate what functions the module can achieve.
  • the code parameter modules include but are not limited to code generation format, code generation language, etc. Code generation formats such as: generate forms, txt documents, etc.
  • the code generation language is the language of the target code segment, such as: java language, C language, C++, PHP language, etc.
  • step S220 the function modules and code parameter modules corresponding to the demand information are set on the code parameter configuration interface.
  • Multiple function modules and code parameter modules can be displayed on the code parameter configuration interface.
  • Each function module can have multiple A code function, after selecting a function module, the code function in the function module is determined according to the user's choice, such as: a function module is to calculate personal income tax, and the multiple code functions provided on the function module can be in different regions Tax calculation.
  • the code parameter module can be described as code generation rules, such as: code generation format, code generation language, etc., a variety of code processing parameters can also be set in the code parameter module, and the input of these code processing parameters can be selected by selecting a preset code Processing parameters can also be entered manually.
  • the function module and code parameter module are displayed on the code parameter configuration interface, and the function module and code parameter module are selected on the code parameter configuration interface, and then the code function and code processing parameters are selected. It is helpful to intuitively determine the user's needs and obtain a configuration file containing code functions and code processing parameters.
  • the code generated according to the configuration file can meet the user's flexible code generation requirements.
  • step S230 the code function selected by the user on the function module and the code processing parameter input on the code parameter module are received, and a configuration file is generated according to the code function and the code processing parameter.
  • the user selects the code function on the function module and the code processing parameter on the code parameter module on the code parameter configuration interface.
  • the above function module includes multiple code functions, and receives the code function selected by the user in the function module and the code parameter in the code parameter module.
  • Code parameter module, the selected code function can limit the functions that the generated target code segment can achieve, the selected code processing parameters can limit the display form of the target code segment, and the configuration of the target code segment is generated according to the selected code function and code processing parameters file.
  • the code generation instruction is received, the code function in the configuration file is read, the code function and code processing parameter in the configuration file are extracted respectively, and the code function is retrieved from the database.
  • the underlying code is associated with the code, and the underlying code is generated into a target code segment according to the code processing parameter rules. Specifically, the underlying code associated with the code function is called, because the code function selected by the user may exceed one Therefore, in the process of generating the target code segment from the underlying code according to the code processing parameter rules, multiple underlying code segments will be fused and processed according to the code processing parameters, and finally a target code segment conforming to the code processing parameter rules will be generated.
  • the method before the step of retrieving the underlying code associated with the code function from the database in step S240, the method further includes:
  • an association between the code function and the underlying code is created. Specifically, a large number of codes or code segments are stored in the underlying code. It can exist in the form of scattered code segments or in the form of combined code segments.
  • the above code function is to realize tax calculation, including: data capture code segment, data calculation code segment, data return code segment and other code segments.
  • code segments can be stored in the whole segment, that is, call the complete
  • the code segment can realize individual tax calculation, or it can be stored in segments.
  • the data capture code segment, data calculation code segment, and data return code segment are stored in the database.
  • each code segment can be in a shared state and can be called by multiple code functions, which is beneficial to reduce the storage space of the code segment in the database.
  • the embodiment preferably stores multiple code segments corresponding to the code function in segments, and a configuration file corresponding to the code function is set in the database.
  • the configuration file corresponding to the code function is used to call each The underlying code segment is assembled into a complete code segment corresponding to the code function.
  • the solutions provided by the foregoing embodiments can generate configuration files based on the code functions and code processing parameters selected by the user.
  • the selected code functions and code processing parameters are selected according to user needs, so that the generated target code can fully meet user needs, and for users
  • the process of selecting code functions and code processing parameters is more convenient.
  • This application also provides the following embodiments, which are specifically as follows:
  • the function module display priority ordering may also be performed in the following manner.
  • the flowchart is As shown in Figure 3, it includes the following sub-steps:
  • S320 In each field category set, divide the display priority of each function module according to the coverage of the function module, and display the display priority of each function module on the code parameter configuration interface.
  • the embodiment of the present application provides a solution that first classifies each functional module according to the category to which it belongs, and then classifies the functional modules level by level from detail to detail.
  • the functional modules are divided into: calculation category, query category, identification category, etc.
  • the calculation categories include: tax calculation module, provident fund calculation module, liquidated damage calculation module, etc., tax calculation module It also includes: personal tax calculation sub-module, value-added tax calculation sub-module, business tax calculation sub-module, etc.
  • the personal tax calculation sub-module can also include individual tax calculation codes of various places, etc. If the user needs to calculate the individual tax calculation code in Beijing, he needs to select the functional modules level by level. The order of selection is: calculation category-tax calculation module-individual tax calculation submodule-Beijing individual tax calculation code.
  • the display priority is determined according to the size of the coverage of the functional module, and the position of the required functional module is continuously approached according to the display priority, and the position of the required functional module is finally found, determined and selected Functional modules, to realize the selection of functional modules, the solutions provided in the embodiments of this application are displayed level by level through the categories of the required functional modules.
  • the required functional modules can be accurately obtained, which improves the accuracy The efficiency of functional modules.
  • the display priority of each function code and code parameter module is the result of sorting according to the coverage of each function module.
  • This method requires the user to clarify the size of the coverage of the required function module and the field to which it belongs.
  • the embodiment also provides another way to divide the display priority of function modules and code parameter modules. Using the advantages of big data, analyze the user's frequency of use of each function module, and establish the function module according to the user's frequency of use of each function module.
  • the display priority of is as follows:
  • the function module display priority ordering may also be performed in the following manner.
  • the flowchart is As shown in Figure 4, it includes the following sub-steps:
  • S410 Invoke the usage record of the functional module, and count the usage frequency of each functional module
  • S420 Determine the display priority of each functional module according to the frequency of use
  • S430 Display the function module on the code parameter configuration interface according to the display priority.
  • the usage history record of the function module needs to be continuously recorded, and then the solution provided in the embodiment of the application can be used for intelligent sorting.
  • each functional module is intelligently sorted by using the frequency of use of each functional module, and the functional modules frequently used by users are displayed first.
  • This solution is suitable for scenarios where the use of functional modules does not change much.
  • the user’s work or scientific research field is generally stable or does not change much over a period of time. If the company’s scientific research field is audio, the audio-related functional modules will be frequently called. Therefore, the embodiments of this application use big data
  • the advantage of obtaining the function modules frequently called by users, and setting the display priority of the most frequently used function modules to the highest, is conducive to users to quickly find the required function modules, improve the efficiency of obtaining function modules, and thus help increase the generation target The efficiency of the code segment.
  • Both of the above two embodiments can increase the rate of generating configuration files.
  • the method further includes:
  • the method of storing and organizing data and the operating rules for data are determined according to the code processing parameters in the configuration file.
  • SQL is a structured query language used to store, manipulate, and retrieve data stored in a relational database.
  • the solution provided in the embodiment of this application uses configuration files to generate SQL scripts to implement operations such as adding, deleting, checking, and modifying data.
  • the code processing parameters are used to limit the data storage, organization, and data format in the operation process, and the SQL script is used to add, delete, check, and modify the data.
  • Data parameters in multiple code functions may be related. Therefore, this application also provides the following embodiments to ensure the processing accuracy of the data to be processed.
  • the first table is a table representing all classes in the school and the number of people in each class.
  • the second table is a table that includes the names of students in each class. If there is an increase or In the case of reducing student names, the number of students in the corresponding class in the first table should also be changed accordingly, otherwise there will be errors in the data processing based on these two data tables.
  • the students in each class in the second table The addition and deletion of names has an association relationship with the number of people in each class in the first table, so the data parameters in the two tables need to be associated in advance, so that when one of the data parameters is modified, the data parameters associated with the parameter data are changed synchronously , Which helps to reduce the probability of data errors and reduce the difficulty of code maintenance.
  • the method further includes:
  • a code optimization module is added to the configuration file, the code optimization module is used to reduce the code redundancy of the target code segment, and the code optimization module can use a loop function to process loop logic. That is, the code optimization module can use the loop function to process the loop logic in the target code segment to reduce the degree of redundancy of the target code segment.
  • the target code segment may include multiple code functions
  • the code segments corresponding to each code function are written the same, and there may be a lot of redundancy and other shortcomings.
  • this application optimizes the target code segment and removes the code. Redundancy and other deficiencies increase the readability of the target code segment.
  • the code optimization module can use loop functions to process repetitive logic, such as while, for, etc., or it can also use class, polymorphism, etc. to improve code reuse rate, reduce code redundancy, and eliminate redundant code, which is beneficial Obtain a more reasonable code structure.
  • the code optimization module is used to optimize the generated target code to remove code redundancy and other deficiencies, and make the target code segment more concise.
  • the embodiment of the present application also provides a device for generating code segments.
  • the schematic diagram of the structure is shown in FIG. 5, including: a display code parameter configuration interface module 510, a setting module 520, a configuration file generation module 530, and a target code segment generation module 540 .
  • the embodiments of the present application also provide a computer-readable storage medium.
  • the computer-readable storage medium may be a non-volatile readable storage medium on which computer instructions are stored. When the computer instructions are executed by a processor, Implement the steps of the code segment generation method described in any one of the above.
  • the storage medium includes but is not limited to any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory, read-only memory), RAM (Random AcceSS Memory, random memory), EPROM (EraSable Programmable Read-Only Memory, erasable programmable read-only memory), EEPROM (Electrically EraSable Programmable Read-Only Memory, electrically erasable programmable read-only memory), flash memory, magnetic card or optical card. That is, the storage medium includes any medium that stores or transmits information in a readable form by a device (for example, a computer). It can be a read-only memory, magnetic disk or optical disk, etc.
  • an embodiment of the present application also provides a computer device, and the computer device includes:
  • One or more processors are One or more processors;
  • the storage device is used to store one or more computer-readable instructions
  • the one or more processors When the one or more computer-readable instructions are executed by the one or more processors, the one or more processors implement the steps of the code segment generation method described in any one of the foregoing.
  • Fig. 6 is a block diagram showing a computer device 600 according to an exemplary embodiment.
  • the computer device 600 may be provided as a server.
  • the computer device 600 includes a processing component 622, which further includes one or more processors, and a memory resource represented by a memory 632, for storing instructions executable by the processing component 622, such as application computer readable instructions .
  • the application computer-readable instructions stored in the memory 632 may include one or more modules each corresponding to a set of instructions.
  • the processing component 622 is configured to execute instructions to execute the steps of the above-mentioned code segment generation method.
  • the computer device 600 may also include a power component 626 configured to perform power management of the computer device 600, a wired or wireless network interface 650 configured to connect the computer device 600 to a network, and an input output (I/O) interface 658 .
  • the computer device 600 can operate based on an operating system stored in the memory 632, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or similar. It should be understood that, although the various steps in the flowchart of the drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless explicitly stated in this article, the execution of these steps is not strictly limited in order, and they can be executed in other orders.
  • steps in the flowchart of the drawings may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the order of execution is also It is not necessarily performed sequentially, but may be performed alternately or alternately with other steps or at least a part of sub-steps or stages of other steps.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)
  • Stored Programmes (AREA)

Abstract

A code segment generation method and apparatus, a storage medium, and a computer device. A code segment generation method, comprising: acquiring requirement information of code generation, and calling and displaying a code parameter configuration interface according to the requirement information (S10); providing, on the code parameter configuration interface, a functional module and a code parameter module which correspond to the requirement information (S20); receiving a code function selected by a user on the functional module and a code processing parameter inputted by the user on the code parameter module, and generating a configuration file according to the code function and the code processing parameter (S30); and when a code generation instruction is received, reading the code function in the configuration file, calling, from a database, bottom-layer codes associated with the code function, and generating a target code segment from the bottom-layer codes according to a rule of the code processing parameter (S40). Said solution can realize personalized customization of a target code segment.

Description

代码段的生成方法、装置、存储介质及计算机设备 Code segment generation method, device, storage medium and computer equipment To
本申请要求于2019年6月26日提交中国专利局、申请号为201910562296.9 、发明名称为“代码段的生成方法、装置、存储介质及计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在申请中。This application is required to be submitted to the Chinese Patent Office on June 26, 2019, and the application number is 201910562296.9 , The priority of the Chinese patent application with the title of "Code segment generation method, device, storage medium and computer equipment", the entire content of which is incorporated into the application by reference.
技术领域Technical field
本申请涉及计算机技术领域,具体而言,本申请涉及一种代码段的生成方法、装置、存储介质及计算机设备。This application relates to the field of computer technology. Specifically, this application relates to a method, device, storage medium, and computer equipment for generating code segments.
背景技术Background technique
软件开发过程,一般是选择一种或者多种开发者熟悉的开源框架,并从头组织这些框架的依赖关系,然后以这些框架为基础进行代码编写工作,大部分的基础代码的编写繁琐且重复,占据了大部分的开发时间,很容易产生BUG(错误),而且,不同开发者的代码编写习惯不同,在后续代码维护过程中,维护难度大。The software development process is generally to select one or more open source frameworks familiar to developers, and organize the dependencies of these frameworks from scratch, and then write code based on these frameworks. Most of the basic code is tedious and repetitive. Occupies most of the development time, it is easy to produce BUG (error), and the code writing habits of different developers are different, in the subsequent code maintenance process, maintenance is difficult.
为了解决上述人为差异导致的代码维护难度大的问题,现有技术往往采用代码生成工具进行代码的生成,代码生成工具可以根据事先写好的模板及用户提供的数据库结构生成代码,但代码生成规则较为固定,生成代码实现的功能较为单一,无法满足用户需求。In order to solve the difficulty of code maintenance caused by the above-mentioned human differences, the prior art often uses code generation tools to generate codes. The code generation tools can generate codes based on pre-written templates and user-provided database structures, but code generation rules It is relatively fixed, and the functions implemented by the generated code are relatively single, which cannot meet user needs.
发明内容Summary of the invention
本申请提供了一种代码段的生成方法、装置、计算机可读存储介质及计算机设备,根据用户选择的功能模块及代码参数模块生成配置文件,再根据配置文件生成的目标代码段,实现目标代码段的个性化定制,提高目标代码段生成的灵活性。This application provides a code segment generation method, device, computer readable storage medium, and computer equipment. The configuration file is generated according to the function module and code parameter module selected by the user, and the target code segment is generated according to the target code segment generated by the configuration file. The personalized customization of segments improves the flexibility of target code segment generation.
本申请实施例首先提供了一种代码段的生成方法,包括:The embodiment of the application first provides a method for generating a code segment, including:
获取代码生成的需求信息,根据所述需求信息调用并展示代码参数配置界面;Obtain the demand information generated by the code, call and display the code parameter configuration interface according to the demand information;
在所述代码参数配置界面上设置所述需求信息对应的功能模块和代码参数模块;Setting the function module and the code parameter module corresponding to the demand information on the code parameter configuration interface;
接收用户在所述功能模块上选择的代码功能以及在所述代码参数模块上输入的代码处理参数,根据所述代码功能和所述代码处理参数生成配置文件;Receiving the code function selected by the user on the function module and the code processing parameter input on the code parameter module, and generating a configuration file according to the code function and the code processing parameter;
当接收到代码生成指令时,读取所述配置文件中的代码功能,从数据库中调取与所述代码功能相关联的底层代码,并根据所述代码处理参数的规则将所述底层代码生成目标代码段;When a code generation instruction is received, the code function in the configuration file is read, the underlying code associated with the code function is retrieved from the database, and the underlying code is generated according to the code processing parameter rule Target code segment;
所述从数据库中调取与所述代码功能相关联的底层代码的步骤之前,还包括:Before the step of retrieving the underlying code associated with the code function from the database, it further includes:
创建所述代码功能与底层代码之间的关联,将所述关联存储于数据库中,并将所述代码功能对应的功能模块置于所述代码参数配置界面中。Create an association between the code function and the underlying code, store the association in a database, and place the function module corresponding to the code function in the code parameter configuration interface.
进一步地,本申请实施例还提供了一种代码段的生成装置,包括:Further, an embodiment of the present application also provides a code segment generation device, including:
展示代码参数配置界面模块,用于获取代码生成的需求信息,根据所述需求信息调用并展示代码参数配置界面;The display code parameter configuration interface module is used to obtain the demand information generated by the code, and call and display the code parameter configuration interface according to the demand information;
设置模块,用于在所述代码参数配置界面上设置所述需求信息对应的功能模块和代码参数模块;A setting module for setting the function module and code parameter module corresponding to the demand information on the code parameter configuration interface;
生成配置文件模块,用于接收用户在所述功能模块上选择的代码功能以及在所述代码参数模块上输入的代码处理参数,根据所述代码功能和所述代码处理参数生成配置文件;A configuration file generation module, configured to receive the code function selected by the user on the function module and the code processing parameter input on the code parameter module, and generate a configuration file according to the code function and the code processing parameter;
生成目标代码段模块,用于当接收到代码生成指令时,读取所述配置文件中的代码功能,从数据库中调取与所述代码功能相关联的底层代码,并根据所述代码处理参数的规则将所述底层代码生成目标代码段。Generate target code segment module, used to read the code function in the configuration file when receiving the code generation instruction, retrieve the underlying code associated with the code function from the database, and process the parameters according to the code The rules of the underlying code generate target code segments.
进一步地,本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质用于存储计算机指令,当所述计算机指令在计算机上运行时,使得计算机可以执行上述任一技术方案所述的代码段的生成方法的步骤。Further, the embodiments of the present application also provide a computer-readable storage medium, the computer-readable storage medium is used to store computer instructions, when the computer instructions run on the computer, the computer can execute any of the above technologies The steps of the code segment generation method described in the program.
更进一步地,本申请实施例还提供了一种计算机设备,所述计算机设备包括:Furthermore, an embodiment of the present application also provides a computer device, and the computer device includes:
一个或多个处理器;One or more processors;
存储装置,用于存储一个或多个计算机可读指令,The storage device is used to store one or more computer-readable instructions,
当所述一个或多个计算机可读指令被所述一个或多个处理器执行,使得所述一个或多个处理器实现上述任意一技术方案所述的代码段的生成方法的步骤。When the one or more computer-readable instructions are executed by the one or more processors, the one or more processors implement the steps of the code segment generation method described in any one of the above technical solutions.
与现有技术相比,本申请提供的方案至少具备如下优点:Compared with the prior art, the solution provided by this application has at least the following advantages:
本申请实施例提供的代码段的生成方法,通过将功能模块及代码参数模块展示于代码参数配置界面上,并在代码参数配置界面上进行功能模块及代码参数模块的设置,方便用户直观地选择并确定代码功能及代码处理参数,进而获得包含代码功能及代码处理参数的配置文件,配置文件是根据用户需求确定的,根据该配置文件生成的目标代码段能够满足用户需求,实现目标代码段的个性化定制,提高目标代码段生成的灵活性。The code segment generation method provided in the embodiments of this application displays function modules and code parameter modules on the code parameter configuration interface, and sets the function modules and code parameter modules on the code parameter configuration interface, which is convenient for users to intuitively select And determine the code function and code processing parameters, and then obtain the configuration file containing the code function and code processing parameters. The configuration file is determined according to the user's needs. The target code segment generated according to the configuration file can meet the user's needs and achieve the target code segment Personalized customization improves the flexibility of target code segment generation.
本申请实施例提供的代码段的生成方法,根据配置文件生成符合用户需求的目标代码段,由于代码功能的代码编写是统一的,生成的目标代码是具有一定的规范性,避免了不同开发人员的代码差异,有利于减少后续调试及维护过程中耗费的时间,提高代码开发效率;并且还可根据用户的选择针对性地生成代码段,体现了代码生成的灵活性和实用性。The code segment generation method provided in the embodiments of this application generates a target code segment that meets user needs according to the configuration file. Since the code writing of the code function is unified, the generated target code has a certain degree of standardization, which avoids different developers The difference of the code helps to reduce the time consumed in the subsequent debugging and maintenance process and improve the efficiency of code development; and it can also generate code segments according to the user’s choice, which reflects the flexibility and practicality of code generation.
本申请附加的方面和优点将在下面的描述中部分给出,这些将从下面的描述中变得明显,或通过本申请的实践了解到。The additional aspects and advantages of this application will be partly given in the following description, which will become obvious from the following description, or be understood through the practice of this application.
附图说明Description of the drawings
本申请上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中: The above and/or additional aspects and advantages of the present application will become obvious and easy to understand from the following description of the embodiments in conjunction with the accompanying drawings, in which:
图1为本申请一个实施例提供的代码段的生成方法的实施环境图;Figure 1 is an implementation environment diagram of a method for generating code segments provided by an embodiment of the application;
图2为本申请一个实施例提供的代码段的生成方法的流程图;2 is a flowchart of a method for generating code segments provided by an embodiment of the application;
图3为本申请一个实施例提供的对功能模块展示优先级排序的流程图;FIG. 3 is a flowchart of displaying priority ordering of functional modules according to an embodiment of the application;
图4为本申请另一个实施例提供的对功能模块展示优先级排序的流程图;FIG. 4 is a flowchart of displaying priority ranking of functional modules according to another embodiment of the application;
图5为本申请一种实施例提供的代码段的生成装置的结构示意图;FIG. 5 is a schematic structural diagram of an apparatus for generating code segments provided by an embodiment of this application;
图6为本申请一种实施例提供的计算机设备的结构示意图。FIG. 6 is a schematic structural diagram of a computer device provided by an embodiment of this application.
具体实施方式Detailed ways
下面详细描述本申请的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,仅用于解释本申请,而不能解释为对本申请的限制。The embodiments of the present application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals indicate the same or similar elements or elements with the same or similar functions. The embodiments described below with reference to the drawings are exemplary, and are only used to explain the present application, and cannot be construed as a limitation to the present application.
本领域技术人员可以理解,除非特意声明,这里使用的单数形式“一”、“一个”、“所述”和“该”也可包括复数形式。应该进一步理解的是,本申请的说明书中使用的措辞“包括”是指存在所述特征、整数、步骤、操作、元件和/或组件,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作、元件、组件和/或它们的组合。Those skilled in the art can understand that, unless specifically stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of this application refers to the presence of the described features, integers, steps, operations, elements, and/or components, but does not exclude the presence or addition of one or more other features, Integers, steps, operations, elements, components, and/or combinations thereof.
图1为一个实施例中提供的代码段的生成方法的实施环境图,在该实施环境中,包括用户终端、服务器端。 Fig. 1 is an implementation environment diagram of a method for generating code segments provided in an embodiment. The implementation environment includes a user terminal and a server side.
本实施例提供的代码段的生成方法可适用于服务器端,服务器端获取代码生成的需求信息,根据所述需求信息调用并展示代码参数配置界面;在所述代码参数配置界面上设置所述需求信息对应的功能模块和代码参数模块;接收用户在所述功能模块中选择的代码功能及在代码参数模块中输入的代码处理参数,根据所述代码功能和代码处理参数生成配置文件;当接收到代码生成指令时,读取所述配置文件中的代码功能,从数据库中调取与所述代码功能相关联的底层代码,并根据所述代码处理参数的规则将所述底层代码生成目标代码段。The code segment generation method provided in this embodiment can be applied to the server side. The server side obtains the requirement information for code generation, calls and displays the code parameter configuration interface according to the requirement information; sets the requirement on the code parameter configuration interface The function module and code parameter module corresponding to the information; receive the code function selected by the user in the function module and the code processing parameter input in the code parameter module, and generate a configuration file according to the code function and code processing parameter; when received When code generation instructions, read the code function in the configuration file, retrieve the underlying code associated with the code function from the database, and generate the target code segment from the underlying code according to the code processing parameter rule .
需要说明的是,本申请文件中所涉及的后台可以是服务器端,用户终端可为智能手机、平板电脑、笔记本电脑、台式计算机等,服务器端可以由具有处理功能的计算机设备来实现,但并不局限于此。服务器端与用户终端可以通过蓝牙、USB(Universal Serial Bus,通用串行总线)或者其他通讯连接方式进行网络连接,本申请在此不做限制。It should be noted that the background involved in this application document can be the server side, and the user terminal can be a smart phone, tablet computer, notebook computer, desktop computer, etc. The server side can be implemented by a computer device with processing functions, but not Not limited to this. The server and user terminals can use Bluetooth, USB (Universal Serial Bus (Universal Serial Bus) or other communication connection methods for network connection, this application is not limited here.
在一个实施例中,图2为本申请实施例提供的代码段的生成方法的流程图,该代码段的生成方法可以应用于上述的服务器端,包括如下步骤:In one embodiment, FIG. 2 is a flowchart of a method for generating a code segment provided by an embodiment of the application. The method for generating a code segment can be applied to the above-mentioned server side and includes the following steps:
步骤S210,获取代码生成的需求信息,根据所述需求信息调用并展示代码参数配置界面; Step S210: Obtain the demand information generated by the code, call and display the code parameter configuration interface according to the demand information;
步骤S220,在所述代码参数配置界面上设置所述需求信息对应的功能模块和代码参数模块; Step S220, setting the function module and the code parameter module corresponding to the demand information on the code parameter configuration interface;
步骤S230,接收用户在所述功能模块上选择的代码功能以及在所述代码参数模块上输入的代码处理参数,根据所述代码功能和所述代码处理参数生成配置文件; Step S230, receiving the code function selected by the user on the function module and the code processing parameter input on the code parameter module, and generating a configuration file according to the code function and the code processing parameter; To
步骤S240,当接收到代码生成指令时,读取所述配置文件中的代码功能,从数据库中调取与所述代码功能相关联的底层代码,并根据所述代码处理参数的规则将所述底层代码生成目标代码段。 Step S240: When a code generation instruction is received, the code function in the configuration file is read, the underlying code associated with the code function is retrieved from the database, and the code processing parameter rule is The underlying code generates the target code segment. To
步骤S210的获取代码生成的需求信息,其中代码生成的需求信息可以是接收到的代码生成请求,接收到该代码生成请求,则表明用户有代码生成需求,调取并展示代码参数配置界面,该代码参数配置界面上展示有多个功能模块及代码参数模块,功能模块中包含多种代码功能,表征该模块能够实现何种功能,代码参数模块包括但不限于代码生成格式、代码生成语言等,代码生成格式如:生成表格、txt文档等格式,代码生成语言是目标代码段的编写语言,如:java语言、C语言、C++、PHP语言等。In step S210, the code generation requirement information is obtained, where the code generation requirement information may be the received code generation request. If the code generation request is received, it indicates that the user has a code generation requirement, and the code parameter configuration interface is retrieved and displayed. There are multiple functional modules and code parameter modules displayed on the code parameter configuration interface. The functional modules contain multiple code functions to indicate what functions the module can achieve. The code parameter modules include but are not limited to code generation format, code generation language, etc. Code generation formats such as: generate forms, txt documents, etc. The code generation language is the language of the target code segment, such as: java language, C language, C++, PHP language, etc.
步骤S220的在所述代码参数配置界面上设置所述需求信息对应的功能模块和代码参数模块,代码参数配置界面上可以展示多个功能模块,及代码参数模块,每个功能模块上可以有多个代码功能,选定一个功能模块后,再根据用户的选择确定该功能模块中的代码功能,如:一个功能模块是计算个人所得税,该功能模块上提供的多个代码功能可以是不同地区的个税计算。代码参数模块可以描述为代码生成规则,如:代码生成的格式、代码生成的语言等,代码参数模块中也可以设置多种代码处理参数,这些代码处理参数的输入可以通过选择预先设定的代码处理参数,也可以通过手动方式输入。In step S220, the function modules and code parameter modules corresponding to the demand information are set on the code parameter configuration interface. Multiple function modules and code parameter modules can be displayed on the code parameter configuration interface. Each function module can have multiple A code function, after selecting a function module, the code function in the function module is determined according to the user's choice, such as: a function module is to calculate personal income tax, and the multiple code functions provided on the function module can be in different regions Tax calculation. The code parameter module can be described as code generation rules, such as: code generation format, code generation language, etc., a variety of code processing parameters can also be set in the code parameter module, and the input of these code processing parameters can be selected by selecting a preset code Processing parameters can also be entered manually.
本申请实施例提供的将功能模块及代码参数模块展示于代码参数配置界面上,并在代码参数配置界面上进行功能模块及代码参数模块的选择,进而进行代码功能及代码处理参数的选择,有利于直观地确定用户的需求,获得包含代码功能及代码处理参数的配置文件,根据该配置文件生成的代码能够满足用户灵活的代码生成需求。According to the embodiment of the application, the function module and code parameter module are displayed on the code parameter configuration interface, and the function module and code parameter module are selected on the code parameter configuration interface, and then the code function and code processing parameters are selected. It is helpful to intuitively determine the user's needs and obtain a configuration file containing code functions and code processing parameters. The code generated according to the configuration file can meet the user's flexible code generation requirements.
步骤S230的接收用户在所述功能模块上选择的代码功能以及在所述代码参数模块上输入的代码处理参数,根据所述代码功能和所述代码处理参数生成配置文件。In step S230, the code function selected by the user on the function module and the code processing parameter input on the code parameter module are received, and a configuration file is generated according to the code function and the code processing parameter.
用户在代码参数配置界面上选择功能模块上的代码功能及代码参数模块上的代码处理参数,上述功能模块中包括多个代码功能,接收用户在功能模块中选择的代码功能以及代码参数模块中的代码参数模块,选择的代码功能能够限定生成的目标代码段能够实现的功能,选择的代码处理参数则能够限定目标代码段的展示形式,根据选定代码功能及代码处理参数生成目标代码段的配置文件。The user selects the code function on the function module and the code processing parameter on the code parameter module on the code parameter configuration interface. The above function module includes multiple code functions, and receives the code function selected by the user in the function module and the code parameter in the code parameter module. Code parameter module, the selected code function can limit the functions that the generated target code segment can achieve, the selected code processing parameters can limit the display form of the target code segment, and the configuration of the target code segment is generated according to the selected code function and code processing parameters file.
目标代码段的配置文件生成后,接收到代码生成指令,读取所述配置文件中的代码功能,分别提取配置文件中的代码功能及代码处理参数,从数据库中中调取与所述代码功能相关联的底层代码,并根据所述代码处理参数的规则将所述底层代码生成目标代码段,具体地,调取与所述代码功能相关联的底层代码,由于用户选择的代码功能可能超过一种,因此根据代码处理参数的规则将底层代码生成目标代码段的过程中,会根据代码处理参数进行多段底层代码段之间的融合及处理,最终生成符合代码处理参数规则的目标代码段。After the configuration file of the target code segment is generated, the code generation instruction is received, the code function in the configuration file is read, the code function and code processing parameter in the configuration file are extracted respectively, and the code function is retrieved from the database. The underlying code is associated with the code, and the underlying code is generated into a target code segment according to the code processing parameter rules. Specifically, the underlying code associated with the code function is called, because the code function selected by the user may exceed one Therefore, in the process of generating the target code segment from the underlying code according to the code processing parameter rules, multiple underlying code segments will be fused and processed according to the code processing parameters, and finally a target code segment conforming to the code processing parameter rules will be generated.
为了更清楚本申请提供的代码段的生成方案及其技术效果,接下来以多个实施例对其具体方案进行详细阐述。In order to be more clear about the code segment generation scheme and its technical effects provided by this application, the specific scheme will be described in detail in a number of embodiments below.
在一种实施例中,步骤S240的从数据库中调取与所述代码功能相关联的底层代码的步骤之前,还包括:In an embodiment, before the step of retrieving the underlying code associated with the code function from the database in step S240, the method further includes:
创建所述代码功能与底层代码之间的关联,将所述关联存储于数据库中,并将所述代码功能对应的功能模块置于所述代码参数配置界面中。Create an association between the code function and the underlying code, store the association in a database, and place the function module corresponding to the code function in the code parameter configuration interface.
本实施例提供的方案中,在调取与代码功能相关联的底层代码的步骤之前,创建代码功能与底层代码之间的关联,具体地,底层代码中存储有大量代码或代码段,这些代码可以以零散代码段的形式存在,也可以以组合代码段的形式存在。In the solution provided in this embodiment, before the step of invoking the underlying code associated with the code function, an association between the code function and the underlying code is created. Specifically, a large number of codes or code segments are stored in the underlying code. It can exist in the form of scattered code segments or in the form of combined code segments.
示例性地,上述代码功能是实现个税计算,包括:数据抓取代码段、数据计算代码段、数据返回代码段等多个代码段,这些代码段可以是整段存储,即调用该完整的代码段即能实现个税计算,也可以以分段存储,如数据库中分别存储数据抓取代码段、数据计算代码段、数据返回代码段,在计算个税时,根据个税代码的配置文件调取各代码段,实现个税计算,各代码段分段存储的方案中,各代码段可以处于共享状态,可以被多个代码功能调用,有利于减少数据库中代码段的存储空间,本申请实施例优选将代码功能对应的多个代码段分段存储,并在数据库中设置有代码功能对应的配置文件,在调用待代码功能对应的底层代码时,通过该代码功能对应的配置文件调用各底层代码段,组装成该代码功能对应的完整代码段。Exemplarily, the above code function is to realize tax calculation, including: data capture code segment, data calculation code segment, data return code segment and other code segments. These code segments can be stored in the whole segment, that is, call the complete The code segment can realize individual tax calculation, or it can be stored in segments. For example, the data capture code segment, data calculation code segment, and data return code segment are stored in the database. When calculating individual taxes, it is based on the configuration file of the tax code. Recall each code segment to realize tax calculation. In the scheme of segment storage of each code segment, each code segment can be in a shared state and can be called by multiple code functions, which is beneficial to reduce the storage space of the code segment in the database. This application The embodiment preferably stores multiple code segments corresponding to the code function in segments, and a configuration file corresponding to the code function is set in the database. When the underlying code corresponding to the function to be coded is called, the configuration file corresponding to the code function is used to call each The underlying code segment is assembled into a complete code segment corresponding to the code function.
上述各实施例提供的方案能够根据用户选择的代码功能及代码处理参数生成配置文件,选择代码功能及代码处理参数是按照用户需求选择的,以便生成的目标代码能够充分满足用户需求,为了用户在选择代码功能及代码处理参数过程中更加便捷,本申请还提供了如下实施例,具体如下:The solutions provided by the foregoing embodiments can generate configuration files based on the code functions and code processing parameters selected by the user. The selected code functions and code processing parameters are selected according to user needs, so that the generated target code can fully meet user needs, and for users The process of selecting code functions and code processing parameters is more convenient. This application also provides the following embodiments, which are specifically as follows:
一种实施例中,步骤S220的在所述代码参数配置界面上设置所述需求信息对应的功能模块和代码参数模块的步骤之前,还可以通过如下方式进行功能模块展示优先级排序,其流程图如图3所示,包括如下子步骤:In one embodiment, before the step of setting the function module and the code parameter module corresponding to the demand information on the code parameter configuration interface in step S220, the function module display priority ordering may also be performed in the following manner. The flowchart is As shown in Figure 3, it includes the following sub-steps:
S310,根据功能模块的领域类别,将各功能模块划分到对应的领域类别集合中;S310: According to the domain category of the functional module, classify each functional module into a corresponding domain category set;
S320,在各领域类别集合中,按照所述功能模块的覆盖范围对各功能模块进行展示优先级的划分,按照各功能模块的展示优先级展示于代码参数配置界面上。S320: In each field category set, divide the display priority of each function module according to the coverage of the function module, and display the display priority of each function module on the code parameter configuration interface.
数据库中存在大量功能模块时,如果没有展示规则,或者按照各功能模块的命名进行展示优先级的排序,不利于用户查找需要的功能模块。因此,本申请实施例提供一种方案,先将各功能模块按照所属类别进行分类,再由精到细,逐级对功能模块进行分类。When there are a large number of functional modules in the database, if there is no display rule or the display priority is sorted according to the naming of each functional module, it is not conducive for users to find the required functional module. Therefore, the embodiment of the present application provides a solution that first classifies each functional module according to the category to which it belongs, and then classifies the functional modules level by level from detail to detail.
示例如下:按照各功能模块的所属类别,将功能模块划分为:计算类别、查询类别、识别类别等等,计算类别中包括:税务计算模块、公积金计算模块、违约金计算模块等,税务计算模块中又包括:个税计算子模块、增值税计算子模块、营业税计算子模块等,个税计算子模块中又可以包括各地方的个税计算代码等等。若用户需要计算北京市的个税计算代码,则需要对功能模块逐级进行选择,选择的次序为:计算类别—税务计算模块—个税计算子模块—北京市个税计算代码。An example is as follows: According to the category of each functional module, the functional modules are divided into: calculation category, query category, identification category, etc. The calculation categories include: tax calculation module, provident fund calculation module, liquidated damage calculation module, etc., tax calculation module It also includes: personal tax calculation sub-module, value-added tax calculation sub-module, business tax calculation sub-module, etc. The personal tax calculation sub-module can also include individual tax calculation codes of various places, etc. If the user needs to calculate the individual tax calculation code in Beijing, he needs to select the functional modules level by level. The order of selection is: calculation category-tax calculation module-individual tax calculation submodule-Beijing individual tax calculation code.
本申请实施例提供的功能模块的展示方式,按照功能模块的覆盖范围大小确定展示优先级,按照展示优先级不断靠近所需功能模块的位置,最终找到所需功能模块的位置,确定并选择该功能模块,实现功能模块的选择,本申请实施例提供的方案,通过所需功能模块的所属类别逐级展示,在数据库中存在同名的功能模块时,能够准确获得所需功能模块,提高获得准确功能模块的效率。In the display mode of the functional modules provided in the embodiments of the present application, the display priority is determined according to the size of the coverage of the functional module, and the position of the required functional module is continuously approached according to the display priority, and the position of the required functional module is finally found, determined and selected Functional modules, to realize the selection of functional modules, the solutions provided in the embodiments of this application are displayed level by level through the categories of the required functional modules. When there are functional modules with the same name in the database, the required functional modules can be accurately obtained, which improves the accuracy The efficiency of functional modules.
上一实施例中,各功能代码及代码参数模块的展示优先级是根据各功能模块的覆盖范围进行排序的结果,该种方式需要用户明确所需功能模块的覆盖范围大小以及所属领域,本申请实施例还提供了另一种功能模块和代码参数模块进行展示优先级的划分方式,利用大数据的优势,分析用户对各功能模块的使用频率,根据用户对各功能模块的使用频次建立功能模块的展示优先级,具体如下:In the previous embodiment, the display priority of each function code and code parameter module is the result of sorting according to the coverage of each function module. This method requires the user to clarify the size of the coverage of the required function module and the field to which it belongs. The embodiment also provides another way to divide the display priority of function modules and code parameter modules. Using the advantages of big data, analyze the user's frequency of use of each function module, and establish the function module according to the user's frequency of use of each function module. The display priority of is as follows:
一种实施例中,步骤S220的在所述代码参数配置界面上设置所述需求信息对应的功能模块和代码参数模块的步骤之前,还可以通过如下方式进行功能模块展示优先级排序,其流程图如图4所示,包括如下子步骤:In one embodiment, before the step of setting the function module and the code parameter module corresponding to the demand information on the code parameter configuration interface in step S220, the function module display priority ordering may also be performed in the following manner. The flowchart is As shown in Figure 4, it includes the following sub-steps:
S410,调用所述功能模块的使用记录,统计各功能模块的使用频次;S410: Invoke the usage record of the functional module, and count the usage frequency of each functional module;
S420,根据所述使用频次的高低确定各功能模块的展示优先级;S420: Determine the display priority of each functional module according to the frequency of use;
S430,按照所述展示优先级将所述功能模块展示于代码参数配置界面上。 S430: Display the function module on the code parameter configuration interface according to the display priority.
本实施例提供的方案中,步骤S410的调用所述功能模块的使用记录之前需要不断记录功能模块的使用历史记录,然后才能利用本申请实施例提供的方案进行智能排序。In the solution provided in this embodiment, before invoking the usage record of the function module in step S410, the usage history record of the function module needs to be continuously recorded, and then the solution provided in the embodiment of the application can be used for intelligent sorting.
本申请实施例提供的方案中,利用各功能模块的使用频次对各功能模块进行智能排序,将用户经常使用的功能模块优先展示,该方案适用于功能模块的使用变动不大的场景中,实际生产生活中,用户工作或科研的领域一般较为稳定,或者一段时间内变化不大,如公司科研领域为音响,则与音响相关的功能模块会被经常调用,因此,本申请实施例利用大数据的优势,获取用户经常调用的功能模块,并将使用频次最高的功能模块的展示优先级设为最高,有利于用户快速找到所需功能模块,提高功能模块的获取效率,进而有利于提高生成目标代码段的效率。In the solution provided by the embodiments of the present application, each functional module is intelligently sorted by using the frequency of use of each functional module, and the functional modules frequently used by users are displayed first. This solution is suitable for scenarios where the use of functional modules does not change much. In production and life, the user’s work or scientific research field is generally stable or does not change much over a period of time. If the company’s scientific research field is audio, the audio-related functional modules will be frequently called. Therefore, the embodiments of this application use big data The advantage of obtaining the function modules frequently called by users, and setting the display priority of the most frequently used function modules to the highest, is conducive to users to quickly find the required function modules, improve the efficiency of obtaining function modules, and thus help increase the generation target The efficiency of the code segment.
上述两个实施例均能提高生成配置文件的速率,为了便于最终生成的目标代码段实现用户需求,还需要对待处理数据进行预处理,以便目标代码段能够更方便地处理待处理数据,具体预处理过程参见以下实施例。Both of the above two embodiments can increase the rate of generating configuration files. In order to facilitate the final generated target code segment to meet user requirements, it is also necessary to preprocess the data to be processed so that the target code segment can process the data to be processed more conveniently. See the following examples for the treatment process.
一种实施例中,步骤S230的根据所述代码功能和代码处理参数生成配置文件的步骤之后,还包括:In an embodiment, after the step of generating a configuration file according to the code function and code processing parameters in step S230, the method further includes:
根据所述配置文件的代码处理参数确定数据结构和用于数据处理的SQL脚本,以便利用所述数据结构和所述SQL脚本对数据进行增删查改处理,所述数据结构用于对数据的存储、组织及操作过程中的数据格式进行限定。Determine the data structure and the SQL script used for data processing according to the code processing parameters of the configuration file, so as to use the data structure and the SQL script to add, delete, check and modify data, and the data structure is used to store data The data format in the organization and operation process is limited.
具体地,根据配置文件中的代码处理参数确定存储、组织数据的方式以及对数据的操作规则。Specifically, the method of storing and organizing data and the operating rules for data are determined according to the code processing parameters in the configuration file.
其中,SQL是结构化查询语言,用于存储、操纵、检索存储在关系数据库中的数据,本申请实施例提供的方案,利用配置文件生成SQL脚本,实现对数据的增删查改等操作处理,利用SQL脚本对数据进行统一处理,避免处理过程杂乱。Among them, SQL is a structured query language used to store, manipulate, and retrieve data stored in a relational database. The solution provided in the embodiment of this application uses configuration files to generate SQL scripts to implement operations such as adding, deleting, checking, and modifying data. Use SQL scripts to process the data in a unified manner to avoid messy processing.
后续代码生成过程中,利用代码处理参数对数据的存储、组织及操作过程中的数据格式进行限定,利用SQL脚本对数据进行增删查改等处理。In the subsequent code generation process, the code processing parameters are used to limit the data storage, organization, and data format in the operation process, and the SQL script is used to add, delete, check, and modify the data.
多个代码功能中的数据参数可能会有所关联,因此,本申请还提供了如下实施例保证待处理数据的处理准确性。Data parameters in multiple code functions may be related. Therefore, this application also provides the following embodiments to ensure the processing accuracy of the data to be processed.
一种实施例中,若功能模块上存在数据参数相同或相关的多个代码功能,步骤S230的接收用户在所述功能模块上选择的代码功能以及在代码参数模块上输入的代码处理参数的步骤之后,还包括:In one embodiment, if there are multiple code functions with the same or related data parameters on the function module, the step of receiving the code function selected by the user on the function module and the code processing parameter input on the code parameter module in step S230 After that, it also includes:
建立多个代码功能的相关数据参数之间的关联关系,以便其中任一代码功能的数据参数发生变化时,相关联的代码功能中的数据参数相应改变。Establish the correlation between the related data parameters of multiple code functions, so that when the data parameter of any one of the code functions changes, the data parameters of the associated code function change accordingly.
示例如下:数据库中存储有两个数据表格,第一表格是表征学校中所有班级及各班级的人数表格,第二表格是每个班级中包括学生姓名的表格,若第二表格中有增加或减少学生姓名的情况,第一表格中发生学生变动对应班级的人数也要相应发生改变,否则根据这两个数据表格进行的数据处理会出现错误,本示例中,第二表格中各班级的学生姓名的增删与第一表格中各班级人数之间具有关联关系,因此需要预先对两个表格中的数据参数进行关联,以便修改其中一个数据参数时,与该参数数据相关联的数据参数同步更改,有利于降低数据出错概率,降低代码维护难度。An example is as follows: There are two data tables stored in the database. The first table is a table representing all classes in the school and the number of people in each class. The second table is a table that includes the names of students in each class. If there is an increase or In the case of reducing student names, the number of students in the corresponding class in the first table should also be changed accordingly, otherwise there will be errors in the data processing based on these two data tables. In this example, the students in each class in the second table The addition and deletion of names has an association relationship with the number of people in each class in the first table, so the data parameters in the two tables need to be associated in advance, so that when one of the data parameters is modified, the data parameters associated with the parameter data are changed synchronously , Which helps to reduce the probability of data errors and reduce the difficulty of code maintenance.
上述示例中,采用两个代码功能的处理过程,本申请提供的方案还可以适用于多于两个代码功能的情况,处理过程类似, 在此不再赘述。In the above example, the processing procedure of two code functions is adopted. The solution provided in this application can also be applied to the situation of more than two code functions, and the processing procedure is similar. I will not repeat them here.
进一步地,步骤S240的根据所述代码处理参数的规则将所述底层代码生成目标代码段的步骤之后,还包括:Further, after the step of generating the target code segment from the underlying code according to the code processing parameter rule in step S240, the method further includes:
在配置文件中添加代码优化模块,利用所述代码优化模块降低所述的目标代码段的代码冗余,所述代码优化模块能够利用循环函数处理循环逻辑。即:可以通过代码优化模块利用循环函数处理所述目标代码段中的循环逻辑,以降低所述目标代码段的冗余程度。A code optimization module is added to the configuration file, the code optimization module is used to reduce the code redundancy of the target code segment, and the code optimization module can use a loop function to process loop logic. That is, the code optimization module can use the loop function to process the loop logic in the target code segment to reduce the degree of redundancy of the target code segment.
由于目标代码段中可能包括多个代码功能,各代码功能对应的代码段的编写相同,可能会出现大量冗余等缺点,本申请在生成目标代码段之后,对目标代码段进行优化,去除代码冗余等不足,增大目标代码段的可读性。Since the target code segment may include multiple code functions, the code segments corresponding to each code function are written the same, and there may be a lot of redundancy and other shortcomings. After generating the target code segment, this application optimizes the target code segment and removes the code. Redundancy and other deficiencies increase the readability of the target code segment.
代码优化模块可以是利用循环函数处理重复逻辑,如:while,for等,或者还可以采用类、多态等方式提高代码的复用率,降低代码冗余,而且,消除冗余代码,有利于获得更加合理的代码结构。The code optimization module can use loop functions to process repetitive logic, such as while, for, etc., or it can also use class, polymorphism, etc. to improve code reuse rate, reduce code redundancy, and eliminate redundant code, which is beneficial Obtain a more reasonable code structure.
本实施例中,在利用代码处理参数的规则将底层代码生成目标代码段之后,利用代码优化模块对生成的目标代码进行优化,以去除代码冗余等不足,使目标代码段更加简洁。In this embodiment, after the underlying code is used to generate the target code segment using the code processing parameter rules, the code optimization module is used to optimize the generated target code to remove code redundancy and other deficiencies, and make the target code segment more concise.
以上为本申请提供的代码段的生成方法实施例,针对于该方法,下面阐述与其对应的代码段的生成装置的实施例。The above is the embodiment of the code segment generation method provided for this application. With regard to this method, the following describes the embodiment of the corresponding code segment generation device.
本申请实施例还提供了一种代码段的生成装置,其结构示意图如图5所示,包括:展示代码参数配置界面模块510、设置模块520、生成配置文件模块530、生成目标代码段模块540。The embodiment of the present application also provides a device for generating code segments. The schematic diagram of the structure is shown in FIG. 5, including: a display code parameter configuration interface module 510, a setting module 520, a configuration file generation module 530, and a target code segment generation module 540 .
关于上述实施例中的代码段的生成装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the code segment generating device in the foregoing embodiment, the specific manners for each module to perform operations have been described in detail in the embodiments related to the method, and detailed description will not be given here.
进一步地,本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质可以为非易失性可读存储介质,其上存储有计算机指令,该计算机指令被处理器执行时实现上述任意一项所述的代码段的生成方法的步骤。其中,所述存储介质包括但不限于任何类型的盘(包括软盘、硬盘、光盘、CD-ROM、和磁光盘)、ROM(Read-Only Memory,只读存储器)、RAM(Random AcceSS Memory,随即存储器)、EPROM(EraSable Programmable Read-Only Memory,可擦写可编程只读存储器)、EEPROM(Electrically EraSable Programmable Read-Only Memory,电可擦可编程只读存储器)、闪存、磁性卡片或光线卡片。也就是,存储介质包括由设备(例如,计算机)以能够读的形式存储或传输信息的任何介质。可以是只读存储器,磁盘或光盘等。Further, the embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium may be a non-volatile readable storage medium on which computer instructions are stored. When the computer instructions are executed by a processor, Implement the steps of the code segment generation method described in any one of the above. Wherein, the storage medium includes but is not limited to any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory, read-only memory), RAM (Random AcceSS Memory, random memory), EPROM (EraSable Programmable Read-Only Memory, erasable programmable read-only memory), EEPROM (Electrically EraSable Programmable Read-Only Memory, electrically erasable programmable read-only memory), flash memory, magnetic card or optical card. That is, the storage medium includes any medium that stores or transmits information in a readable form by a device (for example, a computer). It can be a read-only memory, magnetic disk or optical disk, etc.
更进一步地,本申请实施例还提供一种计算机设备,所述计算机设备包括:Furthermore, an embodiment of the present application also provides a computer device, and the computer device includes:
一个或多个处理器;One or more processors;
存储装置,用于存储一个或多个计算机可读指令,The storage device is used to store one or more computer-readable instructions,
当所述一个或多个计算机可读指令被所述一个或多个处理器执行,使得所述一个或多个处理器实现上述任意一项所述的代码段的生成方法的步骤。When the one or more computer-readable instructions are executed by the one or more processors, the one or more processors implement the steps of the code segment generation method described in any one of the foregoing.
图6是根据一示例性实施例示出的一种用于计算机设备600的框图。例如,计算机设备600可以被提供为一服务器。参照图6,计算机设备600包括处理组件622,其进一步包括一个或多个处理器,以及由存储器632所代表的存储器资源,用于存储可由处理组件622的执行的指令,例如应用计算机可读指令。存储器632中存储的应用计算机可读指令可以包括一个或一个以上的每一个对应于一组指令的模块。此外,处理组件622被配置为执行指令,以执行上述代码段的生成方法的步骤。Fig. 6 is a block diagram showing a computer device 600 according to an exemplary embodiment. For example, the computer device 600 may be provided as a server. 6, the computer device 600 includes a processing component 622, which further includes one or more processors, and a memory resource represented by a memory 632, for storing instructions executable by the processing component 622, such as application computer readable instructions . The application computer-readable instructions stored in the memory 632 may include one or more modules each corresponding to a set of instructions. In addition, the processing component 622 is configured to execute instructions to execute the steps of the above-mentioned code segment generation method.
计算机设备600还可以包括一个电源组件626被配置为执行计算机设备600的电源管理,一个有线或无线网络接口650被配置为将计算机设备600连接到网络,和一个输入输出(I/O)接口658。计算机设备600可以操作基于存储在存储器632的操作系统,例如Windows ServerTM,Mac OS XTM,UnixTM, LinuxTM,FreeBSDTM或类似。应该理解的是,虽然附图的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,其可以以其他的顺序执行。而且,附图的流程图中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,其执行顺序也不必然是依次进行,而是可以与其他步骤或者其他步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。The computer device 600 may also include a power component 626 configured to perform power management of the computer device 600, a wired or wireless network interface 650 configured to connect the computer device 600 to a network, and an input output (I/O) interface 658 . The computer device 600 can operate based on an operating system stored in the memory 632, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or similar. It should be understood that, although the various steps in the flowchart of the drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless explicitly stated in this article, the execution of these steps is not strictly limited in order, and they can be executed in other orders. Moreover, at least part of the steps in the flowchart of the drawings may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the order of execution is also It is not necessarily performed sequentially, but may be performed alternately or alternately with other steps or at least a part of sub-steps or stages of other steps.
应该理解的是,在本申请各实施例中的各功能单元可集成在一个处理模块中,也可以各个单元单独物理存在,也可以两个或两个以上单元集成于一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。It should be understood that the functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or software functional modules.
以上所述仅是本申请的部分实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。The above are only part of the implementation of this application. It should be pointed out that for those of ordinary skill in the art, without departing from the principle of this application, several improvements and modifications can be made, and these improvements and modifications are also Should be regarded as the scope of protection of this application.

Claims (20)

  1. 一种代码段的生成方法,其特征在于,包括: A method for generating code segments, characterized in that it includes:
    获取代码生成的需求信息,根据所述需求信息调用并展示代码参数配置界面;Obtain the demand information generated by the code, call and display the code parameter configuration interface according to the demand information;
    在所述代码参数配置界面上设置所述需求信息对应的功能模块和代码参数模块;Setting the function module and the code parameter module corresponding to the demand information on the code parameter configuration interface;
    接收用户在所述功能模块上选择的代码功能以及在所述代码参数模块上输入的代码处理参数,根据所述代码功能和所述代码处理参数生成配置文件;Receiving the code function selected by the user on the function module and the code processing parameter input on the code parameter module, and generating a configuration file according to the code function and the code processing parameter;
    当接收到代码生成指令时,读取所述配置文件中的代码功能,从数据库中调取与所述代码功能相关联的底层代码,并根据所述代码处理参数的规则将所述底层代码生成目标代码段;When a code generation instruction is received, the code function in the configuration file is read, the underlying code associated with the code function is retrieved from the database, and the underlying code is generated according to the code processing parameter rule Target code segment;
    所述从数据库中调取与所述代码功能相关联的底层代码的步骤之前,还包括:Before the step of retrieving the underlying code associated with the code function from the database, it further includes:
    创建所述代码功能与底层代码之间的关联,将所述关联存储于数据库中,并将所述代码功能对应的功能模块置于所述代码参数配置界面中。Create an association between the code function and the underlying code, store the association in a database, and place the function module corresponding to the code function in the code parameter configuration interface.
  2. 根据权利要求1所述的代码段的生成方法,其特征在于,所述根据所述代码功能和所述代码处理参数生成配置文件的步骤之后,还包括:The code segment generation method according to claim 1, wherein after the step of generating a configuration file according to the code function and the code processing parameters, the method further comprises:
    根据所述配置文件的代码处理参数确定数据结构和用于数据处理的SQL脚本,以便利用所述数据结构和所述SQL脚本对数据进行增删查改处理,所述数据结构用于对数据的存储、组织及操作过程中的数据格式进行限定。Determine the data structure and the SQL script used for data processing according to the code processing parameters of the configuration file, so as to use the data structure and the SQL script to add, delete, check and modify data, and the data structure is used to store data The data format in the organization and operation process is limited.
  3. 根据权利要求1所述的代码段的生成方法,其特征在于,所述接收用户在所述功能模块上选择的代码功能以及在所述代码参数模块上输入的代码处理参数的步骤之后,还包括:The code segment generation method according to claim 1, wherein after the step of receiving the code function selected by the user on the function module and the code processing parameter input on the code parameter module, the method further comprises :
    若所述功能模块上存在数据参数相同或相关的多个代码功能,则建立所述多个代码功能的相关数据参数之间的关联关系,以便其中任一代码功能的数据参数发生变化时,相关联的代码功能中的数据参数相应改变。If there are multiple code functions with the same or related data parameters on the function module, the correlation between the relevant data parameters of the multiple code functions is established, so that when the data parameter of any code function changes, the relevant The data parameter in the linked code function changes accordingly.
  4. 根据权利要求1所述的代码段的生成方法,其特征在于,所述在所述代码参数配置界面上设置所述需求信息对应的功能模块和代码参数模块的步骤之前,还包括:The code segment generating method according to claim 1, wherein before the step of setting the function module and code parameter module corresponding to the demand information on the code parameter configuration interface, the method further comprises:
    根据所述功能模块的领域类别,将各功能模块划分到对应的领域类别集合中;According to the domain category of the functional module, classify each functional module into a corresponding domain category set;
    在各领域类别集合中,按照所述功能模块的覆盖范围对各功能模块进行展示优先级的划分,按照各功能模块的展示优先级展示于代码参数配置界面上。In each field category set, the display priority of each function module is divided according to the coverage of the function module, and the display priority of each function module is displayed on the code parameter configuration interface.
  5. 根据权利要求1所述的代码段的生成方法,其特征在于,所述在所述代码参数配置界面上设置所述需求信息对应的功能模块和代码参数模块的步骤之前,还包括:The code segment generating method according to claim 1, wherein before the step of setting the function module and code parameter module corresponding to the demand information on the code parameter configuration interface, the method further comprises:
    调用所述功能模块的使用记录,统计各功能模块的使用频次;Call the usage records of the functional modules, and count the usage frequency of each functional module;
    根据所述使用频次的高低确定各功能模块的展示优先级;Determine the display priority of each functional module according to the frequency of use;
    按照所述展示优先级将所述功能模块展示于代码参数配置界面上。 The function module is displayed on the code parameter configuration interface according to the display priority.
  6. 根据权利要求1所述的代码段的生成方法,其特征在于,所述根据所述代码处理参数的规则将所述底层代码生成目标代码段的步骤之后,还包括:The code segment generation method according to claim 1, wherein after the step of generating the target code segment from the underlying code according to the code processing parameter rule, the method further comprises:
    在配置文件中添加代码优化模块,通过所述代码优化模块利用循环函数处理所述目标代码段中的循环逻辑,以降低所述目标代码段的冗余程度。A code optimization module is added to the configuration file, and the code optimization module uses a loop function to process the loop logic in the target code segment to reduce the redundancy of the target code segment.
  7. 一种代码段的生成装置,其特征在于,包括:A device for generating code segments, characterized in that it comprises:
    展示代码参数配置界面模块,用于获取代码生成的需求信息,根据所述需求信息调用并展示代码参数配置界面;The display code parameter configuration interface module is used to obtain the demand information generated by the code, and call and display the code parameter configuration interface according to the demand information;
    设置模块,用于在所述代码参数配置界面上设置所述需求信息对应的功能模块和代码参数模块;A setting module for setting the function module and code parameter module corresponding to the demand information on the code parameter configuration interface;
    生成配置文件模块,用于接收用户在所述功能模块上选择的代码功能以及在所述代码参数模块上输入的代码处理参数,根据所述代码功能和所述代码处理参数生成配置文件;A configuration file generation module, configured to receive the code function selected by the user on the function module and the code processing parameter input on the code parameter module, and generate a configuration file according to the code function and the code processing parameter;
    生成目标代码段模块,用于当接收到代码生成指令时,读取所述配置文件中的代码功能,从数据库中调取与所述代码功能相关联的底层代码,并根据所述代码处理参数的规则将所述底层代码生成目标代码段;Generate target code segment module, used to read the code function in the configuration file when receiving the code generation instruction, retrieve the underlying code associated with the code function from the database, and process the parameters according to the code The rules of generating target code segments from the underlying code;
    所述生成目标代码段模块还用于,创建所述代码功能与底层代码之间的关联,将所述关联存储于数据库中,并将所述代码功能对应的功能模块置于所述代码参数配置界面中。The target code segment generation module is also used to create an association between the code function and the underlying code, store the association in a database, and place the function module corresponding to the code function in the code parameter configuration Interface.
  8. 根据权利要求1所述的代码段的生成装置,其特征在于,所述生成配置文件模块还用于:The device for generating code segments according to claim 1, wherein the generating configuration file module is further configured to:
    根据所述配置文件的代码处理参数确定数据结构和用于数据处理的SQL脚本,以便利用所述数据结构和所述SQL脚本对数据进行增删查改处理,所述数据结构用于对数据的存储、组织及操作过程中的数据格式进行限定。Determine the data structure and the SQL script used for data processing according to the code processing parameters of the configuration file, so as to use the data structure and the SQL script to add, delete, check and modify data, and the data structure is used to store data The data format in the organization and operation process is limited.
  9. 根据权利要求1所述的代码段的生成装置,其特征在于,所述生成配置文件模块还用于:The device for generating code segments according to claim 1, wherein the generating configuration file module is further configured to:
    若所述功能模块上存在数据参数相同或相关的多个代码功能,则建立所述多个代码功能的相关数据参数之间的关联关系,以便其中任一代码功能的数据参数发生变化时,相关联的代码功能中的数据参数相应改变。If there are multiple code functions with the same or related data parameters on the function module, the correlation between the relevant data parameters of the multiple code functions is established, so that when the data parameter of any code function changes, the relevant The data parameter in the linked code function changes accordingly.
  10. 根据权利要求1所述的代码段的生成装置,其特征在于,所述设置模块还用于:The device for generating code segments according to claim 1, wherein the setting module is further configured to:
    根据所述功能模块的领域类别,将各功能模块划分到对应的领域类别集合中;According to the domain category of the functional module, classify each functional module into a corresponding domain category set;
    在各领域类别集合中,按照所述功能模块的覆盖范围对各功能模块进行展示优先级的划分,按照各功能模块的展示优先级展示于代码参数配置界面上。In each field category set, the display priority of each function module is divided according to the coverage of the function module, and the display priority of each function module is displayed on the code parameter configuration interface.
  11. 根据权利要求1所述的代码段的生成装置,其特征在于,所述设置模块还用于:The device for generating code segments according to claim 1, wherein the setting module is further configured to:
    调用所述功能模块的使用记录,统计各功能模块的使用频次;Call the usage records of the functional modules, and count the usage frequency of each functional module;
    根据所述使用频次的高低确定各功能模块的展示优先级;Determine the display priority of each functional module according to the frequency of use;
    按照所述展示优先级将所述功能模块展示于代码参数配置界面上。 The function module is displayed on the code parameter configuration interface according to the display priority.
  12. 根据权利要求1所述的代码段的生成装置,其特征在于,所述生成目标代码段模块还用于:The code segment generation device according to claim 1, wherein the target code segment generation module is further configured to:
    在配置文件中添加代码优化模块,通过所述代码优化模块利用循环函数处理所述目标代码段中的循环逻辑,以降低所述目标代码段的冗余程度。A code optimization module is added to the configuration file, and the code optimization module uses a loop function to process the loop logic in the target code segment to reduce the redundancy of the target code segment.
  13. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质用于存储计算机可读指令,当其在计算机上运行时,实现如下步骤:A computer-readable storage medium, wherein the computer-readable storage medium is used to store computer-readable instructions, and when it runs on a computer, the following steps are implemented:
    获取代码生成的需求信息,根据所述需求信息调用并展示代码参数配置界面;Obtain the demand information generated by the code, call and display the code parameter configuration interface according to the demand information;
    在所述代码参数配置界面上设置所述需求信息对应的功能模块和代码参数模块;Setting the function module and the code parameter module corresponding to the demand information on the code parameter configuration interface;
    接收用户在所述功能模块上选择的代码功能以及在所述代码参数模块上输入的代码处理参数,根据所述代码功能和所述代码处理参数生成配置文件;Receiving the code function selected by the user on the function module and the code processing parameter input on the code parameter module, and generating a configuration file according to the code function and the code processing parameter;
    当接收到代码生成指令时,读取所述配置文件中的代码功能,从数据库中调取与所述代码功能相关联的底层代码,并根据所述代码处理参数的规则将所述底层代码生成目标代码段;When a code generation instruction is received, the code function in the configuration file is read, the underlying code associated with the code function is retrieved from the database, and the underlying code is generated according to the code processing parameter rule Target code segment;
    所述从数据库中调取与所述代码功能相关联的底层代码的步骤之前,还包括:Before the step of retrieving the underlying code associated with the code function from the database, it further includes:
    创建所述代码功能与底层代码之间的关联,将所述关联存储于数据库中,并将所述代码功能对应的功能模块置于所述代码参数配置界面中。Create an association between the code function and the underlying code, store the association in a database, and place the function module corresponding to the code function in the code parameter configuration interface.
  14. 根据权利要求13所述的计算机可读存储介质,其特征在于,所述根据所述代码功能和所述代码处理参数生成配置文件的步骤之后,还包括:The computer-readable storage medium according to claim 13, wherein after the step of generating a configuration file according to the code function and the code processing parameters, the method further comprises:
    根据所述配置文件的代码处理参数确定数据结构和用于数据处理的SQL脚本,以便利用所述数据结构和所述SQL脚本对数据进行增删查改处理,所述数据结构用于对数据的存储、组织及操作过程中的数据格式进行限定。Determine the data structure and the SQL script used for data processing according to the code processing parameters of the configuration file, so as to use the data structure and the SQL script to add, delete, check and modify data, and the data structure is used to store data The data format in the organization and operation process is limited.
  15. 根据权利要求13所述的计算机可读存储介质,其特征在于,所述接收用户在所述功能模块上选择的代码功能以及在所述代码参数模块上输入的代码处理参数的步骤之后,还包括:The computer-readable storage medium according to claim 13, wherein after the step of receiving the code function selected by the user on the function module and the code processing parameter input on the code parameter module, the method further comprises :
    若所述功能模块上存在数据参数相同或相关的多个代码功能,则建立所述多个代码功能的相关数据参数之间的关联关系,以便其中任一代码功能的数据参数发生变化时,相关联的代码功能中的数据参数相应改变。If there are multiple code functions with the same or related data parameters on the function module, the correlation between the relevant data parameters of the multiple code functions is established, so that when the data parameter of any code function changes, the relevant The data parameter in the linked code function changes accordingly.
  16. 一种计算机设备,其特征在于,所述计算机设备包括:A computer device, characterized in that the computer device includes:
    一个或多个处理器;One or more processors;
    存储装置,用于存储一个或多个计算机可读指令,The storage device is used to store one or more computer-readable instructions,
    当所述一个或多个计算机可读指令被所述一个或多个处理器执行,实现如下步骤:When the one or more computer-readable instructions are executed by the one or more processors, the following steps are implemented:
    获取代码生成的需求信息,根据所述需求信息调用并展示代码参数配置界面;Obtain the demand information generated by the code, call and display the code parameter configuration interface according to the demand information;
    在所述代码参数配置界面上设置所述需求信息对应的功能模块和代码参数模块;Setting the function module and the code parameter module corresponding to the demand information on the code parameter configuration interface;
    接收用户在所述功能模块上选择的代码功能以及在所述代码参数模块上输入的代码处理参数,根据所述代码功能和所述代码处理参数生成配置文件;Receiving the code function selected by the user on the function module and the code processing parameter input on the code parameter module, and generating a configuration file according to the code function and the code processing parameter;
    当接收到代码生成指令时,读取所述配置文件中的代码功能,从数据库中调取与所述代码功能相关联的底层代码,并根据所述代码处理参数的规则将所述底层代码生成目标代码段;When a code generation instruction is received, the code function in the configuration file is read, the underlying code associated with the code function is retrieved from the database, and the underlying code is generated according to the code processing parameter rule Target code segment;
    所述从数据库中调取与所述代码功能相关联的底层代码的步骤之前,还包括:Before the step of retrieving the underlying code associated with the code function from the database, it further includes:
    创建所述代码功能与底层代码之间的关联,将所述关联存储于数据库中,并将所述代码功能对应的功能模块置于所述代码参数配置界面中。Create an association between the code function and the underlying code, store the association in a database, and place the function module corresponding to the code function in the code parameter configuration interface.
  17. 根据权利要求16所述的计算机设备,其特征在于,所述根据所述代码功能和所述代码处理参数生成配置文件的步骤之后,还包括:The computer device according to claim 16, characterized in that, after the step of generating a configuration file according to the code function and the code processing parameters, it further comprises:
    根据所述配置文件的代码处理参数确定数据结构和用于数据处理的SQL脚本,以便利用所述数据结构和所述SQL脚本对数据进行增删查改处理,所述数据结构用于对数据的存储、组织及操作过程中的数据格式进行限定。Determine the data structure and the SQL script used for data processing according to the code processing parameters of the configuration file, so as to use the data structure and the SQL script to add, delete, check and modify data, and the data structure is used to store data The data format in the organization and operation process is limited.
  18. 根据权利要求16所述的计算机设备,其特征在于,所述接收用户在所述功能模块上选择的代码功能以及在所述代码参数模块上输入的代码处理参数的步骤之后,还包括:The computer device according to claim 16, wherein after the step of receiving the code function selected by the user on the function module and the code processing parameter input on the code parameter module, the method further comprises:
    若所述功能模块上存在数据参数相同或相关的多个代码功能,则建立所述多个代码功能的相关数据参数之间的关联关系,以便其中任一代码功能的数据参数发生变化时,相关联的代码功能中的数据参数相应改变。If there are multiple code functions with the same or related data parameters on the function module, the correlation between the relevant data parameters of the multiple code functions is established, so that when the data parameter of any code function changes, the relevant The data parameter in the linked code function changes accordingly.
  19. 根据权利要求16所述的计算机设备,其特征在于,所述在所述代码参数配置界面上设置所述需求信息对应的功能模块和代码参数模块的步骤之前,还包括:The computer device according to claim 16, characterized in that, before the step of setting the function module and code parameter module corresponding to the demand information on the code parameter configuration interface, the method further comprises:
    根据所述功能模块的领域类别,将各功能模块划分到对应的领域类别集合中;According to the domain category of the functional module, classify each functional module into a corresponding domain category set;
    在各领域类别集合中,按照所述功能模块的覆盖范围对各功能模块进行展示优先级的划分,按照各功能模块的展示优先级展示于代码参数配置界面上。In each field category set, the display priority of each function module is divided according to the coverage of the function module, and the display priority of each function module is displayed on the code parameter configuration interface.
  20. 根据权利要求16所述的计算机设备,其特征在于,所述在所述代码参数配置界面上设置所述需求信息对应的功能模块和代码参数模块的步骤之前,还包括:The computer device according to claim 16, characterized in that, before the step of setting the function module and code parameter module corresponding to the demand information on the code parameter configuration interface, the method further comprises:
    调用所述功能模块的使用记录,统计各功能模块的使用频次;Call the usage records of the functional modules, and count the usage frequency of each functional module;
    根据所述使用频次的高低确定各功能模块的展示优先级;Determine the display priority of each functional module according to the frequency of use;
    按照所述展示优先级将所述功能模块展示于代码参数配置界面上。 The function module is displayed on the code parameter configuration interface according to the display priority.
PCT/CN2019/117603 2019-06-26 2019-11-12 Code segment generation method and apparatus, storage medium and computer device WO2020258656A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910562296.9 2019-06-26
CN201910562296.9A CN110442329A (en) 2019-06-26 2019-06-26 Generation method, device, storage medium and the computer equipment of code segment

Publications (1)

Publication Number Publication Date
WO2020258656A1 true WO2020258656A1 (en) 2020-12-30

Family

ID=68428794

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/117603 WO2020258656A1 (en) 2019-06-26 2019-11-12 Code segment generation method and apparatus, storage medium and computer device

Country Status (2)

Country Link
CN (1) CN110442329A (en)
WO (1) WO2020258656A1 (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112860248B (en) * 2019-11-27 2023-12-05 中盈优创资讯科技有限公司 Source code generation method and device
CN110955418A (en) * 2019-12-13 2020-04-03 中国南方电网有限责任公司 Code generation method and device, computer equipment and storage medium
CN111142861B (en) * 2019-12-17 2022-05-03 西安电子科技大学 Method and device for integrating structured comprehensive control system
CN112346726B (en) * 2020-03-16 2023-12-12 成都华微电子科技股份有限公司 Method for automatically generating design codes based on form information
CN111459469B (en) * 2020-04-03 2024-02-06 网易(杭州)网络有限公司 Project code initialization method, device and equipment
CN111722839B (en) * 2020-06-24 2023-03-03 北京航天数据股份有限公司 Code generation method and device, electronic equipment and storage medium
CN111930349B (en) * 2020-08-04 2023-06-06 中国建设银行股份有限公司 Program package generation method and device, electronic equipment and storage medium
CN112199086A (en) * 2020-09-18 2021-01-08 北京达佳互联信息技术有限公司 Automatic programming control system, method, device, electronic device and storage medium
CN112965697B (en) * 2021-03-25 2023-07-25 北京奇艺世纪科技有限公司 Code file generation method and device and electronic equipment
CN113268229B (en) * 2021-06-08 2023-06-27 中国联合网络通信集团有限公司 Code generation method and code generation device
CN114138254B (en) * 2021-11-30 2022-06-07 北京宇信科技集团股份有限公司 Automatic code generation method, medium, equipment and system
CN114579118A (en) * 2022-03-15 2022-06-03 上海商汤智能科技有限公司 Programming method and system, equipment, storage medium
CN115562679B (en) * 2022-12-05 2023-06-30 广东保伦电子股份有限公司 Java language-based automatic code generation method and server
CN117331559B (en) * 2023-11-06 2024-05-03 久方智能(广东)有限公司 Method for generating application interface by front end code-free

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050097071A1 (en) * 2003-10-30 2005-05-05 Vangilder James H. Telecommunications graphical service program
CN109240670A (en) * 2018-11-21 2019-01-18 北京锐安科技有限公司 Modular software development methodology, system, equipment and medium
CN109710236A (en) * 2018-12-30 2019-05-03 北京字节跳动网络技术有限公司 Business development and implementation method, device, platform and medium based on shared service
CN109871289A (en) * 2019-02-01 2019-06-11 北京顺丰同城科技有限公司 A kind of remote procedure call service creation method and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102053855B (en) * 2010-12-13 2014-03-05 浪潮(北京)电子信息产业有限公司 Software generation system and method
CN103135989B (en) * 2013-03-11 2016-02-10 北京经纬恒润科技有限公司 A kind of callback function code generation method and device
CN105912334A (en) * 2016-04-08 2016-08-31 浙江大学 Internal behavior object code generation method of AUTOSAR software assembly
CN106528165B (en) * 2016-11-11 2019-10-08 深圳中兴网信科技有限公司 Code generating method and code generating system
CN109725897A (en) * 2018-12-03 2019-05-07 深圳市多元世纪信息技术股份有限公司 Software customized methods, devices and systems, terminal

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050097071A1 (en) * 2003-10-30 2005-05-05 Vangilder James H. Telecommunications graphical service program
CN109240670A (en) * 2018-11-21 2019-01-18 北京锐安科技有限公司 Modular software development methodology, system, equipment and medium
CN109710236A (en) * 2018-12-30 2019-05-03 北京字节跳动网络技术有限公司 Business development and implementation method, device, platform and medium based on shared service
CN109871289A (en) * 2019-02-01 2019-06-11 北京顺丰同城科技有限公司 A kind of remote procedure call service creation method and device

Also Published As

Publication number Publication date
CN110442329A (en) 2019-11-12

Similar Documents

Publication Publication Date Title
WO2020258656A1 (en) Code segment generation method and apparatus, storage medium and computer device
CN109086409B (en) Microservice data processing method and device, electronic equipment and computer readable medium
WO2020233090A1 (en) Application configuration method, apparatus and device based on h5 page, and storage medium
WO2020015067A1 (en) Data acquisition method, device, equipment and storage medium
WO2019019769A1 (en) Service function implementation method, device, computer apparatus and storage medium
WO2013157678A1 (en) System and method for dynamically converting webpage, and computer-readable recording medium
WO2020000632A1 (en) Invoice issuing method, apparatus and device, and computer-readable storage medium
WO2021189829A1 (en) Data query method and apparatus, electronic device, and storage medium
WO2020087981A1 (en) Method and apparatus for generating risk control audit model, device and readable storage medium
CN115934855A (en) Full-link field level blood margin analysis method, system, equipment and storage medium
WO2020233089A1 (en) Test case generating method and apparatus, terminal, and computer readable storage medium
WO2017131354A2 (en) Apparatus and method for managing history information in an electronic device
CN112783482B (en) Visual form generation method, device, equipment and storage medium
CN111176887A (en) MySQL misoperation rollback method, equipment and system
WO2013008978A1 (en) Object identification result searching system and method
CN111984745B (en) Database field dynamic expansion method, device, equipment and storage medium
CN111414331B (en) Document importing method, device, storage medium and equipment of online collaborative knowledge base
CN112597171A (en) Table relation visualization method and device, electronic equipment and storage medium
WO2021012554A1 (en) Method and apparatus for updating data field in block chain, medium, and electronic device
WO2020143306A1 (en) Object inter-conversion method and apparatus, storage medium, and server
WO2023124910A1 (en) Data processing method and apparatus, and electronic device and storage medium
CN113127496B (en) Method and device for determining change data in database, medium and equipment
CN112394920B (en) Application software development method, platform and electronic equipment
WO2021261708A1 (en) Software engineering platform designing information system to automatically generate program and database and automatically perform test
CN113485711A (en) Task triggering method and device based on dependency relationship, electronic equipment and medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19935038

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19935038

Country of ref document: EP

Kind code of ref document: A1