Code generation method and device based on integration of frameworks Spring and MyBatis

A code generation and framework technology, applied in the computer field, can solve problems such as no solution proposed, lack of support for control layer and front-end code automatic generation, and achieve the effect of enhancing the function of generating code and improving the code reuse rate

Active Publication Date: 2017-11-24
SHENZHEN LEXIN SOFTWARE TECH CO LTD
View PDF5 Cites 10 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

However, there are still problems in the application development using the integration of Spring and MyBatis frameworks. For different databases, different database drivers need to be integrated to generate code and lack support for automatic generation of control layer and front-end code.
[0004] For the above problems, no effective solution has been proposed

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Code generation method and device based on integration of frameworks Spring and MyBatis
  • Code generation method and device based on integration of frameworks Spring and MyBatis
  • Code generation method and device based on integration of frameworks Spring and MyBatis

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0024] Figure 1a A flow chart of a code generation method based on the integration of Spring and MyBatis framework provided by Embodiment 1 of the present invention. This embodiment is applicable to applications based on Spring and MyBatis framework. code generating means, said means are implemented by software and / or hardware, such as Figure 1a As shown, the technical solution provided in this embodiment includes the following steps:

[0025] Step S110, reading the data access object DAO layer configuration file.

[0026] Among them, DAO (Data Access Objects, data access object) is an application programming interface, the DAO layer is the data access layer, its main function is to separate the code related to the persistence layer from the business logic The codes of the access layer to operate the database are all encapsulated in a DAO class. The DAO layer configuration file is read by the DAO layer code generator, and the DAO layer configuration file includes the PDM fi...

Embodiment 2

[0081] Figure 2a A schematic diagram of a DAO layer code generation method based on the integration of Spring and MyBatis framework provided by Embodiment 2 of the present invention. This embodiment provides a preferred embodiment on the basis of the foregoing embodiments. like Figure 2a As shown, the technical side provided by this embodiment has the following steps:

[0082] Step 1. Read the DAO layer configuration file through the DAO layer code generator, wherein the DAO layer configuration file includes the PDM file path in the PDM, the DAO layer package name, and the model data output root path.

[0083] Step 2. Obtain the model data in the PDM according to the above-mentioned DAO layer configuration file, and call the PDM file parser to convert the model data in the PDM into entity classes.

[0084] Step 3. Obtain the DAO layer template file according to Velocity.

[0085] Step 4. Load the entity class and fill it into the DAO layer template file.

[0086] Step 5...

Embodiment 3

[0096] image 3 Shown is a schematic structural diagram of a code generation device based on the integration of Spring and MyBatis framework provided by Embodiment 3 of the present invention. The specific structure of the device is as follows:

[0097] The DAO layer configuration file reading module 310 is configured to read the DAO layer configuration file of the data access object.

[0098] A model data obtaining module 320, configured to obtain model data in the physical data model PDM according to the DAO layer configuration file.

[0099] Exemplarily, the model data acquisition module 320 is specifically used for:

[0100] Find the corresponding model data in the PDM file path according to the DAO layer package name, and output the model data according to the model data output root path.

[0101] Since the metadata captured by PDM is very rich, and it closely maps the database structure, such as tables, columns, primary keys and foreign keys, etc., it solves the problem...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a code generation method and device based on the integration of frameworks Spring and MyBatis. The method comprises the steps that a data access object DAO layer configuration file is read; according to the DAO layer configuration file, model data in a physical data model (PDM) is obtained; the model data in the PDM is converted into an entity class; the entity class and a DAO layer template file are called to generate a DAO layer code file. The problems that in the prior art, codes can be generated by integrating different database drives for different databases and a large amount of repeated work exists in application development based on the frameworks Spring and MyBatis are solved, and the effects of improving the code reuse rate and enhancing a code generating function are achieved.

Description

technical field [0001] The embodiment of the present invention relates to the computer field, and in particular to a code generation method and device based on the integration of Spring and MyBatis framework. Background technique [0002] At present, any commercial software project, whether it is a Web project or a non-Web project, usually has hundreds of thousands of lines of code or more. In order to improve project development efficiency, software code reuse rate, and reduce development costs, code generation tools are usually used to assist project development. [0003] The open source framework and code generation technology free developers from some tedious and repetitive code writing work. Currently, the most commonly used persistence layer development frameworks are MyBatis and Hibernate frameworks, which are combined with lightweight control inversion Combined with the aspect-oriented container framework Spring Framework, the code writing work is reduced to a certa...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): G06F9/44
CPCG06F8/35G06F8/36
Inventor 陈嘉昂
Owner SHENZHEN LEXIN SOFTWARE TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products