Code generation method and device, equipment and storage medium

By generating code frameworks and developing code methods, the problems of low rewriting efficiency and inability to view progress in real time in the existing technology are solved, and efficient database conversion and progress management are achieved.

CN119987741APending Publication Date: 2025-05-13INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In the prior art, the stored procedures of a centralized database are manually rewritten into an object-oriented service interface of a distributed database, which is a large workload and cannot view the rewriting progress in real time, resulting in inefficiency.

Method used

Provides a code generation method, which generates a code framework by rewriting stored procedures in the database according to the rewrite type, and determines the rewrite code based on the framework and development code, supporting real-time viewing of the conversion progress.

Benefits of technology

Improves the efficiency of converting centralized databases into distributed databases, and realizes real-time viewing of conversion progress, reducing manual workload and management costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119987741A_ABST
    Figure CN119987741A_ABST
Patent Text Reader

Abstract

The invention discloses a code generation method and device, equipment and a storage medium, and relates to the technical field of artificial intelligence, the method comprises the following steps: rewriting each storage process in a current database according to a rewriting type of a rewriting task corresponding to the current database to obtain a code framework corresponding to the current database, the code framework comprises an annotation body of a function corresponding to each storage process; development codes of all the functions are determined, rewriting codes corresponding to the current database are determined according to the code framework and the development codes of all the functions, and the development codes of all the functions are determined when distribution personnel corresponding to all the storage processes develop all the functions according to annotation bodies of the functions corresponding to all the storage processes. According to the technical scheme, the code framework corresponding to the current database is constructed by rewriting the interface class obtained in each storage process, and the rewriting code corresponding to the current database is determined according to the development code of each function determined under the determined development rule; the code generation efficiency is improved while the codes required for rewriting the current database are generated in a standardized mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of artificial intelligence technology, and in particular to a code generation method, apparatus, device and storage medium. Background Art

[0002] Data autonomy and controllability are inevitable requirements for enterprise development. Enterprises often use distributed databases to replace traditional centralized databases. The existing decoupling solution is limited by distributed computing power, and the basic service group needs to be further decoupled before database migration can be achieved. For databases that are business-sensitive and have high decoupling complexity, database replacement needs to be completed through standard processes, and version process management and code quality management need to be done well. Therefore, it is necessary to rewrite the storage procedures of the centralized database into the object-oriented service interface procedures of the distributed database, complete the redesign and logic combing, and achieve seamless integration with existing businesses.

[0003] In the prior art, each stored procedure is usually manually rewritten into an object-oriented service interface, which is labor-intensive and the rewriting progress cannot be viewed in real time.

[0004] Therefore, there is an urgent need for a code generation method to improve rewriting efficiency and support real-time viewing of improvement progress. Summary of the invention

[0005] The present invention provides a code generation method, device, equipment and storage medium to improve the efficiency of converting a traditional centralized database into a distributed database, and realize real-time viewing of the conversion progress.

[0006] In a first aspect, an embodiment of the present invention provides a code generation method, comprising:

[0007] Rewrite each stored procedure in the current database according to the rewriting type of the rewriting task corresponding to the current database to obtain a code framework corresponding to the current database, wherein the code framework includes an annotation body of a function corresponding to each stored procedure;

[0008] Determine the development code of each function, and determine the rewrite code corresponding to the current database based on the code framework and the development code of each function, wherein the development code of each function is determined by the assigned personnel corresponding to each stored procedure when developing each function with reference to the annotations of the functions corresponding to each stored procedure.

[0009] The technical solution of an embodiment of the present invention provides a code generation method, comprising: rewriting each stored procedure in the current database according to the rewriting type of the rewriting task corresponding to the current database to obtain a code framework corresponding to the current database, wherein the code framework includes an annotation body of a function corresponding to each stored procedure; determining a development code for each function, and determining the rewriting code corresponding to the current database according to the code framework and the development code of each function, wherein the development code of each function is determined by an assigned personnel corresponding to each stored procedure to develop each function with reference to the annotation body of the function corresponding to each stored procedure. The above technical scheme can first rewrite each stored procedure of the current database according to the rewriting type in the rewriting task corresponding to the current database, and construct a code framework corresponding to the current database through the interface class obtained by rewriting each stored procedure, so as to realize automatic generation of the code framework, and the code framework includes the annotation body of the function corresponding to each stored procedure, and the annotation body includes the development rules of the corresponding function. Secondly, the rewriting code corresponding to the current database can be determined according to the code framework and the development code of each function determined by the assigned personnel corresponding to each stored procedure to develop each function according to the annotation body of each function in the interface class corresponding to each stored procedure. The development code of each function determined under the determined development rules makes the development code rules unified and meets the requirements of the rewriting type. The rewriting code corresponding to the current database is obtained by filling the development code of each function into the code framework, so as to realize the standardized generation of the code required to rewrite the current database while improving the code generation efficiency.

