mybatis配置 自动生成实体类
- 直接在resources目录下面创建这个xml文件mygeneratorConfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- <classPathEntry location="/Users/lihaiyan/jobsofeware/repository/mysql/mysql-connector-java/5.1.27/mysql-connector-java-5.1.27.jar" />-->
<classPathEntry location="/Users/guantao/.m2/repository/mysql/mysql-connector-java/8.0.27/mysql-connector-java-8.0.27.jar" />
<context id="DB2Tables" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressDate" value="true" />
<!-- 是否去除自动生成的注释 true:是 ; false:否 -->
<property name="suppressAllComments" value="false" />
<property name="javaFileEncoding" value="UTF-8"/>
</commentGenerator>
<!--数据库链接地址账号密码 connectionURL="" password=""> -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://">
</jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!--生成Model类存放位置 -->
<javaModelGenerator targetPackage="com.ziroom.bsrd.noah.domain.entity.datahelper" targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!--生成映射文件存放位置 -->
<sqlMapGenerator targetPackage="/"
targetProject="src/main/resources/mapping">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<!--生成Dao类存放位置 -->
<javaClientGenerator type="XMLMAPPER"
targetPackage="com.ziroom.bsrd.noah.dao.mapper" targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
<!--<table tableName="base_regional" domainObjectName="baseRegional"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"/>
<table tableName="base_regional_l2" domainObjectName="baseRegionalL2"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"/>-->
<table tableName="sync_property_temp" domainObjectName="SyncPropertyTemp"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"/>
<!--<table tableName="ent_enterprise" domainObjectName="EntEnterprise"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"/>
<table tableName="ent_enterprise_office" domainObjectName="EntEnterpriseOffice"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"/>
<table tableName="ent_office_building" domainObjectName="EntOfficeBuilding"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"/>
<table tableName="ent_office_property" domainObjectName="EntOfficeProperty"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"/>
<table tableName="ent_group" domainObjectName="EntGroup"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"/>
<table tableName="ent_re_enterprise_group" domainObjectName="EntReEnterpriseGroup"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"/>-->
</context>
- 去idea右边找到maven projects ,然后找到你项目的pom文件,点击plugins下面有一个mybatis-generator 双击运行就行