mybatis逆向工程二(配置文件genreatorConfig.xml)

在工程中创建xml文件,取名为:genreatorConfig.xml。内容如下:

<?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="DB2Tables" targetRuntime="MyBatis3">
    <jdbcConnection driverClass="com.mysql.jdbc.Driver"
        connectionURL="jdbc:mysql://127.0.0.1:3306/medicalplatform"
        userId="root"
        password="******">
    </jdbcConnection>
<!-- targetProject:生成PO类的位置 -->
    <javaModelGenerator targetPackage="com.yang.bean" targetProject=".\src\main\java">
      <property name="enableSubPackages" value="true" />
      <property name="trimStrings" value="true" />
    </javaModelGenerator>
<!-- targetProject:mapper映射文件生成的位置 -->
    <sqlMapGenerator targetPackage="maper"  targetProject=".\src\main\resources">
      <property name="enableSubPackages" value="true" />
    </sqlMapGenerator>
<!-- targetPackage:mapper接口生成的位置 -->
    <javaClientGenerator type="XMLMAPPER" targetPackage="com.yang.dao"  targetProject=".\src\main\java">
      <property name="enableSubPackages" value="true" />
    </javaClientGenerator>

    <!-- table标签中tableName是数据库的表名,domainObjectName的配置是你要生成的实体类文件的名字,所以我用的大写 -->
    <!-- tableName代表数据库表名, domainObjectName代表要生成对应的数据库表名的名字-->

    <table tableName="charge" domainObjectName="Charge" ></table>
    <table tableName="cure" domainObjectName="Cure" ></table>
    <table tableName="department" domainObjectName="Department" ></table>
    <table tableName="doctor" domainObjectName="Doctor" ></table>
    <table tableName="drug" domainObjectName="Drug" ></table>
    <table tableName="examine" domainObjectName="Examine" ></table>
    <table tableName="followup" domainObjectName="Followup" ></table>
    <table tableName="medicalcase" domainObjectName="Medicalcase" ></table>
    <table tableName="patientcure" domainObjectName="Patientcure" ></table>
    <table tableName="patientexamine" domainObjectName="Patientexamine" ></table>
    <table tableName="patientprescription" domainObjectName="Patientprescription" ></table>
    <table tableName="preregistration" domainObjectName="Preregistration" ></table>
    <table tableName="report" domainObjectName="Report" ></table>

  </context>
</generatorConfiguration>
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页