Skip to content

Commit 02a8a49

Browse files
committed
升级版本为0.9.6
新增字段 tableName tableName mapperSuffix
1 parent 6040429 commit 02a8a49

File tree

5 files changed

+91
-5
lines changed

5 files changed

+91
-5
lines changed

README.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Build script snippet for use in all Gradle versions:
2929
}
3030
}
3131
dependencies {
32-
classpath "gradle.plugin.com.cuisongliu.plugin:mybatis-generator:0.9.4"
32+
classpath "gradle.plugin.com.cuisongliu.plugin:mybatis-generator:0.9.6"
3333
}
3434
}
3535

@@ -38,7 +38,7 @@ Build script snippet for use in all Gradle versions:
3838
Build script snippet for new, incubating, plugin mechanism introduced in Gradle 2.1:
3939

4040
plugins {
41-
id "com.cuisongliu.plugin.mybatis-generator" version "0.9.4"
41+
id "com.cuisongliu.plugin.mybatis-generator" version "0.9.6"
4242
}
4343

4444

@@ -60,6 +60,9 @@ Build script snippet for new, incubating, plugin mechanism introduced in Gradle
6060
mapperPackage= "com.cuisongliu.mapper"
6161
modelPackage = "com.cuisongliu.entity"
6262
xmlPackage = "com.cuisongliu.mapper"
63+
tableName ="s_system"
64+
objectName ="System"
65+
mapperSuffix ="Mapper"
6366
}
6467
}
6568

@@ -203,6 +206,30 @@ If no settings are provided, the plugin tries to use sensible defaults.
203206
common.Mapper</code>
204207
</td>
205208
</tr>
209+
<tr>
210+
<td><code>tableName</code></td>
211+
<td><code>String</code></td>
212+
<td>Mybatis generator db table name.<em><strong>Not Null</td>
213+
<td>
214+
<code>null</code>
215+
</td>
216+
</tr>
217+
<tr>
218+
<td><code>objectName</code></td>
219+
<td><code>String</code></td>
220+
<td>Mybatis generator object class name.<em><strong>Not Null</td>
221+
<td>
222+
<code>null</code>
223+
</td>
224+
</tr>
225+
<tr>
226+
<td><code>mapperSuffix</code></td>
227+
<td><code>String</code></td>
228+
<td>Mybatis generator javaClient mapper suffix.</td>
229+
<td>
230+
<code>Mapper</code>
231+
</td>
232+
</tr>
206233
</tbody></table>
207234

208235
<h3 id="run-mbg-task">Run the mbg task</h3>

README_ZH.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
}
2929
}
3030
dependencies {
31-
classpath "gradle.plugin.com.cuisongliu.plugin:mybatis-generator:0.9.4"
31+
classpath "gradle.plugin.com.cuisongliu.plugin:mybatis-generator:0.9.6"
3232
}
3333
}
3434

@@ -37,7 +37,7 @@
3737
为Gradle 2.1中引入的新的,潜在的插件机制构建脚本代码段
3838

3939
plugins {
40-
id "com.cuisongliu.plugin.mybatis-generator" version "0.9.4"
40+
id "com.cuisongliu.plugin.mybatis-generator" version "0.9.6"
4141
}
4242

4343

@@ -59,6 +59,9 @@
5959
mapperPackage= "com.cuisongliu.mapper"
6060
modelPackage = "com.cuisongliu.entity"
6161
xmlPackage = "com.cuisongliu.mapper"
62+
tableName ="s_system"
63+
objectName ="System"
64+
mapperSuffix ="Mapper"
6265
}
6366
}
6467

@@ -202,6 +205,30 @@
202205
<code>common.Mapper</code>
203206
</td>
204207
</tr>
208+
<tr>
209+
<td><code>tableName</code></td>
210+
<td><code>String</code></td>
211+
<td>mybatis生成对应的数据库表名.<em><strong>不能为空</td>
212+
<td>
213+
<code>null</code>
214+
</td>
215+
</tr>
216+
<tr>
217+
<td><code>objectName</code></td>
218+
<td><code>String</code></td>
219+
<td>mybatis生成对应的实体类名.<em><strong>不能为空</td>
220+
<td>
221+
<code>null</code>
222+
</td>
223+
</tr>
224+
<tr>
225+
<td><code>mapperSuffix</code></td>
226+
<td><code>String</code></td>
227+
<td>mybatis生成Mapper的后缀</td>
228+
<td>
229+
<code>Mapper</code>
230+
</td>
231+
</tr>
205232
</tbody></table>
206233

207234
<h3 id="run-mbg-task">运行mbg任务</h3>

gradle/subprojects.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ targetCompatibility = 1.7
4040

4141
// java编译的时候缺省状态下会因为中文字符而失败
4242
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
43-
version = "0.9.5"
43+
version = "0.9.6"
4444
group ="com.cuisongliu.plugin"
4545
def baseUrl = "http://maven.cuisongliu.com"
4646
def nexusUrl = "$baseUrl/content/groups/public/"

src/main/groovy/com/cuisongliu/plugin/generator/mybatis/MybatisGenerator.groovy

+16
Original file line numberDiff line numberDiff line change
@@ -214,5 +214,21 @@ class MybatisGenerator extends DefaultTask {
214214
throw new GradleException(errorMsg)
215215
}
216216
xmlParams["xml.xmlPackage"] = project.mbg.xml.xmlPackage
217+
218+
if (!StringUtility.stringHasValue(project.mbg.xml.tableName)) {
219+
errorMsg = "变量mbg.xml.tableName<String>未设置,请设置后重试."
220+
println(errorMsg)
221+
throw new GradleException(errorMsg)
222+
}
223+
xmlParams["xml.tableName"] = project.mbg.xml.tableName
224+
225+
if (!StringUtility.stringHasValue(project.mbg.xml.objectName)) {
226+
errorMsg = "变量mbg.xml.objectName<String>未设置,请设置后重试."
227+
println(errorMsg)
228+
throw new GradleException(errorMsg)
229+
}
230+
xmlParams["xml.objectName"] = project.mbg.xml.objectName
231+
232+
xmlParams["xml.mapperName"] = project.mbg.xml.objectName+project.mbg.xml.mapperSuffix
217233
}
218234
}

src/main/groovy/com/cuisongliu/plugin/generator/mybatis/extension/MybatisGeneratorXmlExtension.groovy

+16
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,21 @@ class MybatisGeneratorXmlExtension {
7777
* 默认值为tk.mybatis.mapper.common.Mapper
7878
*/
7979
String mapperMapper = "tk.mybatis.mapper.common.Mapper"
80+
/**
81+
* tableName需要生成的表名<br/>
82+
* 默认值为空,必须设置
83+
*/
84+
String tableName =null
85+
/**
86+
* objectName需要生成的实体类名<br/>
87+
* 默认值为空,必须设置
88+
*/
89+
String objectName=null
90+
/**
91+
* omapper配置,生成的Mapper类的后缀<br/>
92+
* 默认值为Mapper
93+
*/
94+
String mapperSuffix="Mapper"
95+
8096

8197
}

0 commit comments

Comments
 (0)