[0010] Furthermore, the current database is a centralized database, and the rewrite type is a distributed type.

[0011] Further, each stored procedure in the current database is rewritten according to the rewriting type of the rewriting task corresponding to the current database to obtain a code framework corresponding to the current database, including:

[0012] By rewriting each of the stored procedures into a corresponding object-oriented function, determining dependency information corresponding to each of the stored procedures and dependency codes corresponding to input parameters and output parameters, and obtaining an interface class corresponding to each of the stored procedures;

[0013] The code framework corresponding to the current database is determined according to the interface class corresponding to each stored procedure.

[0014] Furthermore, before determining the development code of each function, it also includes:

[0015] The assigned personnel corresponding to each of the stored procedures are determined according to the task assignment scheme of the rewriting task, wherein the task assignment scheme includes at least one entry, and each of the entries at least includes a stored procedure name and an assigned personnel.

[0016] Further, determining the assigned personnel corresponding to each of the stored procedures according to the task assignment scheme of the rewriting task includes:

[0017] Determining, according to the stored procedure name of each stored procedure, an entry corresponding to each stored procedure in the task allocation scheme;

[0018] The assigned personnel corresponding to each of the stored processes are determined in the entries corresponding to each of the stored processes.

[0019] Furthermore, the annotation body includes the development progress of the corresponding function. When the assigned personnel develops each function by referring to the annotation body of each function, the development progress of the corresponding function is updated by updating the annotation body. Accordingly, it also includes:

[0020] Determining the development progress of each of the functions in the annotation body of each of the functions;

[0021] The conversion progress of the current database and the work progress of each assigned person are determined according to the development progress of each function.

[0022] In a second aspect, an embodiment of the present invention further provides a code generation device, comprising:

[0023] A rewriting module, used to rewrite each stored procedure in the current database according to the rewriting type of the rewriting task corresponding to the current database, and obtain a code framework corresponding to the current database, wherein the code framework includes an annotation body of a function corresponding to each stored procedure;

[0024] A determination module is used to determine the development code of each of the functions, and determine the rewrite code corresponding to the current database based on the code framework and the development code of each of the functions, wherein the development code of each of the functions is determined by the assigned personnel corresponding to each of the stored procedures when developing each of the functions with reference to the annotations of the functions corresponding to each of the stored procedures.

[0025] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0026] at least one processor; and a memory communicatively coupled to the at least one processor;

[0027] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the code generation method as described in any one of the first aspects.

[0028] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to execute a code generation method as described in any one of the first aspects.

[0029] In a fifth aspect, the present application provides a computer program product, which includes computer instructions. When the computer instructions are executed on a computer, the computer executes the code generation method provided in the first aspect.

[0030] It should be noted that the above computer instructions may be stored in whole or in part on a computer-readable storage medium, wherein the computer-readable storage medium may be packaged together with the processor of the code generating device, or may be packaged separately from the processor of the code generating device, which is not limited in this application.

[0031] The description of the second, third, fourth and fifth aspects in this application can refer to the detailed description of the first aspect; and the beneficial effects of the description of the second, third, fourth and fifth aspects can refer to the beneficial effect analysis of the first aspect, which will not be repeated here.

[0032] In this application, the name of the above-mentioned code generation device does not limit the device or functional module itself. In actual implementation, these devices or functional modules may appear with other names. As long as the functions of each device or functional module are similar to those of this application, they fall within the scope of the claims of this application and their equivalent technologies.

[0033] These and other aspects of the present application will become more apparent from the following description. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0035] Figure 1 A flowchart of a code generation method provided by an embodiment of the present invention;

[0036] Figure 2 A flowchart of another code generation method provided by an embodiment of the present invention;

[0037] Figure 3 A schematic diagram of a code generation system provided by an embodiment of the present invention;

[0038] Figure 4A schematic diagram of the structure of a code generation device provided by an embodiment of the present invention;

[0039] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0040] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0041] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0042] The terms "first" and "second" and the like in the specification and drawings of this application are used to distinguish different objects, or to distinguish different processing of the same object, rather than to describe a specific order of objects.

[0043] In addition, the terms "including" and "having" and any variations thereof mentioned in the description of the present application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.

[0044] It should be mentioned before discussing exemplary embodiments in more detail that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe various operations (or steps) as sequential processes, many operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of various operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to methods, functions, procedures, subroutines, subprograms, etc. In addition, the embodiments in the present invention and the features in the embodiments can be combined with each other without conflict.

[0045] It should be noted that, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0046] In the description of the present application, unless otherwise specified, “plurality” means two or more.

