今天就跟大家聊聊有關(guān)怎么覆蓋Mybatis 中的generator mapper原文件,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
generatorConfig.xml編寫(xiě)
<?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> <properties resource="generator.properties"/> <context id="MySqlContext" targetRuntime="MyBatis3" defaultModelType="flat"> <property name="beginningDelimiter" value="`"/> <property name="endingDelimiter" value="`"/> <property name="javaFileEncoding" value="UTF-8"/> <!-- 為模型生成序列化方法--> <plugin type="org.mybatis.generator.plugins.SerializablePlugin"/> <!-- 為生成的Java模型創(chuàng)建一個(gè)toString方法 --> <plugin type="org.mybatis.generator.plugins.ToStringPlugin"/> <!--生成mapper.xml時(shí)覆蓋原文件--> <plugin type="org.mybatis.generator.plugins.UnmergeableXmlMappersPlugin" /> <!--配置數(shù)據(jù)庫(kù)連接--> <jdbcConnection driverClass="${jdbc.driverClass}" connectionURL="${jdbc.connectionURL}" userId="${jdbc.userId}" password="${jdbc.password}"> </jdbcConnection> <!--指定生成model的路徑--> <javaModelGenerator targetPackage="com.sw.model" targetProject="src/main/java"/> <!--指定生成mapper.xml的路徑--> <sqlMapGenerator targetPackage="com.sw.mbg.mapper" targetProject="src/main/resources"/> <!--指定生成mapper接口的的路徑--> <javaClientGenerator type="XMLMAPPER" targetPackage="com.sw.mbg.mapper" targetProject="src/main/java"/> <!--生成全部表tableName設(shè)為%--> <table tableName="user"> <generatedKey column="id" sqlStatement="MySql" identity="true"/> </table> </context> </generatorConfiguration>
分享標(biāo)題:怎么覆蓋Mybatis中的generatormapper原文件-創(chuàng)新互聯(lián)
分享URL:http://chinadenli.net/article48/decjhp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)、服務(wù)器托管、小程序開(kāi)發(fā)、網(wǎng)站營(yíng)銷(xiāo)、Google、自適應(yīng)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容