1. 程式人生 > >Java實際開發-框架-mybatis(2)

Java實際開發-框架-mybatis(2)

mybatis逆向工程(Mybatis Generator)+分頁

開發環境 jdk8  eclipes 

由資料庫表----》java程式碼   節省開發效率

需要jar

檔案目錄

逆向工程配置檔案

<?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>
<context id="testTables" targetRuntime="MyBatis3">
    <!-- 生成的pojo,將implements Serializable -->  
        <!-- <plugin type="org.mybatis.generator.plugins.SerializablePlugin"></plugin>   -->

<plugin type="common.DeleteLogicByIdsPlugin"></plugin>
        <plugin type="common.MySQLPaginationPlugin"></plugin>

<commentGenerator>
<!-- 是否去除自動生成的註釋 true:是 : false:否 -->
<property name="suppressAllComments" value="true" />
</commentGenerator>
<!--資料庫連線的資訊:驅動類、連線地址、使用者名稱、密碼 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/permission_url" userId="root"
password="1234">
</jdbcConnection>
<!-- <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@127.0.0.1:1521:orcl" 
userId="scott"
password="wcy675600920">
</jdbcConnection> -->


<!-- 預設false,把JDBC DECIMAL 和 NUMERIC 型別解析為 Integer,為 true時把JDBC DECIMAL 和 
NUMERIC 型別解析為java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>


<!-- targetProject:生成PO類的位置 -->
<javaModelGenerator targetPackage="org.wcy.gen.model"
targetProject=".\src">
<!-- enableSubPackages:是否讓schema作為包的字尾 -->
<property name="enableSubPackages" value="false" />
<!-- 從資料庫返回的值被清理前後的空格 -->
<property name="trimStrings" value="true" />
</javaModelGenerator>
        <!-- targetProject:mapper對映檔案生成的位置 -->
<sqlMapGenerator targetPackage="org.wcy.gen.mapper" 
targetProject=".\src">
<!-- enableSubPackages:是否讓schema作為包的字尾 -->
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<!-- targetPackage:mapper介面生成的位置 -->
<javaClientGenerator type="XMLMAPPER"
targetPackage="org.wcy.gen.mapper" 
targetProject=".\src">
<!-- enableSubPackages:是否讓schema作為包的字尾 -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator>

<!-- 指定資料庫表 -->
<!--schema資料庫名    tableName對應資料庫表名         domainObjectName對應於資料庫表的javaBean類名-->
<table tableName="items" schema="" domainObjectName=''
enableCountByExample="true"
enableDeleteByExample="false" enableUpdateByExample="false"
enableSelectByExample="true" selectByExampleQueryId="false"></table>

<!-- 有些表的欄位需要指定java型別
<table schema="" tableName="">
<columnOverride column="" javaType="" />
</table> -->
</context>
</generatorConfiguration>

git 還沒配好  目前還沒上傳

QQ 2110506053 

http://blog.csdn.net/u013087513/article/details/72885249  詳細

自己搭建的別部落格 目前專講  springboot基礎 和 專案

過段時間,會抽時間專一把java環境 開發工具安裝部署等講解 有問題了可以一起探討