mybatis generator 配置 反向生成Entity簡單增刪改查(推薦)
mybatis generator 配置 反向生成Entity簡單增刪改查實例代碼如下所示:
<?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ù)庫驅(qū)動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ù)庫連接 --> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://192.168.5.159:3306/數(shù)據(jù)庫名稱" userId="用戶名" password="你懂得"> </jdbcConnection> <!--默認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> <!--生成實體類 指定包名 以及生成的地址 (可以自定義地址,但是路徑不存在不會自動創(chuàng)建 使用Maven生成在target目錄下,會自動創(chuàng)建) --> <javaModelGenerator targetPackage="com.heaboy.包名.base.entity" targetProject="項目名"> <property name="enableSubPackages" value="false" /> <property name="trimStrings" value="true" /> </javaModelGenerator> <!--生成SQLMAP文件 --> <sqlMapGenerator targetPackage="com.heaboy.包名.mybatis" targetProject="項目名"> <property name="enableSubPackages" value="false" /> </sqlMapGenerator> <!--生成Dao文件 可以配置 type="XMLMAPPER"生成xml的dao實現(xiàn) context id="DB2Tables" 修改targetRuntime="MyBatis3" --> <javaClientGenerator type="XMLMAPPER" targetPackage="com.heaboy.包名.base.dao" targetProject="項目名"> <property name="enableSubPackages" value="false" /> </javaClientGenerator> <!--對應(yīng)數(shù)據(jù)庫表 mysql可以加入主鍵自增 字段命名 忽略某字段等 --> <table tableName="表名" domainObjectName="生成的實體名" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" delimitIdentifiers="true"> <property name="useActualColumnNames" value="true" /> </table> <table tableName="表名2" domainObjectName="生成的實體名2" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> <property name="useActualColumnNames" value="true" /> </table> </context> </generatorConfiguration>
以上所述是小編給大家介紹的mybatis generator 配置 反向生成Entity簡單增刪改查,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關(guān)文章
Spring @RestController注解組合實現(xiàn)方法解析
這篇文章主要介紹了Spring @RestController注解組合實現(xiàn)方法解析,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2020-06-06基于JAVA中使用Axis發(fā)布/調(diào)用Webservice的方法詳解
如果初識axis發(fā)布/調(diào)用WS,建議先讀上面的參考文件,本文對于發(fā)布/調(diào)用WS的主要步驟只是簡單文字描述,沒有它寫的詳盡2013-05-05約定優(yōu)于配置_動力節(jié)點Java學(xué)院整理
以前做項目,總是寫Ant配置文件,滿足于自己更靈活的配置,而沒有去思考,這么做到底值不值得2017-08-08Spring的@CrossOrigin注解使用與CrossFilter對象自定義詳解
這篇文章主要介紹了Spring的@CrossOrigin注解使用與CrossFilter對象自定義詳解,跨域,指的是瀏覽器不能執(zhí)行其他網(wǎng)站的腳本,它是由瀏覽器的同源策略造成的,是瀏覽器施加的安全限制,所謂同源是指,域名,協(xié)議,端口均相同,需要的朋友可以參考下2023-12-12關(guān)于Process的waitFor死鎖問題及解決方案
這篇文章主要介紹了關(guān)于Process的waitFor死鎖問題及解決方案,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2021-12-12java中BCryptPasswordEncoder密碼的加密與驗證方式
這篇文章主要介紹了java中BCryptPasswordEncoder密碼的加密與驗證方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-08-08