[0047] For banking companies, when using distributed databases to replace traditional centralized databases, there are many stored procedures for customer services in the database, often involving more than one million lines of stored procedure code. These stored procedures have been accumulated over the years and have been deeply embedded in the business process. The rewritten code will be extremely large-scale and involve massive version libraries. In the process of database rewriting, there may be code standardization issues such as chaotic file structure, inconsistent naming, and non-standard comments, which can easily introduce unsafe factors into the decoupling process.

[0048] Therefore, there is an urgent need for a code generation method to solve the above technical problems.

[0049] The code generation method proposed in this application will be described in detail below with reference to diagrams and embodiments.

[0050] Figure 1 A flowchart of a code generation method provided by an embodiment of the present invention. This embodiment is applicable to situations where the efficiency of converting a centralized database into a distributed database needs to be improved. The method can be executed by a code generation device, such as Figure 1 As shown, the specific steps include:

[0051] Step 110: rewrite each stored procedure in the current database according to the rewriting type of the rewriting task corresponding to the current database to obtain a code framework corresponding to the current database.

[0052] The current database is a centralized database, for example, a relational database, which includes multiple stored procedures. The rewriting task corresponding to the current database can be understood as a task of rewriting the current database to a rewriting type, and the rewriting type can be a distributed type. Therefore, the rewriting task needs to rewrite the current database from a relational database to a distributed database.

[0053] Specifically, a relational database is composed of multiple stored procedures. The relational database implements functions, that is, executes business, through stored procedure packages. The stored procedure packages include stored procedures that implement various sub-functions. When rewriting a relational database into a distributed database, each stored procedure package can be rewritten into an object-oriented class according to the rewriting rules, and the stored procedures in each stored procedure package can be rewritten into an object-oriented function. The dependency information corresponding to each stored procedure, the dependency code corresponding to the input parameters and output parameters are determined, and the interface class corresponding to each stored procedure is determined according to the object-oriented class and function and the dependency code, so as to rewrite each stored procedure into an interface class, and then rewrite the code of each stored procedure based on the rewriting type. Furthermore, a code framework corresponding to the current database can also be constructed according to the interface class rewritten by each stored procedure, and the code framework is used to rewrite the current database into a distributed database.

[0054] It should be explained that the code framework includes the annotation body of the function corresponding to each stored procedure, and the annotation body includes the development rules and development progress of the corresponding function.

[0055] In the embodiment of the present invention, each stored procedure of the current database is rewritten according to the rewrite type of the current database, so as to automatically build a code framework required for rewriting the current database into a distributed database.

[0056] Step 120: determine the development code of each of the functions, and determine the rewrite code corresponding to the current database according to the code framework and the development code of each of the functions.

[0057] The development code of each function is determined by the assigned personnel corresponding to each stored procedure by referring to the annotation of the function corresponding to each stored procedure to develop each function. The annotation also includes allocation information, and the allocation information includes an allocation group and an allocation personnel.

[0058] Since the above steps have rewritten each stored procedure, the interface class corresponding to each stored procedure can be assigned to the corresponding assignee. Specifically, the interface class corresponding to each stored procedure can be uploaded to the code management tool so that the assignee can develop the function based on the code management tool. Furthermore, the assignee can develop the function with reference to the development rules of the function annotation body in the assigned interface class to determine the development code of the function.

[0059] Specifically, after determining that all functions have been developed, that is, the development progress of all functions is 100%, the development code of each function can be obtained. At this time, the rewrite code corresponding to the current database can be determined according to the code framework and the development code of each function. Specifically, the development code of each function can be filled into the code framework to obtain the rewrite code corresponding to the current database.

[0060] In the embodiment of the present invention, after it is determined that all functions have been developed, the rewriting code corresponding to the current database is determined by filling the development code of each function into the code framework, thereby improving the code generation efficiency.

[0061] The code generation method provided by the embodiment of the present invention includes: rewriting each stored procedure in the current database according to the rewriting type of the rewriting task corresponding to the current database to obtain a code framework corresponding to the current database, wherein the code framework includes the annotation body of the function corresponding to each stored procedure; determining the development code of each function, and determining the rewriting code corresponding to the current database according to the code framework and the development code of each function, wherein the development code of each function is determined by the assigned personnel corresponding to each stored procedure to develop each function with reference to the annotation body of the function corresponding to each stored procedure. The above technical scheme can first rewrite each stored procedure of the current database according to the rewriting type in the rewriting task corresponding to the current database, and construct a code framework corresponding to the current database through the interface class obtained by rewriting each stored procedure, so as to realize automatic generation of the code framework, and the code framework includes the annotation body of the function corresponding to each stored procedure, and the annotation body includes the development rules of the corresponding function. Secondly, the rewriting code corresponding to the current database can be determined according to the code framework and the development code of each function determined by the assigned personnel corresponding to each stored procedure to develop each function according to the annotation body of each function in the interface class corresponding to each stored procedure. The development code of each function determined under the determined development rules makes the development code rules unified and meets the requirements of the rewriting type. The rewriting code corresponding to the current database is obtained by filling the development code of each function into the code framework, so as to realize the standardized generation of the code required to rewrite the current database while improving the code generation efficiency.

