CN109522013A - A kind of code generating method and device of business function - Google Patents
A kind of code generating method and device of business function Download PDFInfo
- Publication number
- CN109522013A CN109522013A CN201811326421.8A CN201811326421A CN109522013A CN 109522013 A CN109522013 A CN 109522013A CN 201811326421 A CN201811326421 A CN 201811326421A CN 109522013 A CN109522013 A CN 109522013A
- Authority
- CN
- China
- Prior art keywords
- code
- generated
- template
- data
- file
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 59
- 238000005516 engineering process Methods 0.000 claims abstract description 54
- 230000006870 function Effects 0.000 claims description 33
- 238000000547 structure data Methods 0.000 claims description 32
- 238000012545 processing Methods 0.000 claims description 26
- 238000012986 modification Methods 0.000 claims description 11
- 230000004048 modification Effects 0.000 claims description 11
- 238000012217 deletion Methods 0.000 claims description 6
- 230000037430 deletion Effects 0.000 claims description 6
- 238000007792 addition Methods 0.000 claims description 5
- 238000011161 development Methods 0.000 abstract description 5
- 238000012827 research and development Methods 0.000 abstract description 3
- 230000003252 repetitive effect Effects 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 11
- 238000004590 computer program Methods 0.000 description 9
- 238000013461 design Methods 0.000 description 6
- 238000004891 communication Methods 0.000 description 4
- 230000008569 process Effects 0.000 description 3
- 230000004075 alteration Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/33—Intelligent editors
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/12—Use of codes for handling textual entities
- G06F40/14—Tree-structured documents
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/166—Editing, e.g. inserting or deleting
- G06F40/186—Templates
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Software Systems (AREA)
- Stored Programmes (AREA)
Abstract
The invention discloses a kind of code generating method of business function and devices.The described method includes: receiving the xml data template of user's input, then the xml data template is parsed, obtain the corresponding list structured data of table structure information of code to be generated, and according to the routing information of Code Template, obtain the Code Template of code to be generated, finally using freemaker technology according to the Code Template of list structured data and code to be generated, parsing generates code file to be generated.In this way, user only needs to input xml data template, it is not necessarily to manual compiling code, code file can be obtained, developer's repetitive operation occupied time can be effectively reduced, substantially increase efficiency of research and development;Further, since the code file in the embodiment of the present invention is generated based on xml data template, method provided in an embodiment of the present invention can be convenient for the unitized management of code, improve readable and development quality.
Description
Technical Field
The present invention relates to the field of software engineering technologies, and in particular, to a method and an apparatus for generating a code of a service function.
Background
With the continuous development of information technology, the demand of various industries for various software is increasing day by day, and various software products are also emerging. In response to the demand of huge software products, developers need to design a table structure for the software products, then execute a database table structure script to create a table, and then write back-end codes and front-end codes. The whole process is complicated to operate, a large amount of time is consumed for developers, and due to different levels of the developers, the readability and the quality of software products cannot be well guaranteed.
Based on this, there is a need for a code generation method for business functions, which is used for solving the problems of long time consumption and low quality in developing software products by developers in the prior art.
Disclosure of Invention
The embodiment of the invention provides a code generation method and a code generation device for business functions, which aim to solve the technical problems of long time consumption and low quality of software product development of developers in the prior art.
The embodiment of the invention provides a code generation method of a business function, which comprises the following steps:
receiving an xml data template input by a user, wherein the xml data template comprises service data of a code to be generated;
analyzing the xml data template to obtain the service data of the code to be generated; the service data of the code to be generated comprises path information of a code template;
acquiring the code template of the code to be generated according to the path information of the code template;
and analyzing and generating a code file to be generated according to the service data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
Therefore, the code can be automatically generated based on the xml data template, and the user can obtain the code file only by inputting the xml data template without manually compiling the code. By adopting the method provided by the embodiment of the invention, the time occupied by the repeated work of developers can be effectively reduced, and the research and development efficiency is greatly improved; furthermore, the code file in the embodiment of the invention is generated based on the xml data template, so that the method provided by the embodiment of the invention can facilitate the unified management of the code, and improve the readability and the development quality.
In a possible implementation manner, the service data of the code to be generated includes table structure data of the code to be generated;
analyzing and generating a code file to be generated according to the service data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology, wherein the method comprises the following steps:
and analyzing and generating the code file to be generated according to the table structure data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
In a possible implementation manner, the service data of the code to be generated includes association relation data of the code to be generated;
analyzing and generating a code file to be generated according to the service data and the code template of the code to be generated by adopting a freemaker technology, wherein the method comprises the following steps:
and analyzing and generating the code file to be generated according to the incidence relation data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
In one possible implementation, the incidence relation data includes any one of a one-to-one relation, a one-to-many relation, a many-to-one relation, and a many-to-many relation.
In a possible implementation manner, the service data of the code to be generated further includes presentation style data of the code to be generated;
analyzing and generating a code file to be generated according to the service data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology, wherein the method comprises the following steps:
analyzing and generating the code file to be generated according to the table structure data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology;
or
And analyzing and generating the code file to be generated according to the incidence relation data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
In one possible implementation, the presentation style data includes any one or more of a date, a time, a key-value pair, a drop-down box, a text box, and a multi-selection box.
In a possible implementation manner, the service data of the code to be generated further includes a generation policy of the code to be generated;
analyzing and generating a code file to be generated according to the service data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology, wherein the method comprises the following steps:
and analyzing and generating a code file to be generated according to the generation strategy of the code to be generated and the business data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
In a possible implementation manner, the service data of the code to be generated further includes a template type of the code to be generated;
acquiring the code template of the code to be generated according to the path information of the code template, wherein the method comprises the following steps:
acquiring a plurality of pre-stored code templates according to the path information of the code templates;
and determining the code template of the code to be generated from the plurality of pre-stored code templates according to the template type of the code to be generated.
In a possible implementation manner, the template type of the code to be generated includes any one of addition, deletion, modification and search.
In a possible implementation manner, the service data of the code to be generated further includes path information of the code file to be generated;
after the code file to be generated is obtained, the method further comprises the following steps:
and storing the code file to be generated to a position corresponding to the path information of the code file to be generated.
The embodiment of the invention provides a code generation device of a service function, which comprises:
the receiving unit is used for receiving an xml data template input by a user, wherein the xml data template comprises service data of a code to be generated;
the processing unit is used for analyzing the xml data template to obtain the service data of the code to be generated; the service data of the code to be generated comprises path information of a code template;
the receiving unit is further configured to obtain the code template of the code to be generated according to the path information of the code template;
and the processing unit is also used for analyzing and generating a code file to be generated according to the service data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
In a possible implementation manner, the service data of the code to be generated includes table structure data of the code to be generated;
the processing unit is specifically configured to:
and analyzing and generating the code file to be generated according to the table structure data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
In a possible implementation manner, the service data of the code to be generated includes association relation data of the code to be generated;
the processing unit is specifically configured to:
and analyzing and generating the code file to be generated according to the incidence relation data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
In one possible implementation, the incidence relation data includes any one of a one-to-one relation, a one-to-many relation, a many-to-one relation, and a many-to-many relation.
In a possible implementation manner, the service data of the code to be generated further includes presentation style data of the code to be generated;
the processing unit is specifically configured to:
analyzing and generating the code file to be generated according to the table structure data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology;
or
And analyzing and generating the code file to be generated according to the incidence relation data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
In one possible implementation, the presentation style data includes any one or more of a date, a time, a key-value pair, a drop-down box, a text box, and a multi-selection box.
In a possible implementation manner, the service data of the code to be generated further includes a generation policy of the code to be generated;
the processing unit is specifically configured to:
and analyzing and generating a code file to be generated according to the generation strategy of the code to be generated and the business data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
In a possible implementation manner, the service data of the code to be generated further includes a template type of the code to be generated;
the receiving unit is specifically configured to:
acquiring a plurality of pre-stored code templates according to the path information of the code templates;
and determining the code template of the code to be generated from the plurality of pre-stored code templates according to the template type of the code to be generated.
In a possible implementation manner, the template type of the code to be generated includes any one of addition, deletion, modification and search.
In a possible implementation manner, the service data of the code to be generated further includes path information of the code file to be generated;
the processing unit is further to:
and storing the code file to be generated to a position corresponding to the path information of the code file to be generated.
An apparatus having a function of implementing the code generation method for the service function described above is also provided in an embodiment of the present application. This function may be implemented by hardware executing corresponding software, and in one possible design, the apparatus includes: a processor, a transceiver, a memory; the memory is used for storing computer execution instructions, the transceiver is used for realizing the communication between the device and other communication entities, the processor is connected with the memory through the bus, and when the device runs, the processor executes the computer execution instructions stored by the memory so as to enable the device to execute the code generation method of the service function described above.
An embodiment of the present invention further provides a computer storage medium, where a software program is stored in the storage medium, and the software program, when being read and executed by one or more processors, implements the code generation method for the service function described in the foregoing various possible implementation manners.
Embodiments of the present invention further provide a computer program product containing instructions, which when run on a computer, cause the computer to execute the code generation method for the business function described in the foregoing various possible implementation manners.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings that are required to be used in the description of the embodiments will be briefly described below.
Fig. 1 is a schematic flowchart corresponding to a method for generating a code of a service function according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an overall process involved in an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a code generation apparatus for a service function according to an embodiment of the present invention.
Detailed Description
The present application will be described in detail below with reference to the accompanying drawings, and the specific operation methods in the method embodiments can also be applied to the apparatus embodiments.
Fig. 1 exemplarily shows a flow diagram corresponding to a code generation method for a business function provided by an embodiment of the present invention, and as shown in fig. 1, the method specifically includes the following steps:
step 101, receiving an xml data template input by a user.
And 102, analyzing the xml data template to obtain the service data of the code to be generated.
And 103, acquiring a code template of the code to be generated according to the path information of the code template.
And step 104, analyzing and generating a code file to be generated according to the service data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
It should be noted that the execution subject of the above steps 101 to 104 may be an automatic code generation tool, and a user may input an xml data template in the automatic code generation tool.
Therefore, the code can be automatically generated based on the xml data template, and the user can obtain the code file only by inputting the xml data template without manually compiling the code. By adopting the method provided by the embodiment of the invention, the time occupied by the repeated work of developers can be effectively reduced, and the research and development efficiency is greatly improved; furthermore, the code file in the embodiment of the invention is generated based on the xml data template, so that the method provided by the embodiment of the invention can facilitate the unified management of the code, and improve the readability and the development quality.
In step 101, when a specific service function is developed, a user may design an xml data template according to an xml metadata structure specification. According to the needs of the service functions, a user may design a plurality of xml data templates, or may also design an xml data template including a plurality of service functions, which is not limited specifically. And the management and tracking of the database table structure can be facilitated by adopting an xml data template mode. The xml data template may be determined according to an xml template, in other words, the xml template is a template provided by the code generation framework for the original template (or the xml template is a template defined by the code generation framework), and the xml data template is a data template generated specifically for a certain service code.
In steps 102 to 104, after receiving the xml data template, the automatic code generation tool may analyze the xml data template, so as to obtain the service data of the code to be generated.
Specifically, the xml data template may be analyzed according to the xml template to generate the service data required for code generation.
The business data of the code to be generated may include various types of content, for example, the business data of the code to be generated may include path information of a code template, table structure data of the code to be generated, association relation data of the code to be generated, presentation style data of the code to be generated, a generation policy of the code to be generated, a template type of the code to be generated, path information of a code file to be generated, and the like.
Various types of contents included in the service data to be code-generated will be specifically described below.
The path information of the code template may refer to a source of the code template corresponding to the code to be generated, and may be represented by a file storage path or an IP address.
The table structure data may be information defining a file name of the data table, determining fields included in the data table, and specifying a field name, a field type, a width, and the like of each field. In the embodiment of the invention, the table structure data mainly comprises basic table structure column information, indexes, unique keys, controllable information and the like.
The association relationship data of the code to be generated may be a one-to-one relationship, or may also be a one-to-many relationship, or may also be a many-to-one relationship, or may also be a many-to-many relationship, and the like, which is not limited specifically.
The display style data of the code to be generated may refer to a specific style in which the code to be generated is displayed, for example, the display style information may include information in various forms such as date, time, key value pair, drop-down box, text box, multi-choice box, and the like.
The generation policy of the code to be generated may include a generation range of the code, and whether the original code needs to be covered after the code is generated.
The template type of the code to be generated may refer to a template type of the generated code, and specifically includes template types such as add, delete, modify, and find.
The path information of the code file to be generated may refer to storage path information of the code file to be generated, and the path information of the code file to be generated may be represented by a file storage path or by an IP address or the like.
Further, in step 103, whether the service data of the code to be generated includes the template type of the code to be generated needs to be considered, and if the service data of the code to be generated includes the template type of the code to be generated, a plurality of pre-stored code templates may be obtained according to the path information of the code template, and then the code template of the code to be generated may be determined from the plurality of pre-stored code templates according to the template type of the code to be generated.
For example, as shown in table 1, an example of a plurality of pre-stored code templates is shown. If the path information of the code template is path 1, according to the contents shown in table 1, the code automatic generation tool acquires the pre-stored code templates from path 1, and the pre-stored code templates are code template a, code template B, and code template C. The type of the code template A is addition, the type of the code template B is deletion, and the type of the code template C is modification. If the template type of the code to be generated is incremental, it may be determined that the code template of the code to be generated is the code template a shown in table 1.
Table 1: an example of a plurality of pre-stored code templates
In the embodiment of the invention, the business data of the code to be generated obtained by analysis is different according to the different xml data templates input by the user, and further, the obtained code file to be generated is different. The following description will be made according to different contents included in the service data of the code to be generated.
Example one:
if the code generation tool obtains the service data of the code to be generated by analyzing the xml data template and includes the table structure data of the code to be generated and the path information of the code template, the code template of the code to be generated can be obtained according to the path information of the code template, and then the code automatic generation tool can generate the code file to be generated by analyzing according to the table structure data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
Freemaker is a template engine, a general-purpose tool that is based on templates and data to be changed and used to generate output text (HTML web pages, emails, configuration files, source code, etc.). freemaker is not end-user oriented, but rather a Java class library, a component that programmers can embed into the products they develop. The freemaker technology mainly comprises three parts of contents, namely a database script, a back-end java code template (an entity class, a DAO operation class, a business operation class, a control layer class and the like), and a front-end code template (comprising a plurality of angular pages, html pages and the like).
Example two:
if the code generation tool obtains the service data of the code to be generated by analyzing the xml data template, the path information of the code template, the table structure data of the code to be generated, and the incidence relation data of the code to be generated, the code template of the code to be generated can be obtained according to the path information of the code template, and then the code automatic generation tool can generate the code file to be generated by analyzing according to the table structure data of the code to be generated, the incidence relation data of the code to be generated, and the code template of the code to be generated by adopting a freemaker technology.
Example three:
if the code generation tool obtains the service data of the code to be generated by analyzing the xml data template, wherein the service data of the code to be generated comprises the path information of the code template, the table structure data of the code to be generated and the display style data of the code to be generated, the code template of the code to be generated can be obtained according to the path information of the code template, and then the code automatic generation tool can generate the code file to be generated by analyzing according to the table structure data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
Example four:
if the code generation tool obtains the service data of the code to be generated by analyzing the xml data template, the path information of the code template, the association relation data of the code to be generated and the display style data of the code to be generated, the code template of the code to be generated can be obtained according to the path information of the code template, and then the code automatic generation tool can generate the code file to be generated by analyzing according to the association relation data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
Example five:
if the code generation tool obtains the service data of the code to be generated by analyzing the xml data template, the service data of the code to be generated comprises the path information of the code template, the table structure data of the code to be generated, the incidence relation data of the code to be generated and the display style data of the code to be generated, the code template of the code to be generated can be obtained according to the path information of the code template, and then the code automatic generation tool can generate a code file to be generated by analyzing according to the table structure data of the code to be generated, the incidence relation data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
Example six:
if the code generation tool obtains the service data of the code to be generated by analyzing the xml data template, the service data of the code to be generated comprises the path information of the code template and the generation strategy of the code to be generated, the code template of the code to be generated can be obtained according to the path information of the code template, and then the code automatic generation tool can generate the code file to be generated by analyzing according to the generation strategy of the code to be generated and the service data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
Example seven:
if the code generation tool obtains the service data of the code to be generated by analyzing the xml data template, the path information of the code template, the list structure data of the code to be generated and the generation strategy of the code to be generated, the code template of the code to be generated can be obtained according to the path information of the code template, and then the code automatic generation tool can generate the code file to be generated by analyzing according to the list structure data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology according to the generation strategy of the code to be generated.
Example eight:
if the code generation tool obtains the service data of the code to be generated by analyzing the xml data template, the path information of the code template, the incidence relation data of the code to be generated and the generation strategy of the code to be generated, the code template of the code to be generated can be obtained according to the path information of the code template, and then the code automatic generation tool can generate the code file to be generated by analyzing according to the incidence relation data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology according to the generation strategy of the code to be generated.
Example nine:
if the code generation tool obtains the service data of the code to be generated by analyzing the xml data template, the service data of the code to be generated comprises the path information of the code template, the table structure data of the code to be generated, the display style data of the code to be generated and the generation strategy of the code to be generated, the code template of the code to be generated can be obtained according to the path information of the code template, and then the code automatic generation tool can generate a code file to be generated by analyzing according to the table structure data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology according to the generation strategy of the code to be generated.
Example ten:
if the code generation tool obtains the service data of the code to be generated by analyzing the xml data template, the path information of the code template, the incidence relation data of the code to be generated, the display style data of the code to be generated and the generation strategy of the code to be generated, the code template of the code to be generated can be obtained according to the path information of the code template, and then the code automatic generation tool can generate a code file to be generated by analyzing according to the incidence relation data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology according to the generation strategy of the code to be generated.
Example eleven:
if the code generation tool obtains the service data of the code to be generated by analyzing the xml data template, and the service data of the code to be generated comprises the path information of the code template, the table structure data of the code to be generated, the association relation data of the code to be generated, the display style data of the code to be generated and the generation strategy of the code to be generated, the code template of the code to be generated can be obtained according to the path information of the code template, and then the code automatic generation tool can generate the code file to be generated by analyzing according to the table structure data of the code to be generated, the association relation data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology according to the generation strategy of the code to be generated.
After the step 104 is executed, in consideration of the storage problem of the code file to be generated, in the embodiment of the present invention, the service data of the code to be generated, which is obtained by analyzing the xml data template, may further include path information of the code file to be generated, so that the code automatic generation tool may store the code file to be generated to a position corresponding to the path information of the code file to be generated after obtaining the code file to be generated.
In order to more clearly describe the code generation method of the service function, the flow involved in the embodiment of the present invention is generally described below with reference to fig. 2. As shown in fig. 2, the following steps may be included:
step 201, receiving an xml data template input by a user.
Step 202, the xml data template is parsed.
Step 203, a code template of the code to be generated is obtained.
And 204, analyzing and generating a code file to be generated according to the service data of the code to be generated and the code template of the code to be generated, which are obtained by analyzing, by adopting a freemaker technology.
And step 205, storing the code file to be generated to a position corresponding to the path information of the code file to be generated.
By adopting the code generation method provided by the embodiment of the invention, on one hand, the operation required to be executed by the user is simpler, only the input of the xml data template is needed, the method is simple and easy to use, and the time of the user is greatly saved; on the other hand, the xml data template has stronger expansibility, so that code files corresponding to multiple languages are generated conveniently; in another aspect, the embodiment of the invention can automatically generate the high-quality code file with the service function according to the user requirement, thereby avoiding the repeated development of codes by developers.
Based on the same conception, the code generating apparatus for service function provided by the embodiment of the present invention, as shown in fig. 3, includes a receiving unit 301, a processing unit 302; wherein,
a receiving unit 301, configured to receive an xml data template input by a user, where the xml data template includes service data of a code to be generated;
the processing unit 302 is configured to analyze the xml data template to obtain the service data of the code to be generated; the service data of the code to be generated comprises path information of a code template;
the receiving unit 301 is further configured to obtain a code template of the code to be generated according to the path information of the code template;
the processing unit 302 is further configured to generate a code file to be generated by analyzing the service data of the code to be generated and the code template of the code to be generated by using a freemaker technology.
In a possible implementation manner, the service data of the code to be generated includes table structure data of the code to be generated;
the processing unit 302 is specifically configured to:
and analyzing and generating the code file to be generated according to the table structure data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
In a possible implementation manner, the service data of the code to be generated includes association relation data of the code to be generated;
the processing unit 302 is specifically configured to:
and analyzing and generating the code file to be generated according to the incidence relation data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
In one possible implementation, the incidence relation data includes any one of a one-to-one relation, a one-to-many relation, a many-to-one relation, and a many-to-many relation.
In a possible implementation manner, the service data of the code to be generated further includes presentation style data of the code to be generated;
the processing unit 302 is specifically configured to:
analyzing and generating the code file to be generated according to the table structure data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology;
or
And analyzing and generating the code file to be generated according to the incidence relation data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
In one possible implementation, the presentation style data includes any one or more of a date, a time, a key-value pair, a drop-down box, a text box, and a multi-selection box.
In a possible implementation manner, the service data of the code to be generated further includes a generation policy of the code to be generated;
the processing unit 302 is specifically configured to:
and analyzing and generating a code file to be generated according to the generation strategy of the code to be generated and the business data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
In a possible implementation manner, the service data of the code to be generated further includes a template type of the code to be generated;
the receiving unit 301 is specifically configured to:
acquiring a plurality of pre-stored code templates according to the path information of the code templates;
and determining the code template of the code to be generated from the plurality of pre-stored code templates according to the template type of the code to be generated.
In a possible implementation manner, the template type of the code to be generated includes any one of addition, deletion, modification and search.
In a possible implementation manner, the service data of the code to be generated further includes path information of the code file to be generated;
the processing unit 302 is further configured to:
and storing the code file to be generated to a position corresponding to the path information of the code file to be generated.
An apparatus having a function of implementing the code generation method for the service function described above is also provided in an embodiment of the present application. This function may be implemented by hardware executing corresponding software, and in one possible design, the apparatus includes: a processor, a transceiver, a memory; the memory is used for storing computer execution instructions, the transceiver is used for realizing the communication between the device and other communication entities, the processor is connected with the memory through the bus, and when the device runs, the processor executes the computer execution instructions stored by the memory so as to enable the device to execute the code generation method of the service function described above.
An embodiment of the present invention further provides a computer storage medium, where a software program is stored in the storage medium, and the software program, when being read and executed by one or more processors, implements the code generation method for the service function described in the foregoing various possible implementation manners.
Embodiments of the present invention further provide a computer program product containing instructions, which when run on a computer, cause the computer to execute the code generation method for the business function described in the foregoing various possible implementation manners.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.
Claims (22)
1. A method for code generation for a business function, the method comprising:
receiving an xml data template input by a user, wherein the xml data template comprises service data of a code to be generated;
analyzing the xml data template to obtain the service data of the code to be generated; the service data of the code to be generated comprises path information of a code template;
acquiring the code template of the code to be generated according to the path information of the code template;
and analyzing and generating a code file to be generated according to the service data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
2. The method according to claim 1, wherein the service data of the code to be generated comprises table structure data of the code to be generated;
analyzing and generating a code file to be generated according to the service data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology, wherein the method comprises the following steps:
and analyzing and generating the code file to be generated according to the table structure data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
3. The method according to claim 1, wherein the service data of the code to be generated comprises association relation data of the code to be generated;
analyzing and generating a code file to be generated according to the service data and the code template of the code to be generated by adopting a freemaker technology, wherein the method comprises the following steps:
and analyzing and generating the code file to be generated according to the incidence relation data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
4. The method of claim 3, wherein the incidence relation data comprises any one of a one-to-one relation, a one-to-many relation, a many-to-one relation, and a many-to-many relation.
5. The method according to claim 2 or 3, wherein the business data of the code to be generated further comprises presentation style data of the code to be generated;
analyzing and generating a code file to be generated according to the service data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology, wherein the method comprises the following steps:
analyzing and generating the code file to be generated according to the table structure data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology;
or
And analyzing and generating the code file to be generated according to the incidence relation data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
6. The method of claim 5, wherein the presentation style data comprises any one or more of a date, a time, a key-value pair, a drop-down box, a text box, and a multi-selection box.
7. The method according to claim 1, wherein the service data of the code to be generated further comprises a generation policy of the code to be generated;
analyzing and generating a code file to be generated according to the service data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology, wherein the method comprises the following steps:
and analyzing and generating a code file to be generated according to the generation strategy of the code to be generated and the business data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
8. The method according to claim 1, wherein the traffic data of the code to be generated further comprises a template type of the code to be generated;
acquiring the code template of the code to be generated according to the path information of the code template, wherein the method comprises the following steps:
acquiring a plurality of pre-stored code templates according to the path information of the code templates;
and determining the code template of the code to be generated from the plurality of pre-stored code templates according to the template type of the code to be generated.
9. The method of claim 8, wherein the template type of the code to be generated comprises any one of addition, deletion, modification and search.
10. The method according to claim 1, wherein the service data of the code to be generated further includes path information of the code file to be generated;
after the code file to be generated is obtained, the method further comprises the following steps:
and storing the code file to be generated to a position corresponding to the path information of the code file to be generated.
11. An apparatus for code generation for a business function, the apparatus comprising:
the receiving unit is used for receiving an xml data template input by a user, wherein the xml data template comprises service data of a code to be generated;
the processing unit is used for analyzing the xml data template to obtain the service data of the code to be generated; the service data of the code to be generated comprises path information of a code template;
the receiving unit is further configured to obtain the code template of the code to be generated according to the path information of the code template;
and the processing unit is also used for analyzing and generating a code file to be generated according to the service data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
12. The apparatus according to claim 11, wherein the service data of the code to be generated includes table structure data of the code to be generated;
the processing unit is specifically configured to:
and analyzing and generating the code file to be generated according to the table structure data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
13. The apparatus according to claim 11, wherein the service data of the code to be generated includes association relation data of the code to be generated;
the processing unit is specifically configured to:
and analyzing and generating the code file to be generated according to the incidence relation data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
14. The apparatus of claim 13, wherein the incidence relation data comprises any one of a one-to-one relation, a one-to-many relation, a many-to-one relation, and a many-to-many relation.
15. The apparatus according to claim 12 or 13, wherein the business data of the code to be generated further comprises presentation style data of the code to be generated;
the processing unit is specifically configured to:
analyzing and generating the code file to be generated according to the table structure data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology;
or
And analyzing and generating the code file to be generated according to the incidence relation data of the code to be generated, the display style data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
16. The apparatus of claim 15, wherein the presentation style data comprises any one or more of a date, a time, a key-value pair, a drop-down box, a text box, and a multi-selection box.
17. The apparatus according to claim 11, wherein the traffic data of the code to be generated further includes a generation policy of the code to be generated;
the processing unit is specifically configured to:
and analyzing and generating a code file to be generated according to the generation strategy of the code to be generated and the business data of the code to be generated and the code template of the code to be generated by adopting a freemaker technology.
18. The apparatus of claim 11, wherein the traffic data of the code to be generated further comprises a template type of the code to be generated;
the receiving unit is specifically configured to:
acquiring a plurality of pre-stored code templates according to the path information of the code templates;
and determining the code template of the code to be generated from the plurality of pre-stored code templates according to the template type of the code to be generated.
19. The apparatus of claim 18, wherein the template type of the code to be generated comprises any one of addition, deletion, modification, and search.
20. The apparatus according to claim 11, wherein the service data of the code to be generated further includes path information of the code file to be generated;
the processing unit is further to:
and storing the code file to be generated to a position corresponding to the path information of the code file to be generated.
21. A computer-readable storage medium, characterized in that the storage medium stores instructions that, when executed on a computer, cause the computer to carry out the method of any one of claims 1 to 10.
22. A computer device, comprising:
a memory for storing program instructions;
a processor for calling program instructions stored in said memory to execute the method of any one of claims 1 to 10 in accordance with the obtained program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811326421.8A CN109522013A (en) | 2018-11-08 | 2018-11-08 | A kind of code generating method and device of business function |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811326421.8A CN109522013A (en) | 2018-11-08 | 2018-11-08 | A kind of code generating method and device of business function |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109522013A true CN109522013A (en) | 2019-03-26 |
Family
ID=65774401
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811326421.8A Pending CN109522013A (en) | 2018-11-08 | 2018-11-08 | A kind of code generating method and device of business function |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109522013A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110032369A (en) * | 2019-04-24 | 2019-07-19 | 成都市映潮科技股份有限公司 | A kind of code automatic generation method, device and medium |
CN110262792A (en) * | 2019-06-28 | 2019-09-20 | 四川长虹电器股份有限公司 | The method that visualization deletes and adds key-value pair is realized by Angular |
CN110457021A (en) * | 2019-07-12 | 2019-11-15 | 招商局金融科技有限公司 | Achievement data processing method, device and computer readable storage medium |
CN112015429A (en) * | 2020-08-21 | 2020-12-01 | 杭州指令集智能科技有限公司 | Code generation method, device and equipment |
CN112835564A (en) * | 2021-01-27 | 2021-05-25 | 北京海博思创科技股份有限公司 | Code generation method and device |
CN113590115A (en) * | 2021-07-30 | 2021-11-02 | 北京国腾联信科技有限公司 | Method and device for automatically generating service system code |
CN114035803A (en) * | 2022-01-10 | 2022-02-11 | 深圳市明源云科技有限公司 | Code automatic generation method, device, equipment and computer readable storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100229151A1 (en) * | 2009-03-06 | 2010-09-09 | Gm Global Technology Operations, Inc. | Platform-independent method and system for deploying control logic programming |
CN103500087A (en) * | 2013-09-17 | 2014-01-08 | 福建亿榕信息技术有限公司 | Code generation method and device based on maven plug-in and freemarker template |
CN105260189A (en) * | 2015-11-02 | 2016-01-20 | 江苏马上游科技股份有限公司 | Code generating method and system based on model driving |
CN106250164A (en) * | 2016-08-16 | 2016-12-21 | 广州仕邦人力资源有限公司 | A kind of code generating method based on requirement documents and device |
CN108762764A (en) * | 2018-06-05 | 2018-11-06 | 中国平安人寿保险股份有限公司 | Code automatic generation method, device, computer equipment and storage medium |
-
2018
- 2018-11-08 CN CN201811326421.8A patent/CN109522013A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100229151A1 (en) * | 2009-03-06 | 2010-09-09 | Gm Global Technology Operations, Inc. | Platform-independent method and system for deploying control logic programming |
CN103500087A (en) * | 2013-09-17 | 2014-01-08 | 福建亿榕信息技术有限公司 | Code generation method and device based on maven plug-in and freemarker template |
CN105260189A (en) * | 2015-11-02 | 2016-01-20 | 江苏马上游科技股份有限公司 | Code generating method and system based on model driving |
CN106250164A (en) * | 2016-08-16 | 2016-12-21 | 广州仕邦人力资源有限公司 | A kind of code generating method based on requirement documents and device |
CN108762764A (en) * | 2018-06-05 | 2018-11-06 | 中国平安人寿保险股份有限公司 | Code automatic generation method, device, computer equipment and storage medium |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110032369A (en) * | 2019-04-24 | 2019-07-19 | 成都市映潮科技股份有限公司 | A kind of code automatic generation method, device and medium |
CN110262792A (en) * | 2019-06-28 | 2019-09-20 | 四川长虹电器股份有限公司 | The method that visualization deletes and adds key-value pair is realized by Angular |
CN110457021A (en) * | 2019-07-12 | 2019-11-15 | 招商局金融科技有限公司 | Achievement data processing method, device and computer readable storage medium |
CN112015429A (en) * | 2020-08-21 | 2020-12-01 | 杭州指令集智能科技有限公司 | Code generation method, device and equipment |
CN112835564A (en) * | 2021-01-27 | 2021-05-25 | 北京海博思创科技股份有限公司 | Code generation method and device |
CN113590115A (en) * | 2021-07-30 | 2021-11-02 | 北京国腾联信科技有限公司 | Method and device for automatically generating service system code |
CN114035803A (en) * | 2022-01-10 | 2022-02-11 | 深圳市明源云科技有限公司 | Code automatic generation method, device, equipment and computer readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109522013A (en) | A kind of code generating method and device of business function | |
US9361068B2 (en) | System and method for using development objectives to guide implementation of source code | |
US8434062B2 (en) | Enhancing source code debugging and readability using visual symbols | |
WO2018228211A1 (en) | Application conversion method, apparatus and device | |
US9977659B2 (en) | Managing data set objects | |
CN106062711B (en) | Method, system, and computer storage medium for compound controls | |
US20130166550A1 (en) | Integration of Tags and Object Data | |
US20140306964A1 (en) | Incremental compiling of a declarative program | |
US8661065B2 (en) | Systems and methods for providing a data glossary management system | |
US9898259B2 (en) | Data binding for model-based code generation | |
US9141344B2 (en) | Hover help support for application source code | |
CN107943465B (en) | Method and device for generating HTML form | |
CN107391528B (en) | Front-end component dependent information searching method and equipment | |
US8949785B2 (en) | Custom compound types in declarative programs | |
Kasalica et al. | APE: A command-line tool and API for automated workflow composition | |
Ledur et al. | A high-level dsl for geospatial visualizations with multi-core parallelism support | |
CN105867886B (en) | Method and device for writing table | |
US11977473B2 (en) | Providing a pseudo language for manipulating complex variables of an orchestration flow | |
KR20130068601A (en) | Apparatus and method for dynamic customization and execution of query based software logic for multitenant | |
US20070226690A1 (en) | In source code suppression of binary analysis | |
Andrei et al. | Introduction to GAMS technology | |
CN108536696A (en) | A kind of database personalized self-service query platform and method | |
Brinkrolf et al. | OMPetri-A Software Application for Modeling and Simulation Using Extended Hybrid Petri Nets by Employing OpenModelica | |
Yadav et al. | Comparative Analysis of API Integration using Code Vs No-code, low-code Platforms | |
Waszkowski et al. | Generating Complex Dynamic Forms in Low-Code Development Platforms |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190326 |
|
RJ01 | Rejection of invention patent application after publication |