目录 一、mybatis驼峰式命名 二、mybatisPlus默认开启驼峰命名映射 一、mybatis驼峰式命名 方法一: 使用前提:数据库表设计按照规范“字段名中各单词使用下划线"_"划分”; 使用好处:省去mapper.xml文件中
目录
方法一:
使用前提:数据库表设计按照规范“字段名中各单词使用下划线"_"划分”;
使用好处:省去mapper.xml文件中繁琐编写表字段列表与表实体类属性的映射关系,即resultMap。
示例:
方法二:
mybatis-config.xml文件:
方法三:
application.yml文件指定配置文件
mybatis: typeAliasesPackage: com.example.mybaitsxml.dao.entity mapperLocations: classpath:mapper/*.xml configLocation: classpath:/mybatis-config.xml
也可以关闭
mybatis-plus: configuration: #在映射实体或者属性时,将数据库中表名和字段名中的下划线去掉,按照驼峰命名法映射 address_book ---> addressBook map-underscore-to-camel-case: false
来源地址:https://blog.csdn.net/A1916403680/article/details/127162166
--结束END--
本文标题: Mybatis/Mybatis-Plus驼峰式命名映射
本文链接: https://www.lsjlt.com/news/389791.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0