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 PDF

Info

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
business datum
data
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
Application number
CN201811326421.8A
Other languages
Chinese (zh)
Inventor
洪形势
王梦杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wangsu Science and Technology Co Ltd
Original Assignee
Wangsu Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wangsu Science and Technology Co Ltd filed Critical Wangsu Science and Technology Co Ltd
Priority to CN201811326421.8A priority Critical patent/CN109522013A/en
Publication of CN109522013A publication Critical patent/CN109522013A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/14Tree-structured documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates

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

A kind of code generating method and device of business function
Technical field
The present invention relates to technical field of software engineering more particularly to the code generating methods and device of a kind of business function.
Background technique
With the continuous development of information technology, all trades and professions are growing day by day to the demand of various softwares, and various softwares produce Product also emerge one after another.In face of the demand of huge software product, developer needs first to be designed table structure to software product, Then it executes database table structure script and creates table, then write back-end code, and write front-end code.Whole flow process operation is numerous It is trivial, developer's a large amount of time is consumed, and since developer's level is different, can not guarantee software product well Readable and quality.
Based on this, a kind of code generating method of business function is needed at present, is developed for developer in the prior art Time-consuming for software product, low-quality problem.
Summary of the invention
The embodiment of the present invention provides the code generating method and device of a kind of business function, to solve to develop in the prior art Time-consuming for staff development software product, low-quality technical problem.
The embodiment of the present invention provides a kind of code generating method of business function, which comprises
The xml data template of user's input is received, the xml data template includes the business datum of code to be generated;
The xml data template is parsed, the business datum of the code to be generated is obtained;The business of the code to be generated Data include the routing information of Code Template;
According to the routing information of the Code Template, the Code Template of the code to be generated is obtained;
Using freemaker technology according to the business datum of the code to be generated and the code mould of the code to be generated Plate, parsing generate code file to be generated.
In this way, the embodiment of the present invention can realize automatically generating for code based on xml data template, user only needs defeated Enter xml data template, is not necessarily to manual compiling code, code file can be obtained.Using method provided in an embodiment of the present invention, energy Developer's repetitive operation occupied time is enough effectively reduced, efficiency of research and development is substantially increased;Further, due to this hair Code file in bright embodiment is generated based on xml data template, and therefore, method provided in an embodiment of the present invention can be just In the unitized management of code, readable and development quality is improved.
In one possible implementation, the business datum of the code to be generated includes the table structure of code to be generated Data;
Using freemaker technology according to the business datum of the code to be generated and the code mould of the code to be generated Plate, parsing generate code file to be generated, comprising:
Using freemaker technology according to the list structured data of the code to be generated and the code of the code to be generated Template, parsing generate the code file to be generated.
In one possible implementation, the business datum of the code to be generated includes that the association of code to be generated is closed Coefficient evidence;
Using freemaker technology according to the Code Template of the business datum and the code to be generated, parsing is generated Code file to be generated, comprising:
Using freemaker technology according to the incidence relation data of the code to be generated and the generation of the code to be generated Code mask, parsing generate the code file to be generated.
In one possible implementation, the incidence relation data include one-one relationship, it is many-one relationship, multipair Any one of one relationship, many-to-many relationship.
In one possible implementation, the business datum of the code to be generated further includes the code to be generated Show style data;
Using freemaker technology according to the business datum of the code to be generated and the code mould of the code to be generated Plate, parsing generate code file to be generated, comprising:
Using freemaker technology according to the displaying of the list structured data, the code to be generated of the code to be generated The Code Template of style data and the code to be generated, parsing generate the code file to be generated;
Or
Using freemaker technology according to the exhibition of the incidence relation data, the code to be generated of the code to be generated Show the Code Template of style data and the code to be generated, parsing generates the code file to be generated.
In one possible implementation, the displaying style data includes date, time, key-value pair, combobox, text This frame, any one in multiselect frame or any multinomial.
In one possible implementation, the business datum of the code to be generated further includes the code to be generated Generation strategy;
Using freemaker technology according to the business datum of the code to be generated and the code mould of the code to be generated Plate, parsing generate code file to be generated, comprising:
According to the generation strategy of the code to be generated, using freemaker technology according to the industry of the code to be generated The Code Template for the data and the code to be generated of being engaged in, parsing generate code file to be generated.
In one possible implementation, the business datum of the code to be generated further includes the code to be generated Template type;
According to the routing information of the Code Template, the Code Template of the code to be generated is obtained, comprising:
According to the routing information of the Code Template, multiple pre-stored Code Templates are obtained;
According to the template type of the code to be generated, determined from the multiple pre-stored Code Template it is described to Generate the Code Template of code.
In one possible implementation, the template type of the code to be generated includes increasing, deleting, modifying, looking into Any one in looking for.
In one possible implementation, the business datum of the code to be generated further includes the code text to be generated The routing information of part;
It is described obtain code file to be generated after, further includes:
The code file to be generated is stored into position corresponding to the routing information to the code file to be generated.
The embodiment of the present invention provides a kind of code generating unit of business function, and described device includes:
Take-up unit, for receiving the xml data template of user's input, the xml data template includes code to be generated Business datum;
Processing unit obtains the business datum of the code to be generated for parsing the xml data template;It is described to The business datum for generating code includes the routing information of Code Template;
The take-up unit is also used to the routing information according to the Code Template, obtains the generation of the code to be generated Code mask;
The processing unit is also used to using business datum and institute of the freemaker technology according to the code to be generated The Code Template of code to be generated is stated, parsing generates code file to be generated.
In one possible implementation, the business datum of the code to be generated includes the table structure of code to be generated Data;
The processing unit is specifically used for:
Using freemaker technology according to the list structured data of the code to be generated and the code of the code to be generated Template, parsing generate the code file to be generated.
In one possible implementation, the business datum of the code to be generated includes that the association of code to be generated is closed Coefficient evidence;
The processing unit is specifically used for:
Using freemaker technology according to the incidence relation data of the code to be generated and the generation of the code to be generated Code mask, parsing generate the code file to be generated.
In one possible implementation, the incidence relation data include one-one relationship, it is many-one relationship, multipair Any one of one relationship, many-to-many relationship.
In one possible implementation, the business datum of the code to be generated further includes the code to be generated Show style data;
The processing unit is specifically used for:
Using freemaker technology according to the displaying of the list structured data, the code to be generated of the code to be generated The Code Template of style data and the code to be generated, parsing generate the code file to be generated;
Or
Using freemaker technology according to the exhibition of the incidence relation data, the code to be generated of the code to be generated Show the Code Template of style data and the code to be generated, parsing generates the code file to be generated.
In one possible implementation, the displaying style data includes date, time, key-value pair, combobox, text This frame, any one in multiselect frame or any multinomial.
In one possible implementation, the business datum of the code to be generated further includes the code to be generated Generation strategy;
The processing unit is specifically used for:
According to the generation strategy of the code to be generated, using freemaker technology according to the industry of the code to be generated The Code Template for the data and the code to be generated of being engaged in, parsing generate code file to be generated.
In one possible implementation, the business datum of the code to be generated further includes the code to be generated Template type;
The take-up unit is specifically used for:
According to the routing information of the Code Template, multiple pre-stored Code Templates are obtained;
According to the template type of the code to be generated, determined from the multiple pre-stored Code Template it is described to Generate the Code Template of code.
In one possible implementation, the template type of the code to be generated includes increasing, deleting, modifying, looking into Any one in looking for.
In one possible implementation, the business datum of the code to be generated further includes the code text to be generated The routing information of part;
The processing unit is also used to:
The code file to be generated is stored into position corresponding to the routing information to the code file to be generated.
The embodiment of the present application also provides a kind of device, which has the code for realizing business function as described above The function of generation method.The function can execute corresponding software realization by hardware, in a kind of possible design, the device It include: processor, transceiver, memory;The memory is for storing computer executed instructions, and the transceiver is for realizing the dress It sets and is communicated with other communication entities, which is connect with the memory by the bus, when the apparatus is operative, at this Reason device executes the computer executed instructions of memory storage, so that the device executes the generation of business function as described above Code generating method.
The embodiment of the present invention also provides a kind of computer storage medium, stores software program in the storage medium, this is soft Part program realizes industry described in above-mentioned various possible implementations when being read and executed by one or more processors The code generating method for function of being engaged in.
The embodiment of the present invention also provides a kind of computer program product comprising instruction, when run on a computer, So that computer executes the code generating method of business function described in above-mentioned various possible implementations.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly introduced.
Fig. 1 is flow diagram corresponding to a kind of code generating method of business function provided in an embodiment of the present invention;
Fig. 2 is the schematic diagram of globality process involved in the embodiment of the present invention;
Fig. 3 is a kind of structural schematic diagram of the code generating unit of business function provided in an embodiment of the present invention.
Specific embodiment
The application is specifically described with reference to the accompanying drawings of the specification, the concrete operation method in embodiment of the method can also To be applied in Installation practice.
Fig. 1 illustrates stream corresponding to a kind of code generating method of business function provided in an embodiment of the present invention Journey schematic diagram, as shown in Figure 1, specifically comprising the following steps:
Step 101, the xml data template of user's input is received.
Step 102, xml data template is parsed, the business datum of code to be generated is obtained.
Step 103, according to the routing information of Code Template, the Code Template of code to be generated is obtained.
Step 104, using freemaker technology according to the business datum of code to be generated and the code mould of code to be generated Plate, parsing generate code file to be generated.
It should be noted that the executing subject of above-mentioned steps 101 to step 104 can be Code automatic build tool, use Family can input xml data template in Code automatic build tool.
In this way, the embodiment of the present invention can realize automatically generating for code based on xml data template, user only needs defeated Enter xml data template, is not necessarily to manual compiling code, code file can be obtained.Using method provided in an embodiment of the present invention, energy Developer's repetitive operation occupied time is enough effectively reduced, efficiency of research and development is substantially increased;Further, due to this hair Code file in bright embodiment is generated based on xml data template, and therefore, method provided in an embodiment of the present invention can be just In the unitized management of code, readable and development quality is improved.
In step 101, when carrying out the exploitation of specific business function, user can set according to xml metadata structure specification Count xml data template.According to the needs of business function, user can design multiple xml data templates, or can also design one A xml data template comprising multiple business functions, specifically without limitation.It, can be convenient for number by the way of xml data template According to the management and tracking of database table structure.Wherein, xml data template, which can be according to xml template, determines, in other words, xml mould Plate is that code generating framework provides primary template (xml template is template that code generating framework defines in other words), and xml data Template is specific to the data template of some service code generation.
In step 102 to step 104, Code automatic build tool, can be to xml after receiving xml data template Data template is parsed, to obtain the business datum of code to be generated.
Specifically, xml data template can be parsed according to xml template, business datum required for code building is generated.
The business datum of code to be generated may include a plurality of types of contents, for example the business datum of code to be generated can To include the incidence relation data, to be generated of the routing information of Code Template, the list structured data of code to be generated, code to be generated At displaying style data, the generation strategy of code to be generated, the template type of code to be generated, code file to be generated of code Routing information etc..
Specifically introduce various types of contents included by the business datum of code to be generated below.
The routing information of Code Template can refer to the source of the corresponding Code Template of code to be generated, the road of Code Template Diameter information can store path by file, or be showed by forms such as IP address.
List structured data, which can refer to, is defined data list file name, determines the field that tables of data includes, each field The information such as field name, field type, width.In the embodiment of the present invention, list structured data mainly includes the table structure column on basis Information, index, unique key, whether the information such as controllable.
The incidence relation data of code to be generated can be one-one relationship, be perhaps also possible to many-one relationship or Be also possible to many-to-one relationship, or can also be many-to-many relationship etc., specifically without limitation.
The displaying style data of code to be generated can refer to the specific style that code to be generated is shown, for example, exhibition Show that style information may include the information of the diversified forms such as date, time, key-value pair, combobox, text box, multiselect frame.
Whether the generation strategy of code to be generated may include the formation range of code, need to cover after code building original The information such as code.
The template type of code to be generated can refer to the template type of the code of generation, specifically include increase, delete, repair The template types such as change, search.
The routing information of code file to be generated can refer to the store path information of code file to be generated, generation to be generated The routing information of code file can store path by file, or be showed by forms such as IP address.
Further, in step 103, it obtains and states the Code Template of code to be generated and also need to consider the industry of code to be generated Whether include the template type of code to be generated in business data, if including generation to be generated in the business datum of code to be generated The template type of code then can obtain multiple pre-stored Code Templates first according to the routing information of Code Template, further according to The template type of code to be generated determines the Code Template of code to be generated from multiple pre-stored Code Templates.
It for example, as shown in table 1, is a kind of example of multiple pre-stored Code Templates.If the road of Code Template Diameter information is path 1, according to the content shown in table 1, pre-stored generation that Code automatic build tool is got according to path 1 Code mask is Code Template A, Code Template B and Code Template C.Wherein, the type of Code Template A is to increase, Code Template B's Type is to delete, and the type of Code Template C is modification.If the template type of code to be generated is to increase, can determine to be generated Code Template at code is Code Template A shown in table 1.
A kind of table 1: example of multiple pre-stored Code Templates
In the embodiment of the present invention, according to user input xml data template difference, the code to be generated parsed Business datum is also different, and in turn, obtained code file to be generated is also different.It below will be according to the business datum of code to be generated Included different content is illustrated.
Example one:
If Code Generator by parsing xml data template, obtains including to be generated in the business datum of code to be generated At the list structured data of code and the routing information of Code Template, then, can be obtained according to the routing information of Code Template to The Code Template of code is generated, in turn, Code automatic build tool can be using freemaker technology according to code to be generated The Code Template of list structured data and code to be generated, parsing generate code file to be generated.
Wherein, freemaker is a template engine, i.e., a kind of based on template and the data to be changed, and is used to generate Export the general utility tool of text (html web page, Email, configuration file, source code etc.).Freemaker is not towards final User's, but a java class library, it is the component that a programmer can be embedded in their institute's developments.Freemaker skill Art mainly includes the content of three parts, i.e. database script, and (entity class, DAO operate class, business to rear end java Code Template Operate class, control layer class etc.), front-end code template (includes multiple angular and html pages etc.), using freemaker skill Art, which can automate, generates corresponding database script, front-end code and back-end code, can save a large amount of repeatability and grind Work is sent out, efficiency of research and development is improved, guarantees research and development quality.
Example two:
If Code Generator by parsing xml data template, obtains including code in the business datum of code to be generated The list structured data of the routing information of template, code to be generated, and obtaining the incidence relation data of code to be generated then can To obtain the Code Template of code to be generated according to the routing information of Code Template, in turn, Code automatic build tool can be with Using freemaker technology according to the list structured data of code to be generated, incidence relation data of code to be generated and to be generated The Code Template of code, parsing generate code file to be generated.
Example three:
If Code Generator by parsing xml data template, obtains including code in the business datum of code to be generated The displaying style data of the routing information of template, the list structured data of code to be generated and code to be generated then can be according to generation The routing information of code mask obtains the Code Template of code to be generated, and in turn, Code automatic build tool can use Freemaker technology is according to the list structured data of code to be generated, the displaying style data of code to be generated and code to be generated Code Template, parsing generates the code file to be generated.
Example four:
If Code Generator by parsing xml data template, obtains including code in the business datum of code to be generated The displaying style data of the routing information of template, the incidence relation data of code to be generated and code to be generated then can basis The routing information of Code Template obtains the Code Template of code to be generated, and in turn, Code automatic build tool can use Freemaker technology is according to the incidence relation data of code to be generated, the displaying style data of code to be generated and generation to be generated The Code Template of code, parsing generate code file to be generated.
Example five:
If Code Generator by parsing xml data template, obtains including code in the business datum of code to be generated The routing information of template, the list structured data of code to be generated, the incidence relation data of code to be generated and code to be generated Show that style data then can obtain the Code Template of code to be generated, in turn, generation according to the routing information of Code Template Code Auto-Generation Tool can be using freemaker technology according to the list structured data of code to be generated, the pass of code to be generated Join the Code Template for showing style data and code to be generated of relation data, code to be generated, parsing generates code to be generated File.
Example six:
If Code Generator by parsing xml data template, obtains including code in the business datum of code to be generated The generation strategy of the routing information of template, code to be generated can then obtain to be generated according to the routing information of Code Template The Code Template of code, in turn, Code automatic build tool can be used according to the generation strategy of code to be generated Freemaker technology generates generation to be generated according to the business datum of code to be generated and the Code Template of code to be generated, parsing Code file.
Example seven:
If Code Generator by parsing xml data template, obtains including code in the business datum of code to be generated The generation strategy of the routing information of template, the list structured data of code to be generated and code to be generated then can be according to code mould The routing information of plate obtains the Code Template of code to be generated, and in turn, Code automatic build tool can be according to generation to be generated The generation strategy of code, using freemaker technology according to the list structured data of code to be generated and the code mould of code to be generated Plate, parsing generate code file to be generated.
Example eight:
If Code Generator by parsing xml data template, obtains including code in the business datum of code to be generated The generation strategy of the routing information of template, the incidence relation data of code to be generated and code to be generated then can be according to code The routing information of template obtains the Code Template of code to be generated, and in turn, Code automatic build tool can be according to be generated The generation strategy of code, using freemaker technology according to the incidence relation data of code to be generated and the generation of code to be generated Code mask, parsing generate code file to be generated.
Example nine:
If Code Generator by parsing xml data template, obtains including code in the business datum of code to be generated The routing information of template, the list structured data of code to be generated, code to be generated show style data and code to be generated Generation strategy then can obtain the Code Template of code to be generated according to the routing information of Code Template, and in turn, code is certainly Dynamic Core Generator can be according to the generation strategy of code to be generated, using freemaker technology according to the table knot of code to be generated Structure data, the Code Template for showing style data and code to be generated of code to be generated, parsing generate code file to be generated.
Example ten:
If Code Generator by parsing xml data template, obtains including code in the business datum of code to be generated The routing information of template, the incidence relation data of code to be generated, code to be generated displaying style data and code to be generated Generation strategy the Code Template of code to be generated, in turn, code then can be obtained according to the routing information of Code Template Auto-Generation Tool can be according to the generation strategy of code to be generated, using freemaker technology according to the pass of code to be generated Join the Code Template for showing style data and code to be generated of relation data, code to be generated, parsing generates code to be generated File.
Example 11:
If Code Generator by parsing xml data template, obtains including code in the business datum of code to be generated The exhibition of the incidence relation data, code to be generated of the routing information of template, the list structured data of code to be generated, code to be generated Show the generation strategy of style data and code to be generated, then, generation to be generated can be obtained according to the routing information of Code Template The Code Template of code, in turn, Code automatic build tool can be according to the generation strategy of code to be generated, using freemaker Technology is according to the list structured data of code to be generated, the incidence relation data of code to be generated, the displaying style of code to be generated The Code Template of data and code to be generated, parsing generate code file to be generated.
After executing above-mentioned steps 104, it is contemplated that the storage problem of code file to be generated, in the embodiment of the present invention, It can also include the path letter of code file to be generated in the business datum for the code to be generated that parsing xml data template obtains Breath, in this way, Code automatic build tool after obtaining code file to be generated, code file to be generated can be stored to Generate position corresponding to the routing information of code file.
In order to more clearly introduce the code generating method of above-mentioned business function, below with reference to Fig. 2, to the embodiment of the present invention In involved process carry out globality explanation.As shown in Fig. 2, may comprise steps of:
Step 201, the xml data template of user's input is received.
Step 202, xml data template is parsed.
Step 203, the Code Template of code to be generated is obtained.
Step 204, using freemaker technology according to the business datum and generation to be generated for parsing obtained code to be generated The Code Template of code, parsing generate code file to be generated.
Step 205, code file to be generated is stored into position corresponding to the routing information to code file to be generated.
Using code generating method provided in an embodiment of the present invention, on the one hand, the operation executed needed for user is fairly simple, Only need to carry out the input of xml data template, it is easy to use, the time of user is greatly saved;On the other hand, xml number It is stronger according to the scalability of template, convenient for generating the corresponding code file of multilingual;Another aspect, the embodiment of the present invention being capable of roots The code file that the business function of high quality is automatically generated according to user demand avoids developer's overlapping development code.
Based on same idea, a kind of code generating unit of business function provided in an embodiment of the present invention, as shown in figure 3, The device includes take-up unit 301, processing unit 302;Wherein,
Take-up unit 301, for receiving the xml data template of user's input, the xml data template includes generation to be generated The business datum of code;
Processing unit 302 obtains the business datum of the code to be generated for parsing the xml data template;It is described The business datum of code to be generated includes the routing information of Code Template;
The take-up unit 301 is also used to the routing information according to the Code Template, obtains the code to be generated Code Template;
The processing unit 302, be also used to using freemaker technology according to the business datum of the code to be generated and The Code Template of the code to be generated, parsing generate code file to be generated.
In one possible implementation, the business datum of the code to be generated includes the table structure of code to be generated Data;
The processing unit 302 is specifically used for:
Using freemaker technology according to the list structured data of the code to be generated and the code of the code to be generated Template, parsing generate the code file to be generated.
In one possible implementation, the business datum of the code to be generated includes that the association of code to be generated is closed Coefficient evidence;
The processing unit 302 is specifically used for:
Using freemaker technology according to the incidence relation data of the code to be generated and the generation of the code to be generated Code mask, parsing generate the code file to be generated.
In one possible implementation, the incidence relation data include one-one relationship, it is many-one relationship, multipair Any one of one relationship, many-to-many relationship.
In one possible implementation, the business datum of the code to be generated further includes the code to be generated Show style data;
The processing unit 302 is specifically used for:
Using freemaker technology according to the displaying of the list structured data, the code to be generated of the code to be generated The Code Template of style data and the code to be generated, parsing generate the code file to be generated;
Or
Using freemaker technology according to the exhibition of the incidence relation data, the code to be generated of the code to be generated Show the Code Template of style data and the code to be generated, parsing generates the code file to be generated.
In one possible implementation, the displaying style data includes date, time, key-value pair, combobox, text This frame, any one in multiselect frame or any multinomial.
In one possible implementation, the business datum of the code to be generated further includes the code to be generated Generation strategy;
The processing unit 302 is specifically used for:
According to the generation strategy of the code to be generated, using freemaker technology according to the industry of the code to be generated The Code Template for the data and the code to be generated of being engaged in, parsing generate code file to be generated.
In one possible implementation, the business datum of the code to be generated further includes the code to be generated Template type;
The take-up unit 301 is specifically used for:
According to the routing information of the Code Template, multiple pre-stored Code Templates are obtained;
According to the template type of the code to be generated, determined from the multiple pre-stored Code Template it is described to Generate the Code Template of code.
In one possible implementation, the template type of the code to be generated includes increasing, deleting, modifying, looking into Any one in looking for.
In one possible implementation, the business datum of the code to be generated further includes the code text to be generated The routing information of part;
The processing unit 302 is also used to:
The code file to be generated is stored into position corresponding to the routing information to the code file to be generated.
The embodiment of the present application also provides a kind of device, which has the code for realizing business function as described above The function of generation method.The function can execute corresponding software realization by hardware, in a kind of possible design, the device It include: processor, transceiver, memory;The memory is for storing computer executed instructions, and the transceiver is for realizing the dress It sets and is communicated with other communication entities, which is connect with the memory by the bus, when the apparatus is operative, at this Reason device executes the computer executed instructions of memory storage, so that the device executes the generation of business function as described above Code generating method.
The embodiment of the present invention also provides a kind of computer storage medium, stores software program in the storage medium, this is soft Part program realizes industry described in above-mentioned various possible implementations when being read and executed by one or more processors The code generating method for function of being engaged in.
The embodiment of the present invention also provides a kind of computer program product comprising instruction, when run on a computer, So that computer executes the code generating method of business function described in above-mentioned various possible implementations.
It should be understood by those skilled in the art that, the embodiment of the present invention can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present invention Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the present invention, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
Although preferred embodiments of the present invention have been described, it is created once a person skilled in the art knows basic Property concept, then additional changes and modifications may be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as It selects embodiment and falls into all change and modification of the scope of the invention.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art Mind and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to include these modifications and variations.

