introduce
Golang generates mapper, Javabean and Dao layer code files corresponding to Mybatis according to MySQL database table, which can be used in the form of command line client
structure
config/mysql-config.ini
The configuration file
template
It’s the template file
build
Go to the SRC /main path of the project and run the go build mgt.go createfile.go command to generate a mgt.exe file in the Tongji directory, as shown in the following figure
The required files are shown in the red box above
run
- Run the mgt.exe file as follows
config/mysql-config.ini
The configuration file is generated by default - Command window run:
mgt -h
help
mgt pj
Gets the package path to generate javabean files
mgt pd
Gets the package path to generate the DAO file
mgt pm
Get the package path to generate mapper files
mgt --pd com.test.web.dao
Generate dao layer files that specify package pathsmgt --pj com.test.web.pojo
— Generates a Javabean file specifying the package pathmgt --pm com.test.web.mapper
— Generates a mapper file for the specified package path
The project address
Github project address