Mybati example generatorConfig.xml 配置详解

 1 <?xml version="1.0" encoding="UTF-8"?>    
 2 <!DOCTYPE generatorConfiguration    
 3         PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"    
 4         "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">    
 5     
 6 <generatorConfiguration>    
 7     <properties resource="jdbc.properties" />    
 8     <context id="sqlserverTables" targetRuntime="MyBatis3">    
 9         <!-- 生成的pojo,将implements Serializable-->    
10         <plugin type="org.mybatis.generator.plugins.SerializablePlugin"></plugin>    
11         <commentGenerator>    
12             <!-- 是否去除自动生成的注释 true:是 : false:否 -->    
13             <property name="suppressAllComments" value="true" />    
14         </commentGenerator>    
15     
16         <!-- 数据库链接URL、用户名、密码 -->    
17         <jdbcConnection driverClass="${jdbc.driverClassName}"    
18                         connectionURL="${jdbc.url}"    
19                         userId="${jdbc.username}"    
20                         password="${jdbc.password}">    
21         </jdbcConnection>    
22     
23         <!--      
24         默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer    
25             true,把JDBC DECIMAL 和 NUMERIC 类型解析为java.math.BigDecimal      
26         -->    
27         <javaTypeResolver>    
28             <property name="forceBigDecimals" value="false" />    
29         </javaTypeResolver>    
30     
31         <!--     
32         生成model模型,对应的包路径,以及文件存放路径(targetProject),targetProject可以指定具体的路径,如./src/main/java,    
33         也可以使用“MAVEN”来自动生成,这样生成的代码会在target/generatord-source目录下    
34         -->    
35         <!--<javaModelGenerator targetPackage="com.joey.mybaties.test.pojo" targetProject="MAVEN">-->    
36         <javaModelGenerator targetPackage="com.csdn.ingo.entity" targetProject="./src/main/java">    
37             <property name="enableSubPackages" value="true"/>    
38             <!-- 从数据库返回的值被清理前后的空格  -->    
39             <property name="trimStrings" value="true" />    
40         </javaModelGenerator>    
41     
42         <!--对应的mapper.xml文件  -->    
43         <sqlMapGenerator targetPackage="mappers" targetProject="./src/main/resources">    
44             <property name="enableSubPackages" value="true"/>    
45         </sqlMapGenerator>    
46     
47         <!-- 对应的Mapper接口类文件 -->    
48         <javaClientGenerator type="XMLMAPPER" targetPackage="com.csdn.ingo.dao" targetProject="./src/main/java">    
49             <property name="enableSubPackages" value="true"/>    
50         </javaClientGenerator>    
51     
52     
53         <!-- 列出要生成代码的所有表,这里配置的是不生成Example文件 -->    
54         <table tableName="userinfo" domainObjectName="UserInfoPO"    
55                enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"    
56                enableSelectByExample="false" selectByExampleQueryId="false" >    
          57 <property name="useActualColumnNames" value="false"/> 58 </table> 59 </context> 60 </generatorConfiguration>

猜你喜欢

转载自www.cnblogs.com/lwh-note/p/10405058.html