roncoo / roncoo-mybatis-generator Goto Github PK
View Code? Open in Web Editor NEW龙果开源-Mybatis代码自动生成工具
龙果开源-Mybatis代码自动生成工具
由于官方没写使用说明,我在这里发下。
1、首先将 com/roncoo/mybatis/generator/config/xml/
目录下的两个 dtd 文件放到 resources 目录。
2、修改 com.roncoo.mybatis.generator.plugins.DaoPlugin.java
和 com.roncoo.mybatis.generator.internal.util.messages.Messages.java
private String pagePath = "com.roncoo.education.util.base.Page";
private String pageUtilPath = "com.roncoo.education.util.base.PageUtil";
private String idPath = "com.roncoo.education.util.tools.IdWorker";";
这三个类在均在 roncoo-education-util 项目中,需要在 pom.xml 对其进行引用,否则生成代码的引用路径是错的。你也可以将工具类的代码放在本地,生成之后再修改引用路径。
此方法主要是根据 Generator.xml
动态配置生成的代码。因为上面工具类的路径写死了,所以动态配置这里需要注掉。你也可以放到 xml 里进行动态配置。
pagePath = properties.getProperty("pagePath");
pageUtilPath = properties.getProperty("pageUtilPath");
idPath = properties.getProperty("idPath");
改成加载自己当前包下的 messages.properties
private static final String BUNDLE_NAME = "com.roncoo.mybatis.generator.internal.util.messages.messages";
3、配置 Generator.xml
<plugin type="com.roncoo.mybatis.generator.plugins.SerializablePlugin"/>
<plugin type="com.roncoo.mybatis.generator.plugins.ToStringPlugin"/>
<plugin type="com.roncoo.mybatis.generator.plugins.DaoPlugin">
<!-- ServiceImpl方法的名称 -->
<property name="enableInsertSelective" value="true"/>
<property name="enableDeleteByExample" value="false"/>
<!-- 支持count和page -->
<property name="enableCount" value="true"/>
<property name="enablePage" value="true"/>
<!-- Service和ServiceImpl的目录和路径,其中targetProject必须填写否则执行报错 -->
<property name="targetPackage" value="${target.package}.dao"/>
<property name="targetProject" value="${target.project}"/>
<property name="implementationPackage" value="${target.package}.dao.impl"/>
</plugin>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.