本文主要給大家介紹了關(guān)于mybatis自動(dòng)生成時(shí)不生成Example類的相關(guān)內(nèi)容,分享出來供大家參考學(xué)習(xí),下面來看看詳細(xì)的介紹:
只需要在配置要生成的table表中添加幾個(gè)配置屬性就行了。
在generatorConfig.xml文件中修改
1
2
3
4
5
6
7
|
<!--指定數(shù)據(jù)庫表--> < 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
|
<!--指定數(shù)據(jù)庫表--> < 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 > |
好了,先把之前自動(dòng)生成的文件刪除,重新執(zhí)行一個(gè)generate命令,就可以看見比較清爽的代碼內(nèi)容了~
總結(jié)
以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作能帶來一定的幫助,如果有疑問大家可以留言交流,謝謝大家對(duì)服務(wù)器之家的支持。
原文鏈接:http://blog.csdn.net/u012679583/article/details/53371034