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.iniThe configuration file
  • templateIt’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 followsconfig/mysql-config.iniThe configuration file is generated by default
  • Command window run:
    • mgt -hhelp


    • mgt pjGets the package path to generate javabean files

      mgt pdGets the package path to generate the DAO file

      mgt pmGet the package path to generate mapper files


    • mgt --pd com.test.web.daoGenerate 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