[0062] Figure 2 Flow chart of another code generation method provided by an embodiment of the present invention, this embodiment is concretized on the basis of the above embodiment. Figure 2 As shown, in this embodiment, the method may further include:

[0063] Step 210: Determine the assigned personnel corresponding to each of the stored procedures according to the task assignment plan of the rewriting task.

[0064] The current database may be a centralized database, such as a relational database. The task allocation scheme of the current database is determined by the allocation of the stored procedure by the administrator of the rewriting task. The task allocation scheme is composed of multiple entries, each of which includes at least the name of the stored procedure and the allocation personnel, and may also include the package name of the stored procedure package corresponding to the stored procedure, the function to which it belongs, the allocation group, the input parameters, the output parameters and the completion time limit.

[0065] In the stored procedure PROCEDURE prc_exp_app1(p_i_table_name INVARCHAR2,p_o_flag OUT VARCHAR2) of the current database, prc_exp_app1 represents the stored procedure that outputs data to application 1. The input parameter IN is p_i_table_name, which indicates the table name to be input. The output parameter OUT is p_o_flag, which indicates whether the output is correct. VARCHAR2 represents a string. The rewriting task of the current database needs to convert the above stored procedure into an interface class composed of object-oriented functions.

[0066] The entries corresponding to prc_exp_app1 include package name, stored procedure name, function, allocation information (allocation group and allocation personnel), input parameters, output parameters and completion time limit. The task allocation plan of the current database is composed of the entries corresponding to all stored procedures in the current database.

[0067] In one implementation, step 210 may specifically include:

[0068] According to the stored procedure name of each stored procedure, an entry corresponding to each stored procedure is determined in the task assignment plan; and the assigned personnel corresponding to each stored procedure are determined in the entry corresponding to each stored procedure.

[0069] Specifically, we can first determine the task assignment plan corresponding to the rewrite task of the current database, and then determine the entries corresponding to each stored procedure based on the stored procedure names included in each entry in the task assignment plan, and determine the assigned personnel in the entry corresponding to the stored procedure as the assigned personnel corresponding to the stored procedure, so as to determine the assigned personnel corresponding to each stored procedure in the current database.

[0070] In the embodiment of the present invention, the allocation personnel corresponding to each stored procedure in the current database are determined according to each item in the task allocation plan corresponding to the current database, and the development allocation of the functions corresponding to each stored procedure in the current database is realized.

[0071] Step 220: rewrite each stored procedure in the current database according to the rewriting type of the rewriting task corresponding to the current database to obtain a code framework corresponding to the current database.

[0072] The current database is a centralized database, the rewrite type is a distributed type, the code framework includes an annotation body of a function corresponding to each stored procedure, and the annotation body includes a development progress and development rules of the corresponding function.

[0073] In one implementation, step 220 may specifically include:

[0074] By rewriting each stored procedure into an object-oriented function, the dependency information corresponding to each stored procedure and the dependency code corresponding to the input parameters and output parameters are determined, and the interface class corresponding to each stored procedure is obtained; the code framework corresponding to the current database is determined based on the interface class corresponding to each stored procedure.

[0075] Figure 3 A schematic diagram of a code generation system provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, the system includes a stored procedure to service interface template generation component and an automated scanning component. The stored procedure to service interface template generation component is used to rewrite each stored procedure in the current database. Specifically, when rewriting a stored procedure into an object-oriented function, it is first necessary to filter the error data. Specifically, the error data includes the empty package, the duplicate stored procedure name, and the irregular naming. Therefore, the stored procedures with empty packages, duplicate stored procedure names, and irregular naming can be filtered. Data standardization is also required. Specifically, the parameters involved in the stored procedure need to be converted from traditional relational types to object-oriented types. For example, the string type represented by VARCHAR2 in the current database is rewritten as string to adapt to the object-oriented programming language. Path parameter generation is also required. Specifically, the identified stored procedure belongs to xx package, xx function, xx stored procedure name and the general com.icbc.appb are spliced ​​to form the final path parameter. The absence of camel case naming or separators will result in the inability to reasonably split parameters. Therefore, camel case naming is also required. Finally, standardized path parameters, input parameters, output parameters, allocation information, interface information and dependency information can be generated, where the path parameters represent the path to which the converted object-oriented function belongs, the input parameters and output parameters represent the name, type, length, etc. of the input parameters and output parameters required by the stored procedure, the allocation information includes the allocation group and the allocation personnel, the interface information represents the information of the object-oriented class interface corresponding to the stored procedure, and the dependency information is the dependency that needs to be introduced in the header of the object-oriented file, for example, classes or methods that are not defined in the corresponding functions in the stored procedure need to introduce dependencies, such as interface classes, input parameter classes, output parameter classes, and specific classes that the stored procedure needs to use.