Claims (22)

1. a kind of code generating method of business function, which is characterized in that the described method includes:
The xml data template of user's input is received, the xml data template includes the business datum of code to be generated;
The xml data template is parsed, the business datum of the code to be generated is obtained;The business datum of the code to be generated Routing information including Code Template;
According to the routing information of the Code Template, the Code Template of the code to be generated is obtained;
Using freemaker technology according to the business datum of the code to be generated and the Code Template of the code to be generated, Parsing generates code file to be generated.
2. the method according to claim 1, wherein the business datum of the code to be generated includes generation to be generated The list structured data of code;
Using freemaker technology according to the business datum of the code to be generated and the Code Template of the code to be generated, Parsing generates code file to be generated, comprising:
Using freemaker technology according to the list structured data of the code to be generated and the code mould of the code to be generated Plate, parsing generate the code file to be generated.
3. the method according to claim 1, wherein the business datum of the code to be generated includes generation to be generated The incidence relation data of code;
Using freemaker technology according to the Code Template of the business datum and the code to be generated, parsing generates to be generated At code file, comprising:
Using freemaker technology according to the incidence relation data of the code to be generated and the code mould of the code to be generated Plate, parsing generate the code file to be generated.
4. according to the method described in claim 3, it is characterized in that, the incidence relation data include one-one relationship, a pair Any one of more relationships, many-to-one relationship, many-to-many relationship.
5. according to the method in claim 2 or 3, which is characterized in that the business datum of the code to be generated further includes institute State the displaying style data of code to be generated;
Using freemaker technology according to the business datum of the code to be generated and the Code Template of the code to be generated, Parsing generates code file to be generated, comprising:
Using freemaker technology according to the list structured data of the code to be generated, the displaying style of the code to be generated The Code Template of data and the code to be generated, parsing generate the code file to be generated;
Or
Using freemaker technology according to the incidence relation data of the code to be generated, the displaying wind of the code to be generated The Code Template of lattice data and the code to be generated, parsing generate the code file to be generated.
6. according to the method described in claim 5, it is characterized in that, the displaying style data includes date, time, key assignments To, any one in combobox, text box, multiselect frame or any multinomial.
7. the method according to claim 1, wherein the business datum of the code to be generated further include it is described to Generate the generation strategy of code;
Using freemaker technology according to the business datum of the code to be generated and the Code Template of the code to be generated, Parsing generates code file to be generated, comprising:
According to the generation strategy of the code to be generated, using freemaker technology according to the business number of the code to be generated According to the Code Template with the code to be generated, parsing generates code file to be generated.
8. the method according to claim 1, wherein the business datum of the code to be generated further include it is described to Generate the template type of code;
According to the routing information of the Code Template, the Code Template of the code to be generated is obtained, comprising:
According to the routing information of the Code Template, multiple pre-stored Code Templates are obtained;
According to the template type of the code to be generated, determination is described to be generated from the multiple pre-stored Code Template The Code Template of code.
9. according to the method described in claim 8, it is characterized in that, the template type of the code to be generated includes increasing, deleting Any one in removing, modify, searching.
10. the method according to claim 1, wherein the business datum of the code to be generated further includes described The routing information of code file to be generated;
It is described obtain code file to be generated after, further includes:
The code file to be generated is stored into position corresponding to the routing information to the code file to be generated.
11. a kind of code generating unit of business function, which is characterized in that described device includes:
Take-up unit, for receiving the xml data template of user's input, the xml data template includes the industry of code to be generated Business data;
Processing unit obtains the business datum of the code to be generated for parsing the xml data template;It is described to be generated The business datum of code includes the routing information of Code Template;
The take-up unit is also used to the routing information according to the Code Template, obtains the code mould of the code to be generated Plate;
The processing unit, be also used to using freemaker technology according to the business datum of the code to be generated and it is described to The Code Template of code is generated, parsing generates code file to be generated.
12. device according to claim 11, which is characterized in that the business datum of the code to be generated includes to be generated The list structured data of code;
The processing unit is specifically used for:
Using freemaker technology according to the list structured data of the code to be generated and the code mould of the code to be generated Plate, parsing generate the code file to be generated.
13. device according to claim 11, which is characterized in that the business datum of the code to be generated includes to be generated The incidence relation data of code;
The processing unit is specifically used for:
Using freemaker technology according to the incidence relation data of the code to be generated and the code mould of the code to be generated Plate, parsing generate the code file to be generated.
14. device according to claim 13, which is characterized in that the incidence relation data include one-one relationship, one Any one of many-many relationship, many-to-one relationship, many-to-many relationship.
15. device according to claim 12 or 13, which is characterized in that the business datum of the code to be generated further includes The displaying style data of the code to be generated;
The processing unit is specifically used for:
Using freemaker technology according to the list structured data of the code to be generated, the displaying style of the code to be generated The Code Template of data and the code to be generated, parsing generate the code file to be generated;
Or
Using freemaker technology according to the incidence relation data of the code to be generated, the displaying wind of the code to be generated The Code Template of lattice data and the code to be generated, parsing generate the code file to be generated.
16. device according to claim 15, which is characterized in that the displaying style data includes date, time, key assignments To, any one in combobox, text box, multiselect frame or any multinomial.
17. device according to claim 11, which is characterized in that the business datum of the code to be generated further includes described The generation strategy of code to be generated;
The processing unit is specifically used for:
According to the generation strategy of the code to be generated, using freemaker technology according to the business number of the code to be generated According to the Code Template with the code to be generated, parsing generates code file to be generated.
18. device according to claim 11, which is characterized in that the business datum of the code to be generated further includes described The template type of code to be generated;
The take-up unit is specifically used for:
According to the routing information of the Code Template, multiple pre-stored Code Templates are obtained;
According to the template type of the code to be generated, determination is described to be generated from the multiple pre-stored Code Template The Code Template of code.
19. device according to claim 18, which is characterized in that the template type of the code to be generated include increase, Any one in deleting, modify, searching.
20. device according to claim 11, which is characterized in that the business datum of the code to be generated further includes described The routing information of code file to be generated;
The processing unit is also used to:
The code file to be generated is stored into position corresponding to the routing information to the code file to be generated.
21. a kind of computer readable storage medium, which is characterized in that the storage medium is stored with instruction, when described instruction exists When being run on computer, so that computer realizes method described in any one of perform claim requirement 1 to 10.
22. a kind of computer equipment characterized by comprising
Memory, for storing program instruction;
Processor, for calling the program instruction stored in the memory, according to acquisition program execute as claim 1 to Method described in any one of 10 claims.
CN201811326421.8A 2018-11-08 2018-11-08 A kind of code generating method and device of business function Pending CN109522013A (en)

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 (6)

