網(wǎng)上可自行下載相關(guān)jar

lib路徑中文件如上圖
generatorConfig.xml文件內(nèi)容如下
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> <generatorConfiguration> <!-- 數(shù)據(jù)庫驅(qū)動(dòng)--> <classPathEntry location="MySQL-connector-java-5.1.25-bin.jar"/> <context id="DB2Tables" targetRuntime="MyBatis3"> <commentGenerator> <PRoperty name="suppressDate" value="true"/> <!-- 是否要去掉自動(dòng)生成的注釋 --> <property name="suppressAllComments" value="true"/> </commentGenerator> <!--數(shù)據(jù)庫相關(guān)信息--> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost/test" userId="root" passWord="123456"> </jdbcConnection> <javaTypeResolver> <property name="forceBigDecimals" value="false"/> </javaTypeResolver> <!-- 生成bean類(實(shí)體類)的包名以及路徑--> <javaModelGenerator targetPackage="com.lin.bean" targetProject="src"> <property name="enableSubPackages" value="true"/> <property name="trimStrings" value="true"/> </javaModelGenerator> <!-- 生成映射文件(Mapper.xml)的包名以及路徑--> <sqlMapGenerator targetPackage="com.lin.mapping" targetProject="src"> <property name="enableSubPackages" value="true"/> </sqlMapGenerator> <!-- 生成Dao的包名以及路徑--> <javaClientGenerator type="XMLMAPPER" targetPackage="com.lin.Dao" targetProject="src"> <property name="enableSubPackages" value="true"/> </javaClientGenerator> <!-- 根據(jù)tableName來生成對(duì)應(yīng)的文件 domainObjectName為生成后的實(shí)體類名--> <table tableName="img" domainObjectName="Img" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table> </context> </generatorConfiguration>在上述目錄下輸入以下cmd命令:
java -jar mybatis-generator-core-1.3.2.jar -configfile generatorConfig.xml -overwrite
在當(dāng)前src目錄中生成我們所需文件。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注