whyclxw
2021-01-13 a2a0114a167377e6f2f8ad20547d55f1b8763474
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?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">
    <commentGenerator>
        <!-- 是否去除自动生成的注释 -->
        <property name="suppressAllComments" value="true"/>
    </commentGenerator>
    <!-- Mysql数据库连接的信息:驱动类、连接地址、用户名、密码 -->
    <jdbcConnection driverClass="com.mysql.jdbc.Driver"
        connectionURL="jdbc:mysql://192.168.10.221:3360/db_user"
        userId="root"
        password="lmx8688139">
    </jdbcConnection>
    <!-- Oracle数据库
        <jdbcConnection driverClass="oracle.jdbc.OracleDriver"
            connectionURL="jdbc:oracle:thin:@127.0.0.1:1521:yycg"
            userId="yycg"
            password="yycg">
        </jdbcConnection> 
    -->
    
    <!-- 默认为false,把JDBC DECIMAL 和NUMERIC类型解析为Integer,为true时
    把JDBC DECIMAL 和NUMERIC类型解析为java.math.BigDecimal -->
    <javaTypeResolver >
        <property name="forceBigDecimals" value="false" />
    </javaTypeResolver>
    
    <!-- targetProject:生成POJO类的位置 -->
    <javaModelGenerator targetPackage="com.lxw.genereator.po" targetProject=".\src">
        <!-- enableSubPackages:是否让schema作为包的后缀 -->
        <property name="enableSubPackages" value="false" />
        <!-- 从数据库返回的值被清理前后的空格 -->
        <property name="trimStrings" value="true" />
    </javaModelGenerator>
    
    <!-- targetProject:mapper映射文件生成的位置 -->
    <sqlMapGenerator targetPackage="com.lxw.genereator.mapper"  targetProject=".\src">
        <!-- enableSubPackages:是否让schema作为包的后缀 -->
        <property name="enableSubPackages" value="false" />
    </sqlMapGenerator>
    
    <!-- targetProject:mapper接口生成的的位置 -->
    <javaClientGenerator type="XMLMAPPER" targetPackage="com.lxw.genereator.mapper"  targetProject=".\src">
        <!-- enableSubPackages:是否让schema作为包的后缀 -->
        <property name="enableSubPackages" value="false" />
    </javaClientGenerator>
    
    <!-- 指定数据表 -->
    <table schema="" tableName="db_user.tb_user_inf" domainObjectName="User_inf"
        enableCountByExample="false"
        enableUpdateByExample="false"
        enableDeleteByExample="false"
        enableSelectByExample="false"
        selectByExampleQueryId="false"></table>
    <table  schema="" tableName="db_user.tb_user_battgroup_baojigroup" domainObjectName="User_battgroup_baojigroup" 
        enableCountByExample="false"
        enableUpdateByExample="false"
        enableDeleteByExample="false"
        enableSelectByExample="false"
        selectByExampleQueryId="false"></table>
    <!-- <table schema="" tableName="tb_content_category"></table>
    <table schema="" tableName="tb_item"></table>
    <table schema="" tableName="tb_item_cat"></table> -->
    
    
    <!-- 有些表的字段需要指定java类型 
    <table schema="DB2ADMIN" tableName="ALLTYPES" domainObjectName="Customer" >
      <property name="useActualColumnNames" value="true"/>
      <generatedKey column="ID" sqlStatement="DB2" identity="true" />
      <columnOverride column="DATE_FIELD" property="startDate" />
      <ignoreColumn column="FRED" />
      <columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" />
    </table> -->
 
  </context>
</generatorConfiguration>