mybatis generatorr adapter 什么意思

Generator Power Cord, Marine Shore Power, Trailer Cord, RV Generator Adapter - Conntek
News Release
无标题文档
Featured Products
Turn your house into your own personal charging center. Our full line of EV plug, connector & charging stations make it simple to install your own charging point and recharge your cars’ batteries wherever you choose!
Our commercial grade, outdoor string light set comes with de-tachable light cages that free up 15A outlets you can plug other tools into: as well as our innovative Camlock cord locking system.
Ergo Grip RV power products feature a comfortable cord handle, a bright blue LED indicator, and rugged injection molded PVC construction designed to be easy and safe to use for many years!
Address: 2122 E. Birchwood Ave. Cudahy, WI 53110
Office TEL: 1-414-482-0800, Toll free: 1-877-267-3788,
Copyright (C) Conntek Integrated Solutions Inc,
The execution time of the page is 4,908.20 millisecond,
Designed byFlajaxian文件上传器2.0_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
Flajaxian文件上传器2.0
上传于||暂无简介
阅读已结束,如果下载本文需要使用2下载券
想免费下载本文?
下载文档到电脑,查找使用更方便
还剩10页未读,继续阅读
你可能喜欢8523人阅读
& & Mybatis Generator插件物理分页,适用于targetRuntime=&MyBatis3&
通过继承generator工具的PluginAdapter抽象类来扩展插件,具体参考文档&
package com.mon.
import java.util.L
import org.mybatis.mentG
import org.mybatis.generator.api.IntrospectedT
import org.mybatis.generator.api.PluginA
import org.mybatis.generator.api.ShellR
import org.mybatis.generator.api.dom.java.F
import org.mybatis.generator.api.dom.java.JavaV
import org.mybatis.generator.api.dom.java.M
import org.mybatis.generator.api.dom.java.P
import org.mybatis.generator.api.dom.java.PrimitiveTypeW
import org.mybatis.generator.api.dom.java.TopLevelC
import org.mybatis.generator.api.dom.xml.A
import org.mybatis.generator.api.dom.xml.TextE
import org.mybatis.generator.api.dom.xml.XmlE
* &P&File name : PaginationPlugin.java &/P&
* &P&Author : fly &/P&
* &P&Date :
上午11:50:45 &/P&
public class PaginationPlugin extends PluginAdapter {
public boolean modelExampleClassGenerated(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable) {
// add field, getter, setter for limit clause
addLimit(topLevelClass, introspectedTable, &limitStart&);
addLimit(topLevelClass, introspectedTable, &limitEnd&);
return super.modelExampleClassGenerated(topLevelClass,
introspectedTable);
public boolean sqlMapSelectByExampleWithoutBLOBsElementGenerated(
XmlElement element, IntrospectedTable introspectedTable) {
XmlElement isParameterPresenteElemen = (XmlElement) element
.getElements().get(element.getElements().size() - 1);
XmlElement isNotNullElement = new XmlElement(&if&); //$NON-NLS-1$
isNotNullElement.addAttribute(new Attribute(&test&, &limitStart != null and limitStart&=0&)); //$NON-NLS-1$ //$NON-NLS-2$
isNotNullElement.addAttribute(new Attribute(&compareValue&, &0&)); //$NON-NLS-1$ //$NON-NLS-2$
isNotNullElement.addElement(new TextElement(
&limit #{limitStart} , #{limitEnd}&));
isParameterPresenteElemen.addElement(isNotNullElement);
element.addElement(isNotNullElement);
return super.sqlMapUpdateByExampleWithoutBLOBsElementGenerated(element,
introspectedTable);
private void addLimit(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable, String name) {
CommentGenerator commentGenerator = context.getCommentGenerator();
Field field = new Field();
field.setVisibility(JavaVisibility.PROTECTED);
field.setType(FullyQualifiedJavaType.getIntInstance());
field.setType(PrimitiveTypeWrapper.getIntegerInstance());
field.setName(name);
field.setInitializationString(&-1&);
commentGenerator.addFieldComment(field, introspectedTable);
topLevelClass.addField(field);
char c = name.charAt(0);
String camel = Character.toUpperCase(c) + name.substring(1);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setName(&set& + camel);
method.addParameter(new Parameter(PrimitiveTypeWrapper.getIntegerInstance(), name));
method.addBodyLine(&this.& + name + &=& + name + &;&);
commentGenerator.addGeneralMethodComment(method, introspectedTable);
topLevelClass.addMethod(method);
method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(PrimitiveTypeWrapper.getIntegerInstance());
method.setName(&get& + camel);
method.addBodyLine(&return & + name + &;&);
commentGenerator.addGeneralMethodComment(method, introspectedTable);
topLevelClass.addMethod(method);
* This plugin is always valid - no properties are required
public boolean validate(List&String& warnings) {
接着在generatorConfig.xml文件里引入插件:
com.mon.plugin.PaginationPlugin
&?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 &
&classPathEntry location=&E:\workspace\mysql-connector-java-5.0.8-bin.jar& /&
&!-- targetRuntime = Ibatis2Java5
&context id=&context1& targetRuntime=&MyBatis3& &
&!-- 这里引入扩展插件 --&
&plugin type=&com.mon.plugin.PaginationPlugin& /&
&jdbcConnection driverClass=&com.mysql.jdbc.Driver& connectionURL=&jdbc:mysql://localhost:3306/p1LogManager?useUnicode=true&characterEncoding=utf8& userId=&root& password=&123& /&
&javaModelGenerator targetPackage=&com.fxhx.gamelog.entity& targetProject=&LogDataSys/src/main/java& /&
&sqlMapGenerator targetPackage=&com.fxhx.gamelog.mapper& targetProject=&LogDataSys/src/main/java& /&
&javaClientGenerator targetPackage=&com.fxhx.gamelog.mapper& targetProject=&LogDataSys/src/main/java& type=&XMLMAPPER& /&
&table schema=&& tableName=&consume_log&
domainObjectName=&ConsumeLog& /&
&/context&
&/generatorConfiguration&
此工程需要mybatis-generator-core.jar包
maven:&dependency&
&groupId&org.mybatis.generator&/groupId&
&artifactId&mybatis-generator-core&/artifactId&
&version&1.3.2&/version&
&type&jar&/type&
&scope&test&/scope&
&/dependency&
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:8747次
排名:千里之外
评论:11条}

我要回帖

更多关于 code generator是什么 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信