[0076] Furthermore, the corresponding folder can be generated according to the path parameters, and the corresponding input parameter class and output parameter class can be generated according to the input parameters and output parameters of the stored procedure, that is, all parameters can be packaged into classes for use with object-oriented ideas. For example, the input parameters of the stored procedure are encapsulated by the input parameter class. The input parameters of the stored procedure prc_exp_app2 are p_i_table_name (character type) and p_i_time (date type). The input parameter class corresponding to the input parameters is prcExpApp2Request, and the attributes of the input parameter class include string p_i_table_name and date p_i_time.

[0077] When generating dependency code according to the grammatical rules of the class and the input parameter class, output parameter class and dependency information, the introduction of dependency information only requires import + path + dependency name. Therefore, after determining the path parameters, input parameter class and output parameter class, the input parameter dependency is introduced and automatically spliced ​​to determine the dependency code as import com.icbc.app2.request.prcExpApp2Request. For example, when the declaration of a function requires visible scope + return type + function name + input parameter information, the dependency code can be determined as public prcExpApp2Result prcExpApp2(prcExpApp2Request){return null}. Furthermore, the interface class corresponding to the stored procedure can be generated, and the code framework corresponding to the current database can be generated according to the interface class corresponding to each stored procedure of the current database.

[0078] Of course, while generating the code framework corresponding to the current database, the annotation body of each function can also be determined, that is, the class name, method name, allocation group, allocation personnel, development rules and development progress corresponding to each function can be determined.

[0079] It should be noted that the code framework corresponding to the current database can be generated based on the stored procedure to service interface template generation component.

[0080] In the embodiment of the present invention, each stored procedure of the current database is rewritten according to the rewrite type of the current database, so as to automatically build a code framework required for rewriting the current database into a distributed database.

[0081] Step 230: Determine the development code of each of the functions.

[0082] Step 240: Determine the rewrite code corresponding to the current database according to the code framework and the development code of each function.

[0083] The development code of each function is determined by the assigned personnel corresponding to each stored procedure when developing each function with reference to the annotations of the function corresponding to each stored procedure.

[0084] Specifically, after determining the code framework corresponding to the current database, each stored procedure can be assigned to a corresponding assigned personnel according to the annotation body of the function corresponding to each stored procedure in the code framework. The assigned personnel can develop each function according to the development rules in the annotation body of the function corresponding to the assigned stored procedure to determine the development code of each function.

[0085] By assigning each stored procedure to the corresponding assigned personnel, the current database rewriting task can be assigned. In addition, when assigning the stored procedure to the corresponding assigned personnel, the stored procedure can be first assigned to the corresponding assigned group, and then the stored procedure can be assigned to the assigned personnel in the assigned group to achieve hierarchical allocation of the stored procedure. Managers do not need to convey information and assign tasks between levels, and do not need to deal with cross-team collaboration and communication issues, solving the technical problems of extremely high management costs and difficult progress management corresponding to multi-level management.

[0086] In an embodiment of the present invention, the development code of each function is determined according to the development of the corresponding function of each stored procedure by the assigned personnel, thereby improving the uniformity of the code. After determining that all functions have been developed, the rewrite code corresponding to the current database is determined by filling the development code of each function into the code framework, thereby improving the code generation efficiency and reducing the required labor costs.

[0087] Step 250: determine the development progress of each function in the annotation body of each function; determine the conversion progress of the current database and the work progress of each assigned person according to the development progress of each function.

[0088] When the allocation personnel develops each of the functions by referring to the annotations of each of the functions, the allocation personnel updates the development progress of the corresponding function by updating the annotations.

[0089] like Figure 3As shown, the automated scanning component is used to obtain the development progress of the current database, the development progress of each function, the work progress of each assigned group, and the work progress of each assigned person. Specifically, when the assigned person develops the function with reference to the annotation body of the function, the development progress of the function can be updated in the annotation body. Therefore, the real-time development progress of each function can be determined in the annotation body of each function. Specifically, after generating the code framework corresponding to the current database, the code framework can be uploaded to the code management tool. The assigned person can develop the assigned function in the code management tool, and update the development progress of the function in the annotation body of the function when developing the assigned function. Therefore, the exclusive message of the pipeline management tool (through the configured time interval and scheduled scanning warehouse address) generated by the scanning-related parameters set by the management personnel can automatically pull the code in the code management tool to determine the development progress of the function corresponding to each stored procedure.