* Cited by examiner, † Cited by third party
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
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)

* Cited by examiner, † Cited by third party
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

Patent Citations (5)

* Cited by examiner, † Cited by third party
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 (6)

* Cited by examiner, † Cited by third party
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
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
Kuchaiev et al. Nemo: a toolkit for building ai applications using neural modules
Ehrig et al. Handbook of graph grammars and computing by graph transformation
CN110032369A (en) A kind of code automatic generation method, device and medium
CN105528418B (en) A kind of design documentation generation method and device
CN110058856A (en) Page configuration method and device
JP6045134B2 (en) Parallel workload simulation for application performance testing
CN107644286A (en) Workflow processing method and device
CN104035754A (en) XML (Extensible Markup Language)-based custom code generation method and generator
CN110543303B (en) Visual service platform
CN108469955B (en) Annotation-based Android injection framework implementation method
Fill et al. Formalizing meta models with FDMM: the ADOxx case
Bloem et al. Assume-guarantee synthesis for concurrent reactive programs with partial information
CN103984554B (en) The generation method and device of Software for Design document
US10706225B2 (en) Form management system and method
US9542165B2 (en) Model to Petri-Net transformation
CN105867886A (en) Method and device for writing table
CN103810408A (en) Method and device for generating permission object
Ledur et al. A high-level dsl for geospatial visualizations with multi-core parallelism support
CN109947435A (en) The dispositions method and system of server cluster software environment
CN109446719A (en) A kind of implementation method of the customized product tree of element type
US10853331B1 (en) System and method for editing materializations of a data store
CN105938431A (en) Web page developing method and device
Kress In-line vs. in-transit in situ: Which technique to use at scale?
Nieto et al. Abstracting rigging concepts for a future proof framework design

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