日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Mybatis插件之自动生成不使用默认的驼峰式

發(fā)布時間:2024/8/1 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Mybatis插件之自动生成不使用默认的驼峰式 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

數(shù)據(jù)庫里面表的字段中帶有“”_“下劃線,我們知道插件默認(rèn)的是將這些帶有下劃線的字段默認(rèn)的變成“優(yōu)美的駝峰式”的。表是肯定不能動的,實體類的字段也是非常多,改起來非常麻煩,所以就研究了下面這種依靠代碼來實現(xiàn)的方式。

修改配置文件:

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" > <generatorConfiguration><classPathEntrylocation="E:\mysql-connector-java-5.1.29.jar" /><context id="DB2Tables" targetRuntime="MyBatis3"><commentGenerator><property name="suppressAllComments" value="true" /><property name="suppressDate" value="true" /></commentGenerator><jdbcConnection driverClass="com.mysql.jdbc.Driver"connectionURL="jdbc:mysql://172.16.14.40:3306/zhu"userId="zhu" password="zhu" /><javaTypeResolver><property name="forceBigDecimals" value="false" /><!-- 默認(rèn)false,把JDBC DECIMAL 和 NUMERIC 類型解析為 Integer true,把JDBC DECIMAL 和 NUMERIC 類型解析為java.math.BigDecimal --></javaTypeResolver><javaModelGenerator targetPackage="com.tt.domain"targetProject="MybatisT/src/main/java"><property name="enableSubPackages" value="true" /><property name="trimStrings" value="true" /></javaModelGenerator><sqlMapGenerator targetPackage="com.tt.domain"targetProject="MybatisT/src/main/resources"><property name="enableSubPackages" value="false" /></sqlMapGenerator><table tableName="zlpg_value" enableSelectByExample="false"enableDeleteByExample="false" enableCountByExample="false"selectByExampleQueryId="true" enableUpdateByExample="false"><property name="useActualColumnNames" value="true"/><!-- <generatedKey column="ID" sqlStatement="oracle" identity="true" /> --></table></context> </generatorConfiguration>

<property name="useActualColumnNames" value="true"/>

總結(jié)

以上是生活随笔為你收集整理的Mybatis插件之自动生成不使用默认的驼峰式的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。