sql自动驼峰命名方法,sql直接写,不用多余步骤

把以下内容写到mybatis配置文件中

<settings>  
        <setting name="mapUnderscoreToCamelCase" value="true" />  
settings>

然后可以在applicationContext.xml引用

id="sqlSessionFactory"class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="configLocation" value="classpath:mybatis.xml" />

之后,你再创建mapper.xml写sql语句就直接开工吧

<select id="" parameterType="".........

不用去写映射对应的数据库字段了,挺方便的

你可能感兴趣的:(日常小技巧)