mybatis generator 配置 反向生成Entity簡(jiǎn)單增刪改查(推薦)
mybatis generator 配置 反向生成Entity簡(jiǎn)單增刪改查實(shí)例代碼如下所示:
<?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> <!--數(shù)據(jù)庫(kù)驅(qū)動(dòng)jar --> <classPathEntry location="D:\.m2\repository\mysql\mysql-connector-java\5.1.38\mysql-connector-java-5.1.38.jar" /> <context id="DB2Tables" targetRuntime="MyBatis3"> <!--去除注釋 --> <commentGenerator> <property name="suppressAllComments" value="true" /> </commentGenerator> <!--數(shù)據(jù)庫(kù)連接 --> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://192.168.5.159:3306/數(shù)據(jù)庫(kù)名稱" userId="用戶名" password="你懂得"> </jdbcConnection> <!--默認(rèn)false Java type resolver will always use java.math.BigDecimal if the database column is of type DECIMAL or NUMERIC. --> <javaTypeResolver> <property name="forceBigDecimals" value="false" /> </javaTypeResolver> <!--生成實(shí)體類 指定包名 以及生成的地址 (可以自定義地址,但是路徑不存在不會(huì)自動(dòng)創(chuàng)建 使用Maven生成在target目錄下,會(huì)自動(dòng)創(chuàng)建) --> <javaModelGenerator targetPackage="com.heaboy.包名.base.entity" targetProject="項(xiàng)目名"> <property name="enableSubPackages" value="false" /> <property name="trimStrings" value="true" /> </javaModelGenerator> <!--生成SQLMAP文件 --> <sqlMapGenerator targetPackage="com.heaboy.包名.mybatis" targetProject="項(xiàng)目名"> <property name="enableSubPackages" value="false" /> </sqlMapGenerator> <!--生成Dao文件 可以配置 type="XMLMAPPER"生成xml的dao實(shí)現(xiàn) context id="DB2Tables" 修改targetRuntime="MyBatis3" --> <javaClientGenerator type="XMLMAPPER" targetPackage="com.heaboy.包名.base.dao" targetProject="項(xiàng)目名"> <property name="enableSubPackages" value="false" /> </javaClientGenerator> <!--對(duì)應(yīng)數(shù)據(jù)庫(kù)表 mysql可以加入主鍵自增 字段命名 忽略某字段等 --> <table tableName="表名" domainObjectName="生成的實(shí)體名" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" delimitIdentifiers="true"> <property name="useActualColumnNames" value="true" /> </table> <table tableName="表名2" domainObjectName="生成的實(shí)體名2" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> <property name="useActualColumnNames" value="true" /> </table> </context> </generatorConfiguration>
以上所述是小編給大家介紹的mybatis generator 配置 反向生成Entity簡(jiǎn)單增刪改查,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
相關(guān)文章
項(xiàng)目連接nacos配置中心報(bào)錯(cuò):Client not connected, current
這篇文章主要介紹了項(xiàng)目連接nacos配置中心報(bào)錯(cuò):Client not connected, current status:STARTING的解決方案,采用了mysql作為持久化的數(shù)據(jù)庫(kù),docker作為運(yùn)行的環(huán)境,感興趣的朋友跟隨小編一起看看吧2024-03-03使用Jenkins配置Git+Maven的自動(dòng)化構(gòu)建的方法
這篇文章主要介紹了使用Jenkins配置Git+Maven的自動(dòng)化構(gòu)建的方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-01-01Java實(shí)例項(xiàng)目零錢通的實(shí)現(xiàn)流程
本篇文章為你帶來(lái)Java的一個(gè)新手實(shí)戰(zhàn)項(xiàng)目,是一個(gè)零錢通系統(tǒng),項(xiàng)目來(lái)自于B站韓順平老師,非常適合新手入門(mén)練習(xí),感興趣的朋友快來(lái)看看吧2022-03-03SpringCloud負(fù)載均衡spring-cloud-starter-loadbalancer解讀
這篇文章主要介紹了SpringCloud負(fù)載均衡spring-cloud-starter-loadbalancer使用方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2025-03-03java中l(wèi)ong(Long)與int(Integer)之間的轉(zhuǎn)換方式
這篇文章主要介紹了java中l(wèi)ong(Long)與int(Integer)之間的轉(zhuǎn)換方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-10-10解決java編譯錯(cuò)誤:程序包不存在的問(wèn)題
出錯(cuò):Error:(3, 27) java: 程序包c(diǎn)om.aliyun.odps.udf不存在,遇到這樣的錯(cuò)誤問(wèn)題如何解決呢,下面小編給大家?guī)?lái)了java編譯錯(cuò)誤:程序包不存在的問(wèn)題及解決方法,感興趣的朋友一起看看吧2023-05-05