安装mybatis自己搞,
代码块
<?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> <!-- 配置mysql 驱动jar包路径.用了绝对路径 --> <classPathEntry location="D:\mysql-connector-java-8.0.11.jar" /> <context id="generator" targetRuntime="MyBatis3"> <!-- 为了防止生成的代码中有很多注释,比较难看,加入下面的配置控制 --> <commentGenerator> <property name="suppressAllComments" value="true" /> <property name="suppressDate" value="true" /> <property name="javaFileEncoding" value="UTF-8" /> </commentGenerator> <!-- 注释控制完毕 --> <!-- 数据库连接!注意这里数据库中表得是创建好的 --> <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver" connectionURL="jdbc:mysql://120.79.194.135:3306/discounts?serverTimezone=UTC" userId="huyun" password="1030405060huyun"> </jdbcConnection> <javaTypeResolver> <property name="forceBigDecimals" value="false" /> </javaTypeResolver> <!-- 数据表对应的model 层,targetProject为当前的项目名 --> <javaModelGenerator targetPackage="com.discount.bean" targetProject="locale_discounts"> <property name="enableSubPackages" value="true" /> <property name="trimStrings" value="true" /> </javaModelGenerator> <!-- sql mapper 隐射配置文件 --> <sqlMapGenerator targetPackage="com.discount.dao" targetProject="locale_discounts"> <property name="enableSubPackages" value="true" /> </sqlMapGenerator> <!-- 在ibatis2 中是dao层,但在mybatis3中,其实就是mapper接口 --> <javaClientGenerator type="XMLMAPPER" targetPackage="com.discount.dao" targetProject="locale_discounts"> <property name="enableSubPackages" value="true" /> </javaClientGenerator> <!-- 要对那些数据表进行生成操作,必须要有一个,domainObjectName为要生成实体类名 --> <table tableName="aspirations" domainObjectName="Aspirations" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="backups" domainObjectName="Backups" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="comment" domainObjectName="Comment" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="curriculum" domainObjectName="Curriculum" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="curriculum_type" domainObjectName="Curriculum_type" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="deal" domainObjectName="Deal" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="discuss" domainObjectName="Discuss" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="dynamic" domainObjectName="Dynamic" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="group" domainObjectName="Group" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="massage" domainObjectName="Massage" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="news" domainObjectName="News" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="order" domainObjectName="Order" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="photo" domainObjectName="Photo" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="resource" domainObjectName="Resource" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="resource_type" domainObjectName="Resource_type" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="teachers" domainObjectName="Teachers" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="teachers_type" domainObjectName="Teachers_type" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="user_message" domainObjectName="User_message" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="user_operation" domainObjectName="User_operation" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="vip" domainObjectName="Vip" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> <table tableName="vip_right" domainObjectName="Vip_right" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> </context> </generatorConfiguration> |