mybatis驼峰命名映射的使用
在mybatis的配置文件中加入
<setting name="mapUnderscoreToCamelCase" value="true"/>
这个配置用于sql语句返回数据时,可以按照驼峰命名规则,自动对符合驼峰命名规则的实体类进行装配,并且仅当通过对象传递时才有效。其他方式无效!之前对这个配置理解有误,以为它可以用在给sql传参的过程中,其实,这个配置只在sql返回结果集时生效
springboot整合mybatis后在application.properties中通过下面语句配置
mybatis.configuration.map-underscore-to-camel-case=true