目录
一、mybatis驼峰式命名
方法一:
示例:
<resultMap type=\"io.renren.modules.generator.entity.TokenEntity\" id=\"tokenMap\"> <result property=\"id\" column=\"id\"/> <result property=\"userId\" column=\"user_id\"/> <result property=\"token\" column=\"token\"/> <result property=\"expireDate\" column=\"expire_date\"/> <result property=\"updateDate\" column=\"update_date\"/> </resultMap>
方法二:
mybatis-config.xml文件:
<?xml version=\"1.0\" encoding=\"UTF-8\" ?> <!DOCTYPE configuration PUBLIC \"-//mybatis.org//DTD Config 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-config.dtd\"> <configuration> <settings> <!-- 开启驼峰,开启后,只要数据库字段和对象属性名字母相同,无论中间加多少下划线都可以识别 --> <setting name=\"mapUnderscoreToCamelCase\" value=\"true\" /> </settings> </configuration>
方法三:
application.yml文件指定配置文件
mybatis: typeAliasesPackage: com.example.mybaitsxml.dao.entity mapperLocations: classpath:mapper/*.xml configLocation: classpath:/mybatis-config.xml
二、mybatisPlus默认开启驼峰命名映射
也可以关闭
mybatis-plus: configuration: #在映射实体或者属性时,将数据库中表名和字段名中的下划线去掉,按照驼峰命名法映射 address_book ---> addressBook map-underscore-to-camel-case: false
做猪小侠源码的代理,提供一站式服务
如果你不懂得搭建网站或者服务器,小程序,源码之类的怎么办? 第一通过本站学习各种互联网的技术 第二就是联系客服,我帮帮你搭建(当然要收取部分的费用) 第三成为我们的代理,我们提供整套的服务。