mybatis-generator

	<plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.2</version>
                <configuration>
                    <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
                    <verbose>true</verbose>
                    <overwrite>true</overwrite>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>mysql</groupId>
                        <artifactId>mysql-connector-java</artifactId>
                        <version>5.1.27</version>
                    </dependency>
                </dependencies>
      </plugin>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration SYSTEM "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" PUBLIC " -//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN">
-<generatorConfiguration>
<classPathEntry location="/root/.m2/repository/mysql/mysql-connector-java/8.0.16/mysql-connector-java-8.0.16.jar"/>
<!--context 標籤用於指定生成一組對象的環境,例如指定要連接的數據庫,要生產對象的類型和要處理的數據庫中的表 ,具體屬性如下 id 是必填屬性 ,並且是唯一的 targetRuntime 屬性則是用於指定生產的代碼的運行時環境 支持以下可選值 MyBatis3 默認值 MyBatis3Simple 該方式不會生成於Example相關的方法 -->
-<context targetRuntime="MyBatis3Simple" id="testTables">
<!-- commentGenerator 標籤主要用來配置如何生成註釋信息 可以通過property屬性進行配置 suppressAllComments :阻止生成註釋,默認爲false suppressDate : 阻止生成的註釋包含時間戳 默認爲false addRemarkComments 註釋是否添加數據庫表的備註信息,默認爲false 一般情況下,由於生成的註釋沒有任何價值,而時間戳每次生成都會不一樣,所以推薦屏蔽註釋信息 當然也可以自己實現註釋形式 通過繼承DefaultCommentGenerator 實現自定義的註釋格式 通過 <commentGenerator type="">引入自定義的註釋生成類 -->
-<commentGenerator>
<!-- 是否去除自動生成的註釋 true:是 : false:否 -->
<property value="true" name="suppressAllComments"/>
</commentGenerator>
<!--用於只當需要連接的數據庫信息,該標籤必選,並且只能有一個 數據庫連接的信息:驅動類、連接地址、用戶名、密碼 -->
<jdbcConnection password="Flkj@2018" userId="root" connectionURL="jdbc:mysql://192.168.1.134:3306/ChaincodeExplore?nullCatalogMeansCurrent=true" driverClass="com.mysql.cj.jdbc.Driver"> </jdbcConnection>
<!--javaTypeResolver 標籤用來配置JDBC 類型和Java 類型的轉換 forceBigDecimals 默認false,該property主要用來把JDBC DECIMAL 和 NUMERIC 類型解析爲 Integer,爲 true時把JDBC DECIMAL NUMERIC 類型解析爲java.math.BigDecimal -->
-<javaTypeResolver>
<property value="false" name="forceBigDecimals"/>
</javaTypeResolver>
<!-- javaModelGenerator 用來控制生成的實體類 targetPackage 生成實體類存放的包名 targetProject:指定目標項目路徑 可以使用相對路徑或絕對路徑 -->
-<javaModelGenerator targetProject="/root/桌面/22/chaincode_explore/api/src/main/java" targetPackage="com.fuchain.api.Entity">
<!-- enableSubPackages:是否讓schema作爲包的後綴 -->
<property value="false" name="enableSubPackages"/>
<!-- 判斷是否對數據庫查詢結果進行trim 判斷 如果爲true 從數據庫返回的值被清理前後的空格 -->
<property value="true" name="trimStrings"/>
</javaModelGenerator>
<!-- sqlMapGenerator 標籤用於配置SQL 映射生成器(mapper.xml) 的屬性 targetPackage 生成sql映射文件存放的包名。 targetProject:指定目標項目路徑 可以使用相對路徑或絕對路徑 -->
-<sqlMapGenerator targetProject="/root/桌面/22/chaincode_explore/api/src/main" targetPackage="resources/mapper">
<!-- enableSubPackages:是否讓schema作爲包的後綴 -->
<property value="false" name="enableSubPackages"/>
</sqlMapGenerator>
<!-- javaClientGenerator 用於配置Java客戶端生成器(mapper 接口)的屬性 該標籤有三個屬性 type: 用於選擇客戶端代碼生成器 默認提供了以下幾種方式 ANNOTATENMAPPER :基於註解的Mapper 接口,不會有對應的XML 映射文件 MIXEDMAPPER:XML 和註解的混合形式 XMLMAPPER :所有的方法都在XML 中,接口的調用依賴XML文件 (推薦使用該方式) targetPackage:mapper接口存放的包名 targetProject:指定目標項目路徑 可以使用相對路徑或絕對路徑 -->
-<javaClientGenerator targetProject="/root/桌面/22/chaincode_explore/api/src/main/java" targetPackage="com.fuchain.api.Mapper" type="XMLMAPPER">
<!-- enableSubPackages:是否讓schema作爲包的後綴 -->
<property value="false" name="enableSubPackages"/>
</javaClientGenerator>
<!-- table 標籤是最重要的一個標籤,該標籤用於配置需要通過內省數據庫的表,只有在table 中配置過的表,才能經過上述其他配置生成最終的代碼 其中 tableName 是一個必選的屬性, 該屬性指定要生成的表明,可以使用SQL 通配符匹配多個表 ( 例如 <table tableName="%"></table>) table 標籤中的屬性 domainObjectName : 指定生成對象的基本名稱,如果沒有指定,則自動根據表明生成 -->
<table selectByExampleQueryId="false" enableSelectByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" enableCountByExample="false" domainObjectName="NetworkTable" tableName="network_table"> </table>
<table selectByExampleQueryId="false" enableSelectByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" enableCountByExample="false" domainObjectName="ChannelTable" tableName="channel_table"> </table>
<table selectByExampleQueryId="false" enableSelectByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" enableCountByExample="false" domainObjectName="ChaincodeTable" tableName="chaincode_table"> </table>
<table selectByExampleQueryId="false" enableSelectByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" enableCountByExample="false" domainObjectName="OperationTable" tableName="operation_table"> </table>
<table selectByExampleQueryId="false" enableSelectByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" enableCountByExample="false" domainObjectName="AdminAuthorityTable" tableName="admin_authority_table"> </table>
<table selectByExampleQueryId="false" enableSelectByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" enableCountByExample="false" domainObjectName="AdminRoleTable" tableName="admin_role_table"> </table>
<table selectByExampleQueryId="false" enableSelectByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" enableCountByExample="false" domainObjectName="AdminTable" tableName="admin_table"> </table>
<table selectByExampleQueryId="false" enableSelectByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" enableCountByExample="false" domainObjectName="UserAuthorityTable" tableName="user_authority_table"> </table>
<table selectByExampleQueryId="false" enableSelectByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" enableCountByExample="false" domainObjectName="UserTable" tableName="user_table"> </table>
<table selectByExampleQueryId="false" enableSelectByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" enableCountByExample="false" domainObjectName="UserApplyTable" tableName="user_apply_table"> </table>
<table selectByExampleQueryId="false" enableSelectByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" enableCountByExample="false" domainObjectName="LogTable" tableName="log_table"> </table>
</context>
</generatorConfiguration>
發佈了13 篇原創文章 · 獲贊 7 · 訪問量 7951
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章