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环境 开发工具安装部署等讲解 有问题了可以一起探讨

地址 http://www.liaoyifan.top/blog

猜你喜欢

转载自blog.csdn.net/qq_41353313/article/details/79554356
今日推荐