-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathgeneratorConfig.xml
89 lines (78 loc) · 4.37 KB
/
generatorConfig.xml
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
79
80
81
82
83
84
85
86
87
88
89
<?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="mysqlgenerator" targetRuntime="MyBatis3">
<property name="autoDelimitKeywords" value="true"/>
<!--可以使用``包括字段名,避免字段名与sql保留字冲突报错-->
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
<!-- 自动生成toString方法 -->
<plugin type="org.mybatis.generator.plugins.ToStringPlugin"/>
<!-- 自动生成equals方法和hashcode方法 -->
<plugin type="org.mybatis.generator.plugins.EqualsHashCodePlugin"/>
<!-- 非官方插件 https://github.com/itfsw/mybatis-generator-plugin -->
<!-- 查询单条数据插件 -->
<plugin type="com.itfsw.mybatis.generator.plugins.SelectOneByExamplePlugin"/>
<!-- MySQL分页插件 -->
<plugin type="com.itfsw.mybatis.generator.plugins.LimitPlugin"/>
<!-- 查询结果选择性返回插件 -->
<plugin type="com.itfsw.mybatis.generator.plugins.SelectSelectivePlugin"/>
<!-- Example Criteria 增强插件 -->
<plugin type="com.itfsw.mybatis.generator.plugins.ExampleEnhancedPlugin"/>
<!-- 数据Model属性对应Column获取插件 -->
<plugin type="com.itfsw.mybatis.generator.plugins.ModelColumnPlugin"/>
<!-- 逻辑删除插件 需配合数据库有对应的字段-->
<plugin type="com.itfsw.mybatis.generator.plugins.LogicalDeletePlugin">
<!-- 这里配置的是全局逻辑删除列和逻辑删除值,当然在table中配置的值会覆盖该全局配置 -->
<!-- 逻辑删除列类型只能为数字、字符串或者布尔类型 -->
<property name="logicalDeleteColumn" value="deleted"/>
<!-- 逻辑删除-已删除值 -->
<property name="logicalDeleteValue" value="1"/>
<!-- 逻辑删除-未删除值 -->
<property name="logicalUnDeleteValue" value="0"/>
</plugin>
<!-- Example 目标包修改插件 -->
<plugin type="com.itfsw.mybatis.generator.plugins.ExampleTargetPlugin">
<!-- 修改Example类生成到目标包下 -->
<property name="targetPackage" value="com.javaniuniu.generator.domain.example"/>
</plugin>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<commentGenerator>
<property name="suppressDate" value="true"/>
<property name="suppressAllComments" value="false"/>
</commentGenerator>
<!--数据库连接信息-->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3308/leetcodes?characterEncoding=utf8&useSSL=false&serverTimezone=UTC"
userId="root"
password="123456"/>
<javaTypeResolver>
<property name="useJSR310Types" value="true"/>
</javaTypeResolver>
<javaModelGenerator targetPackage="com.javaniuniu.generator.domain" targetProject="src/main/java"/>
<sqlMapGenerator targetPackage="com.javaniuniu.generator.mapper" targetProject="src/main/resources"/>
<javaClientGenerator type="XMLMAPPER" targetPackage="com.javaniuniu.generator.mapper"
targetProject="src/main/java"/>
<!--表名-->
<table tableName="info">
<generatedKey column="info_id" sqlStatement="MySql" identity="true"/>
</table>
<table tableName="info_detail">
<generatedKey column="info_id" sqlStatement="MySql" identity="true"/>
</table>
<table tableName="member">
<generatedKey column="member_id" sqlStatement="MySql" identity="true"/>
</table>
<table tableName="member_detail">
<generatedKey column="member_id" sqlStatement="MySql" identity="true"/>
</table>
<table tableName="problem">
<generatedKey column="problem_id" sqlStatement="MySql" identity="true"/>
</table>
<table tableName="upvote">
<generatedKey column="upvote_id" sqlStatement="MySql" identity="true"/>
</table>
</context>
</generatorConfiguration>