[0090] In addition, the exclusive message of the pipeline management tool is generated based on the scan-related parameters set by the management personnel. The scan-related parameters may include the code management tool address, scan interval, and scan notification information, etc. Therefore, the code management tool address, scan interval, and scan notification information can be spliced ​​according to the message syntax rules of the pipeline management tool to obtain the exclusive message of the pipeline management tool.

[0091] Furthermore, the conversion progress of the current function can be determined based on the development progress of the functions corresponding to each stored procedure in the current database, and when it is determined that the development progress of any function is facing the risk of overdue, the corresponding assigned personnel and the leader of the corresponding assigned group will be notified in a timely manner. Of course, the administrator of the current database can query the conversion progress of the current database and the development progress of the functions corresponding to each stored procedure in the current database based on the progress query function, and can also query the work progress of each assigned group and the work progress of each assigned personnel.

[0092] The pipeline management tool's exclusive message can also pull the allocation information of the functions corresponding to each stored procedure, compare the theoretical allocation information and the actual allocation information corresponding to the function, and if the actual allocation information is inconsistent with the theoretical allocation information, record the new allocation information that fails the comparison of the allocation information of a function, and send the new allocation information to the management personnel at the same time as the development progress of the current database, the development progress of the functions corresponding to each stored procedure in the current database, and the work progress of each allocation group and allocation personnel, and the administrator will modify the allocation information in the annotation body of the function.

[0093] In practical applications, progress monitoring can be performed based on automated scanning components.

[0094] In the embodiment of the present invention, the development progress of the corresponding function of each stored procedure in the current database is updated in real time, solving the problem of delayed progress feedback caused by the need to regularly complete progress self-checking and manually update task progress in the prior art. In addition, the administrator of the current database can obtain the conversion progress of the current database, the development progress of each function, the work progress of each assigned group, and the work progress of each assigned person in real time, thereby improving work efficiency.

[0095] Of course, the development progress of the current database, the development progress of each function, the work progress of each assigned group, and the work progress of each assigned person can also be visualized to make the progress display clearer. Specifically, multi-dimensional data display, such as line charts, bar charts, lists, etc., can be used to intuitively display data from different angles, making it convenient to obtain key information in a short time. Through data visualization, the development progress of the current database can be shown to managers in a more intuitive and vivid way. In addition, this application also supports quick query and sorting, and managers can filter and arrange data according to needs, which improves the flexibility and efficiency of data analysis and ensures that the project proceeds as planned.

[0096] The code generation method provided by the embodiment of the present invention includes: determining the assigned personnel corresponding to each of the stored procedures according to the task assignment plan of the rewriting task; rewriting each stored procedure in the current database according to the rewriting type of the rewriting task corresponding to the current database to obtain the code framework corresponding to the current database; determining the development code of each of the functions; determining the rewriting code corresponding to the current database according to the code framework and the development code of each of the functions; determining the development progress of each of the functions in the annotation body of each of the functions; and determining the conversion progress of the current database and the work progress of each of the assigned personnel according to the development progress of each of the functions. The above technical scheme can first determine the assigned personnel corresponding to each stored procedure of the current database according to each item in the task allocation scheme corresponding to the current database, and realize the development allocation of the functions corresponding to each stored procedure of the current database. Secondly, each stored procedure of the current database can be rewritten according to the rewriting type in the rewriting task corresponding to the current database, and the interface class obtained by rewriting each stored procedure is used to build a code framework corresponding to the current database, so as to realize the automatic generation of the code framework. The code framework includes the annotation body of the function corresponding to each stored procedure, and the annotation body includes the development rules of the corresponding function. Then, the function can be developed according to the assigned personnel with reference to the function annotation body to determine the development code of the function. The development code of each function determined under the determined development rules makes the development code rules unified, improves the uniformity of the code, and meets the requirements of the rewriting type. After determining that all functions have been developed, the rewriting code corresponding to the current database is determined by filling the development code of each function into the code framework, so as to realize the standardized generation of the code required to rewrite the current database while improving the code generation efficiency, and reducing the required manpower cost.

[0097] In addition, the component for converting stored procedures to service-oriented interface templates automatically identifies and generates service-oriented interface template codes, which reduces development work and improves code uniformity and standardization. The automated scanning component automatically scans the code for progress updates, and intelligently updates the progress, reducing communication and management costs in multi-level management. The progress query visualizes the development progress and displays statistics in multiple dimensions, helping managers to view and analyze the current progress more simply, intuitively and clearly. It provides standardized code framework batch automatic generation, intelligent progress scanning and updating, visualization and multi-dimensional data display. It improves management efficiency, optimizes project progress management, and ensures the smooth implementation of database conversion.

