mybatis-plus踩坑之带下划线驼峰转换

包含下划线的字段查询不出来

在mybatis-plus中,默认开启了下滑线-驼峰转换

online_num -> onlineNum

在一个实体类中存在一个带下划线的字段,查询出来为null

 private Integer online_num;

即使用了@TableField()注解指定了映射关系,也为null

 @TableField("online_num")
 private Integer online_num;

问题就是出现在了驼峰转换这里,因为已经指明了映射关系,所以把驼峰转换关掉就行:

mybatis-plus:
  configuration:
    map-underscore-to-camel-case: false
mybatis-plus.configuration.map-underscore-to-camel-case=false

你可能感兴趣的:(java,intellij-idea,spring)