YMPオンラインマニュアル
/ 自動(dòng)生成實(shí)體類(方式二)
自動(dòng)生成實(shí)體類(方式二)
通過(guò)YMP框架提供的Maven擴(kuò)展工具插件
步驟1:編譯并安裝ymate-maven-extension擴(kuò)展工具
下載擴(kuò)展工具源碼(YMP框架Maven擴(kuò)展工具項(xiàng)目地址)
執(zhí)行命令:git clone https://git.oschina.net/suninformation/ymate-maven-extension.git
編譯并安裝到本地Maven倉(cāng)庫(kù)
執(zhí)行命令: cd ymate-maven-extension mvn clean install
步驟2:將pom.xml中添加ymate-maven-plugin
插件
<plugin> <groupId>net.ymate.maven.plugins</groupId> <artifactId>ymate-maven-plugin</artifactId> <version>1.0-SNAPSHOT</version> </plugin>
步驟3:執(zhí)行插件生成實(shí)體
在工程根路徑下執(zhí)行命令:
mvn ymate:entity
輸出內(nèi)容:
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 [INFO] Scanning for projects... [INFO] ......(此處省略若干字) [INFO] --- ymate-maven-plugin:1.0-SNAPSHOT:entity (default-cli) @ ymp-examples-webapp --- 三月 25, 2016 12:25:07 上午 net.ymate.platform.core.YMP init 信息: __ ____ __ ____ ____ \ \ / / \/ | _ \ __ _|___ \ \ V /| |\/| | |_) | \ \ / / __) | | | | | | | __/ \ V / / __/ |_| |_| |_|_| \_/ |_____| Website: http://www.ymate.net/ 三月 25, 2016 12:25:07 上午 net.ymate.platform.core.YMP init 信息: Initializing ymate-platform-core-2.0.0-GA build-20160324-2339 - debug:true ......(此處省略若干字) 信息: [show tables][][1][13ms] Output file "/Users/suninformation/IdeaProjects/ymate-platform-examples/ymp-examples-webapp/src/main/java/net/ymate/platform/examples/model/User.java". [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.577s [INFO] Finished at: Fri Mar 25 00:25:08 CST 2016 [INFO] Final Memory: 10M/163M [INFO] ------------------------------------------------------------------------
通過(guò)插件生成的代碼默認(rèn)放置在src/main/java
路徑,當(dāng)數(shù)據(jù)庫(kù)表發(fā)生變化時(shí),直接執(zhí)行插件命令就可以快速更新數(shù)據(jù)實(shí)體對(duì)象,是不是很更方便呢,大家可以動(dòng)手嘗試一下!:p