[0098] Figure 4 The present invention provides a schematic diagram of a code generation device according to an embodiment of the present invention. The device can be applied to situations where a centralized database needs to be converted into a distributed database to improve conversion efficiency. The device can be implemented by software and / or hardware and is generally integrated in an electronic device, such as a computer device.

[0099] like Figure 4 As shown, the device comprises:

[0100] A rewriting module 410 is used to rewrite each stored procedure in the current database according to the rewriting type of the rewriting task corresponding to the current database, and obtain a code framework corresponding to the current database, wherein the code framework includes an annotation body of a function corresponding to each stored procedure;

[0101] Determination module 420 is used to determine the development code of each of the functions, and determine the rewrite code corresponding to the current database based on the code framework and the development code of each of the functions, wherein the development code of each of the functions is determined by the assigned personnel corresponding to each of the stored procedures when developing each of the functions with reference to the annotations of the functions corresponding to each of the stored procedures.

[0102] The code generation device provided in this embodiment rewrites each stored procedure in the current database according to the rewrite type of the rewrite task corresponding to the current database to obtain a code framework corresponding to the current database, wherein the code framework includes the annotation body of the function corresponding to each stored procedure; determines the development code of each function, and determines the rewrite code corresponding to the current database according to the code framework and the development code of each function, wherein the development code of each function is determined by the assigned personnel corresponding to each stored procedure to develop each function with reference to the annotation body of the function corresponding to each stored procedure. The above technical scheme can first rewrite each stored procedure of the current database according to the rewriting type in the rewriting task corresponding to the current database, and construct a code framework corresponding to the current database through the interface class obtained by rewriting each stored procedure, so as to realize automatic generation of the code framework, and the code framework includes the annotation body of the function corresponding to each stored procedure, and the annotation body includes the development rules of the corresponding function. Secondly, the rewriting code corresponding to the current database can be determined according to the code framework and the development code of each function determined by the assigned personnel corresponding to each stored procedure to develop each function according to the annotation body of each function in the interface class corresponding to each stored procedure. The development code of each function determined under the determined development rules makes the development code rules unified and meets the requirements of the rewriting type. The rewriting code corresponding to the current database is obtained by filling the development code of each function into the code framework, so as to realize the standardized generation of the code required to rewrite the current database while improving the code generation efficiency.

[0103] In one implementation, the current database is a centralized database, and the rewrite type is a distributed type.

[0104] Based on the above embodiment, the rewriting module 410 is specifically used for:

[0105] By rewriting each stored procedure into an object-oriented function, the dependency information corresponding to each stored procedure and the dependency code corresponding to the input parameters and output parameters are determined, and the interface class corresponding to each stored procedure is obtained; the code framework corresponding to the current database is determined based on the interface class corresponding to each stored procedure.

[0106] Based on the above embodiment, the device further includes:

[0107] The first execution module is used to determine the assigned personnel corresponding to each of the stored procedures according to the task assignment scheme of the rewriting task, wherein the task assignment scheme includes at least one entry, and each of the entries at least includes a stored procedure name and an assigned personnel.

[0108] Based on the above embodiment, the first execution module is specifically used to:

[0109] According to the stored procedure name of each stored procedure, an entry corresponding to each stored procedure is determined in the task assignment plan; and the assigned personnel corresponding to each stored procedure are determined in the entry corresponding to each stored procedure.

[0110] On the basis of the above embodiment, the annotation body includes the development progress of the corresponding function. When the assigned personnel develops each function by referring to the annotation body of each function, the development progress of the corresponding function is updated by updating the annotation body. Accordingly, the device further includes:

[0111] The second execution module is used to determine the conversion progress of the current database and the work progress of each assigned person according to the development progress in the annotation body corresponding to each function.

[0112] The code generation device provided in the embodiment of the present invention can execute the code generation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the code generation method.

[0113] It is worth noting that in the embodiment of the above-mentioned code generation device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0114] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 5 A block diagram of an exemplary electronic device 5 suitable for implementing embodiments of the present invention is shown. Figure 5 The electronic device 5 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0115] like Figure 5 As shown, the electronic device 5 is in the form of a general-purpose computing electronic device. The components of the electronic device 5 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 connecting different system components (including the system memory 28 and the processing unit 16).

[0116] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0117] The electronic device 5 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 5, including volatile and non-volatile media, removable and non-removable media.

[0118] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 5 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 not shown, usually called a "hard drive"). Although Figure 5 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.

[0119] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.

