同样的地方跌倒两次,我决定把它记下来。用数据库带下划线的字段查出来都为null。
在mybatis的配置文件配置
<settings>
<!--是否开启自动驼峰命名规则(camel case)映射,即从经典数据库列名 A_COLUMN 到经典 Java 属性名 aColumn 的类似映射。 -->
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
在springboot中,在application.properties中加
#开启驼峰功能
mybatis.configuration.map-underscore-to-camel-case=true