驼峰命名法

mybatis和mybatis-plus默认是属性名和数据库字段名一一对应的,即 
数据库表列:user_id
实体类属性:user_id

但是java中一般使用驼峰命名 
数据库表列:user_id 
实体类属性:userId

在Springboot中,可以通过设置map-underscore-to-camel-case属性为true来开启驼峰功能。 
application.yml中:

mybatis-plus:
  configuration:
    # 配置返回数据库(column下划线命名&&返回java实体是驼峰命名),自动匹配无需as(没开启这个,SQL需要写as: select user_id as userId)
    map-underscore-to-camel-case: true

application.properties中:

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

欲买桂花同载酒,终不似,少年游

相关文章

摘要: 原创出处 https://www.bysocket.com 「公众号:泥瓦匠...
摘要: 原创出处 https://www.bysocket.com 「公众号:泥瓦匠...
今天犯了个错:“接口变动,伤筋动骨,除非你确定只有你一个...
Writer :BYSocket(泥沙砖瓦浆木匠)微 博:BYSocket豆 瓣:...
本文目录 线程与多线程 线程的运行与创建 线程的状态 1 线程...