[0120] The electronic device 5 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), one or more devices that enable a user to interact with the electronic device 5, and / or any device that enables the electronic device 5 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the electronic device 5 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 20. Figure 5 As shown, the network adapter 20 communicates with other modules of the electronic device 5 via the bus 18. It should be understood that although Figure 5 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 5, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0121] The processing unit 16 executes various functional applications and page displays by running the program stored in the system memory 28, for example, implementing the code generation method provided in the embodiment of the present invention, which includes:

[0122] Rewrite each stored procedure in the current database according to the rewriting type of the rewriting task corresponding to the current database to obtain a code framework corresponding to the current database, wherein the code framework includes an annotation body of a function corresponding to each stored procedure;

[0123] Determine the development code of each function, and determine the rewrite code corresponding to the current database based on the code framework and the development code of each function, wherein the development code of each function is determined by the assigned personnel corresponding to each stored procedure when developing each function with reference to the annotations of the functions corresponding to each stored procedure.

[0124] Of course, those skilled in the art can understand that the processor can also implement the technical solution of the code generation method provided by any embodiment of the present invention.

[0125] An embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, for example, a code generation method provided by an embodiment of the present invention is implemented. The method includes:

[0126] Rewrite each stored procedure in the current database according to the rewriting type of the rewriting task corresponding to the current database to obtain a code framework corresponding to the current database, wherein the code framework includes an annotation body of a function corresponding to each stored procedure;

[0127] Determine the development code of each function, and determine the rewrite code corresponding to the current database based on the code framework and the development code of each function, wherein the development code of each function is determined by the assigned personnel corresponding to each stored procedure when developing each function with reference to the annotations of the functions corresponding to each stored procedure.

[0128] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0129] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0130] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0131] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0132] It should be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0133] In addition, the acquisition, storage, use, and processing of data in the technical solution of the present invention are in compliance with the relevant provisions of national laws and regulations.

[0134] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A code generation method, characterized in that: include: Rewrite each stored procedure in the current database according to the rewriting type of the rewriting task corresponding to the current database to obtain a code framework corresponding to the current database, wherein the code framework includes an annotation body of a function corresponding to each stored procedure; Determine the development code of each function, and determine the rewrite code corresponding to the current database based on the code framework and the development code of each function, wherein the development code of each function is determined by the assigned personnel corresponding to each stored procedure when developing each function with reference to the annotations of the functions corresponding to each stored procedure.

2. The code generation method according to claim 1, characterized in that: The current database is a centralized database, and the rewrite type is a distributed type.

3. The code generation method according to claim 1, characterized in that: Rewrite each stored procedure in the current database according to the rewrite type of the rewrite task corresponding to the current database to obtain a code framework corresponding to the current database, including: By rewriting each of the stored procedures into a corresponding object-oriented function, determining dependency information corresponding to each of the stored procedures and dependency codes corresponding to input parameters and output parameters, and obtaining an interface class corresponding to each of the stored procedures; The code framework corresponding to the current database is determined according to the interface class corresponding to each stored procedure.

4. The code generation method according to claim 1, characterized in that: Before determining the development code of each of the functions, it also includes: The assigned personnel corresponding to each of the stored procedures are determined according to the task assignment scheme of the rewriting task, wherein the task assignment scheme includes at least one entry, and each of the entries includes at least a stored procedure name and an assigned personnel.

5. The code generation method according to claim 4, characterized in that: Determining the assigned personnel corresponding to each of the stored procedures according to the task assignment scheme of the rewriting task includes: Determining, according to the stored procedure name of each stored procedure, an entry corresponding to each stored procedure in the task allocation scheme; The assigned personnel corresponding to each of the stored processes are determined in the entries corresponding to each of the stored processes.

6. The code generation method according to claim 1, characterized in that: The annotation body includes the development progress of the corresponding function. When the assigned personnel develops each function by referring to the annotation body of each function, the development progress of the corresponding function is updated by updating the annotation body. Accordingly, the method further includes: Determining the development progress of each of the functions in the annotation body of each of the functions; The conversion progress of the current database and the work progress of each assigned person are determined according to the development progress of each function.

7. A code generating device, characterized in that: include: A rewriting module, used to rewrite each stored procedure in the current database according to the rewriting type of the rewriting task corresponding to the current database, and obtain a code framework corresponding to the current database, wherein the code framework includes an annotation body of a function corresponding to each stored procedure; A determination module is used to determine the development code of each of the functions, and determine the rewrite code corresponding to the current database based on the code framework and the development code of each of the functions, wherein the development code of each of the functions is determined by the assigned personnel corresponding to each of the stored procedures when developing each of the functions with reference to the annotations of the functions corresponding to each of the stored procedures.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the code generation method as described in any one of claims 1-6.

9. A storage medium containing computer executable instructions, characterized in that: When the computer executable instructions are executed by a computer processor, they are used to perform the code generation method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, implements the code generation method according to any one of claims 1 to 6.