1) Download the MyBatis file as follows
Https://github.com/mybatis/generator/releases
2) Configure Mybatis-generator-core-1.3.2\lib under Generatorconfig.xml
<?XML version= "1.0" encoding= "UTF-8"?> <!DOCTYPE generatorconfiguration Public "-//mybatis.org//dtd mybatis Generator Configuration 1.0//en" "Http://myba Tis.org/dtd/mybatis-generator-config_1_0.dtd "> <generatorconfiguration> <!--database-driven Jar package location (relative path)) - <Classpathentry Location= "Mysql-connector-java-5.1.25-bin.jar"/> <ContextID= "Db2tables"Targetruntime= "MyBatis3"> <Commentgenerator> < Propertyname= "Suppressdate"value= "true"/> < Whether a comment is generated!-- - < Propertyname= "Suppressallcomments"value= "true"/> </Commentgenerator> <!--database link URL, user name, password - <jdbcconnectionDriverclass= "Com.mysql.jdbc.Driver"Connectionurl= "Jdbc:mysql://127.0.0.1:3306/system"userId= "Admin"Password= "123456"> </jdbcconnection> <Javatyperesolver> < Propertyname= "Forcebigdecimals"value= "false"/> </Javatyperesolver> <!--generate the package name and location of the entity class - <JavamodelgeneratorTargetpackage= "Com.hls.model"Targetproject= "src"> < Propertyname= "Enablesubpackages"value= "true"/> < Propertyname= "Trimstrings"value= "true"/> </Javamodelgenerator> <!--Build the package name and location of the mapping file - <SqlmapgeneratorTargetpackage= "Com.hls.mapping"Targetproject= "src"> < Propertyname= "Enablesubpackages"value= "true"/> </Sqlmapgenerator> <!--generate DAO's package name and location - <Javaclientgeneratortype= "Xmlmapper"Targetpackage= "Com.hls.idao"Targetproject= "src"> < Propertyname= "Enablesubpackages"value= "true"/> </Javaclientgenerator> <!--the table TableName to be generated is the name of the table in the database Domainobjectname entity class name - <TableTableName= "Sys_dict"Domainobjectname= "Dict"Enablecountbyexample= "false"Enableupdatebyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Selectbyexamplequeryid= "false"> </Table> <TableTableName= "Sys_dict_data"Domainobjectname= "Dictdata"Enablecountbyexample= "false"Enableupdatebyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Selectbyexamplequeryid= "false"> </Table> <TableTableName= "Sys_menu"Domainobjectname= "Menu"Enablecountbyexample= "false"Enableupdatebyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Selectbyexamplequeryid= "false"> </Table> <TableTableName= "sys_org"Domainobjectname= "Org"Enablecountbyexample= "false"Enableupdatebyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Selectbyexamplequeryid= "false"> </Table> <TableTableName= "Sys_role"Domainobjectname= "Role"Enablecountbyexample= "false"Enableupdatebyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Selectbyexamplequeryid= "false"> </Table> <TableTableName= "Sys_user"Domainobjectname= "User"Enablecountbyexample= "false"Enableupdatebyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Selectbyexamplequeryid= "false"> </Table> </Context> </generatorconfiguration>
3) Open cmd to enter the Mybatis-generator-core-1.3.2\lib directory and run the command
Java-jar Mybatis-generator-core-1.3.2.jar-configfile Generatorconfig.xml-overwrite
4) Hint MyBatis Generator finished successfully, there were warnings. It worked.
Mybatis Generator Use