MyEclipse 使用mybatis快速自动构建代码

安装mybatis自己搞,

代码块

<?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>
    <!-- 配置mysql 驱动jar包路径.用了绝对路径 -->
    <classPathEntry location="D:\mysql-connector-java-8.0.11.jar" />
 
    <context id="generator" targetRuntime="MyBatis3">
 
        <!-- 为了防止生成的代码中有很多注释,比较难看,加入下面的配置控制 -->
        <commentGenerator>
            <property name="suppressAllComments" value="true" />
            <property name="suppressDate" value="true" />
            <property name="javaFileEncoding" value="UTF-8" />
        </commentGenerator>
        <!-- 注释控制完毕 -->
 
        <!-- 数据库连接!注意这里数据库中表得是创建好的 -->
        <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
            connectionURL="jdbc:mysql://120.79.194.135:3306/discounts?serverTimezone=UTC" userId="huyun"
            password="1030405060huyun">
        </jdbcConnection>
 
        <javaTypeResolver>
            <property name="forceBigDecimals" value="false" />
        </javaTypeResolver>
 
        <!-- 数据表对应的model 层,targetProject为当前的项目名 -->
        <javaModelGenerator targetPackage="com.discount.bean"
            targetProject="locale_discounts">
            <property name="enableSubPackages" value="true" />
            <property name="trimStrings" value="true" />
        </javaModelGenerator>
 
        <!-- sql mapper 隐射配置文件 -->
        <sqlMapGenerator targetPackage="com.discount.dao"
            targetProject="locale_discounts">
            <property name="enableSubPackages" value="true" />
        </sqlMapGenerator>
 
        <!-- 在ibatis2 中是dao层,但在mybatis3中,其实就是mapper接口 -->
        <javaClientGenerator type="XMLMAPPER"
            targetPackage="com.discount.dao" targetProject="locale_discounts">
            <property name="enableSubPackages" value="true" />
        </javaClientGenerator>
 
        <!-- 要对那些数据表进行生成操作,必须要有一个,domainObjectName为要生成实体类名 -->
        <table tableName="aspirations" domainObjectName="Aspirations"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
 
        <table tableName="backups" domainObjectName="Backups"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
         
         <table tableName="comment" domainObjectName="Comment"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
 
         <table tableName="curriculum" domainObjectName="Curriculum"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="curriculum_type" domainObjectName="Curriculum_type"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="deal" domainObjectName="Deal"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="discuss" domainObjectName="Discuss"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="dynamic" domainObjectName="Dynamic"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="group" domainObjectName="Group"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="massage" domainObjectName="Massage"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="news" domainObjectName="News"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="order" domainObjectName="Order"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="photo" domainObjectName="Photo"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="resource" domainObjectName="Resource"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="resource_type" domainObjectName="Resource_type"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="teachers" domainObjectName="Teachers"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="teachers_type" domainObjectName="Teachers_type"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="user_message" domainObjectName="User_message"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="user_operation" domainObjectName="User_operation"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="vip" domainObjectName="Vip"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
        
        <table tableName="vip_right" domainObjectName="Vip_right"
            enableSelectByExample="false" enableDeleteByExample="false"
            enableCountByExample="false" enableUpdateByExample="false">
        </table>
    </context>
</generatorConfiguration>
 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值