idea 使用mybatis plugin插件

时间:2023-01-08 05:10:51

1、插件安装完成后,在resource目录下创建mybatis-generator-config文件,文件配置内容如下:

idea 使用mybatis plugin插件


<?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>

<!-- !!!! Driver Class Path !!!! -->
<classPathEntry location="C:\Users\heke\.m2\repository\mysql\mysql-connector-java\5.1.29\mysql-connector-java-5.1.29.jar"/><!--jar包路径-->

<context id="context" targetRuntime="MyBatis3" defaultModelType="flat">
<commentGenerator>
<property name="suppressAllComments" value="true"/><!--生成注释-->
<property name="suppressDate" value="true"/><!--注释是否带有时间蹉-->
</commentGenerator>

<!-- !!!! Database Configurations !!!! -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://172.24.0.12:3306/rf_data_center" userId="rf_data_center" password="rf_data_center"/>

<javaTypeResolver>
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>

<!-- !!!! Model Configurations !!!! -->
<javaModelGenerator targetPackage="com.jd.jr.rf.country.baitiao.gen.modle" targetProject="THIS_CONFIGURATION_IS_NOT_REQUIRED">
<property name="enableSubPackages" value="false"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator>

<!-- !!!! Mapper XML Configurations !!!! -->
<sqlMapGenerator targetPackage="com.jd.jr.rf.country.baitiao.gen.mapper" targetProject="THIS_CONFIGURATION_IS_NOT_REQUIRED">
<property name="enableSubPackages" value="false"/>
</sqlMapGenerator>

<!-- !!!! Mapper Interface Configurations !!!! -->
<javaClientGenerator targetPackage="com.jd.jr.rf.country.baitiao.gen.dao" targetProject="THIS_CONFIGURATION_IS_NOT_REQUIRED" type="XMLMAPPER">
<property name="enableSubPackages" value="false"/>
</javaClientGenerator>

<!-- !!!! Table Configurations !!!! -->
<table tableName="bt_active_apply" enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
enableUpdateByExample="false"/>
</context>
</generatorConfiguration>


2、配置完成后,右键单击选择run as mybatis generator,即可生成

idea 使用mybatis plugin插件