1. 场景描述

idea下使用mybatis_generator自动生成mapper文件,默认生成了一大堆的example文件及方法,使用规则类似于Hibernate,给了一大堆参数,感觉没必要,只所以以前用hb,最近几年用mybatis,就是看中了它的简洁,直接拼sql,直观快速、方便定位问题,修改默认文件,不生成example。

mybatis的example类

2. 问题解决

修改generatorConfig.xml配置,将以下几个值都设置成false就可以了

enableCountByExample="false"  enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"

整体代码:

        <table tableName="laowang_class" domainObjectName="LaowangClass"
               enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
               enableSelectByExample="false">
            <property name="useActualColumnNames" value="false"/>
            <generatedKey column="id" sqlStatement="MYSQL" identity="true"/>
        </table>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-25
  • 2021-08-27
  • 2021-10-16
猜你喜欢
  • 2021-06-18
  • 2022-12-23
  • 2021-04-29
  • 2022-01-06
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案