服务器之家:专注于服务器技术及软件下载分享
分类导航

PHP教程|ASP.NET教程|JAVA教程|ASP教程|编程技术|正则表达式|C/C++|

服务器之家 - 编程语言 - JAVA教程 - mybatis自动生成时如何设置不生成Example类详解

mybatis自动生成时如何设置不生成Example类详解

2020-10-26 16:39wyChen_sunshine JAVA教程

这篇文章主要给大家介绍了关于mybatis自动生成时如何设置不生成Example类的相关资料,文中介绍的非常详细,对大家具有一定的参考学习价值,需要的朋友们下面来一起看看吧。

本文主要给大家介绍了关于mybatis自动生成时不生成Example类的相关内容,分享出来供大家参考学习,下面来看看详细的介绍:

只需要在配置要生成的table表中添加几个配置属性就行了。

在generatorConfig.xml文件中修改

?
1
2
3
4
5
6
7
<!--指定数据库表-->
<table tableName="t_user" schema="" >
 <generatedKey column="userId" sqlStatement="Mysql" identity="true"/>
</table>
<table tableName="t_scene" schema="" >
 <generatedKey column="sceneId" sqlStatement="Mysql" identity="true"/>
</table>

修改如下:

?
1
2
3
4
5
6
7
8
9
<!--指定数据库表-->
<table tableName="t_user" schema="" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
 enableSelectByExample="false" selectByExampleQueryId="false" >
 <generatedKey column="userId" sqlStatement="Mysql" identity="true"/>
</table>
<table tableName="t_scene" schema="" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
 enableSelectByExample="false" selectByExampleQueryId="false" >
 <generatedKey column="sceneId" sqlStatement="Mysql" identity="true"/>
</table>

好了,先把之前自动生成的文件删除,重新执行一个generate命令,就可以看见比较清爽的代码内容了~

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流,谢谢大家对服务器之家的支持。

原文链接:http://blog.csdn.net/u012679583/article/details/53371034

延伸 · 阅读

精彩推荐