文档章节

mybatis generator config hava wapper

it_ulis
 it_ulis
发布于 2017/03/26 16:05
字数 814
阅读 20
收藏 0

今天比较清闲 自己开发点小东西 主要是关于java版本的mybatis generator的配置文件

    附代码 做备忘 写的比较死 以后有时间肯定还会修改的 结构说明 GeneratorConfiguration Properties[] ClassPathEntry Context Plugin CommentGenerator JdbcConnection JavaModelGenerator SqlMapGenerator JavaClientGenerator Table 简要说明 这个小东西主要是为了应对java的生成 可以自定义扩展插件 并且可以当成一个模块集成在框架中

GeneratorConfiguration 主要的东西 下边所有的类都会被包装在这里

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class GeneratorConfiguration {
    private Properties[] properties;
    private ClassPathEntry[] classPathEntry;
    private Context context;

    public Properties[] getProperties() {
        return properties;
    }

    public void setProperties(Properties[] properties) {
        this.properties = properties;
    }

    public ClassPathEntry[] getClassPathEntry() {
        return classPathEntry;
    }

    public void setClassPathEntry(ClassPathEntry[] classPathEntry) {
        this.classPathEntry = classPathEntry;
    }

    public Context getContext() {
        return context;
    }

    public void setContext(Context context) {
        this.context = context;
    }
}

Properties

import javax.xml.bind.annotation.XmlAttribute;

public class Properties {
    @XmlAttribute
    private String resources;

    public String getResource() {
        return resources;
    }

    public void setResources(String resources) {
        this.resources = resources;
    }
}
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;

这里输入代码

@XmlAccessorType(XmlAccessType.FIELD)
public class ClassPathEntry {
    @XmlAttribute
    private String location;

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }
}

Context

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;

@XmlAccessorType(XmlAccessType.FIELD)
public class Context  {
    @XmlAttribute
    private String id;
    @XmlAttribute
    private String targetRuntime;

    private Plugin[] plugin;
    private CommentGenerator commentGenerator;
    private JdbcConnection jdbcConnection;
    private JavaModelGenerator javaModelGenerator;
    private SqlMapGenerator sqlMapGenerator;
    private JavaClientGenerator javaClientGenerator;
    private Table[] table;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTargetRuntime() {
        return targetRuntime;
    }

    public void setTargetRuntime(String targetRuntime) {
        this.targetRuntime = targetRuntime;
    }

    public Plugin[] getPlugin() {
        return plugin;
    }

    public void setPlugin(Plugin[] plugin) {
        this.plugin = plugin;
    }

    public CommentGenerator getCommentGenerator() {
        return commentGenerator;
    }

    public void setCommentGenerator(CommentGenerator commentGenerator) {
        this.commentGenerator = commentGenerator;
    }

    public JdbcConnection getJdbcConnection() {
        return jdbcConnection;
    }

    public void setJdbcConnection(JdbcConnection jdbcConnection) {
        this.jdbcConnection = jdbcConnection;
    }

    public JavaModelGenerator getJavaModelGenerator() {
        return javaModelGenerator;
    }

    public void setJavaModelGenerator(JavaModelGenerator javaModelGenerator) {
        this.javaModelGenerator = javaModelGenerator;
    }

    public SqlMapGenerator getSqlMapGenerator() {
        return sqlMapGenerator;
    }

    public void setSqlMapGenerator(SqlMapGenerator sqlMapGenerator) {
        this.sqlMapGenerator = sqlMapGenerator;
    }

    public JavaClientGenerator getJavaClientGenerator() {
        return javaClientGenerator;
    }

    public void setJavaClientGenerator(JavaClientGenerator javaClientGenerator) {
        this.javaClientGenerator = javaClientGenerator;
    }

    public Table[] getTable() {
        return table;
    }

    public void setTable(Table[] table) {
        this.table = table;
    }
}

Plugin

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;

@XmlAccessorType(XmlAccessType.FIELD)
public class Plugin {
    @XmlAttribute
    private String type;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}

CommentGenerator

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;

@XmlAccessorType(XmlAccessType.FIELD)
public class CommentGenerator {
    private Property property;

    public Property getProperty() {
        return property;
    }

    public void setProperty(Property property) {
        this.property = property;
    }
}

JdbcConnection

@XmlAccessorType(XmlAccessType.FIELD)
public class JdbcConnection {
    @XmlAttribute
    private String driverClass;
    @XmlAttribute
    private String connectionURL;
    @XmlAttribute
    private String userId;
    @XmlAttribute
    private String password;

    public String getDriverClass() {
        return driverClass;
    }

    public void setDriverClass(String driverClass) {
        this.driverClass = driverClass;
    }

    public String getConnectionURL() {
        return connectionURL;
    }

    public void setConnectionURL(String connectionURL) {
        this.connectionURL = connectionURL;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}

JavaModelGenerator

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;

@XmlAccessorType(XmlAccessType.FIELD)
public class JavaModelGenerator {
    @XmlAttribute
    private String targetProject;
    @XmlAttribute
    private String targetPackage;
    private Property[] property;

    public String getTargetProject() {
        return targetProject;
    }

    public void setTargetProject(String targetProject) {
        this.targetProject = targetProject;
    }

    public String getTargetPackage() {
        return targetPackage;
    }

    public void setTargetPackage(String targetPackage) {
        this.targetPackage = targetPackage;
    }

    public Property[] getProperty() {
        return property;
    }

    public void setProperty(Property[] property) {
        this.property = property;
    }
}

SqlMapGenerator

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;

@XmlAccessorType(XmlAccessType.FIELD)
public class SqlMapGenerator {
    @XmlAttribute
    private String targetProject;
    @XmlAttribute
    private String targetPackage;
    private Property[] property;

    public String getTargetProject() {
        return targetProject;
    }

    public void setTargetProject(String targetProject) {
        this.targetProject = targetProject;
    }

    public String getTargetPackage() {
        return targetPackage;
    }

    public void setTargetPackage(String targetPackage) {
        this.targetPackage = targetPackage;
    }

    public Property[] getProperty() {
        return property;
    }

    public void setProperty(Property[] property) {
        this.property = property;
    }
}

JavaClientGenerator

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;

@XmlAccessorType(XmlAccessType.FIELD)
public class JavaClientGenerator {
    @XmlAttribute
    private String targetProject;
    @XmlAttribute
    private String targetPackage;
    @XmlAttribute
    private String type;

    private Property[] property;

    public String getTargetProject() {
        return targetProject;
    }

    public void setTargetProject(String targetProject) {
        this.targetProject = targetProject;
    }

    public String getTargetPackage() {
        return targetPackage;
    }

    public void setTargetPackage(String targetPackage) {
        this.targetPackage = targetPackage;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Property[] getProperty() {
        return property;
    }

    public void setProperty(Property[] property) {
        this.property = property;
    }
}

Table

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;

@XmlAccessorType(XmlAccessType.FIELD)
public class Table {
    @XmlAttribute
    private String tableName;
    @XmlAttribute
    private String enableCountByExample;
    @XmlAttribute
    private String enableDeleteByExample;
    @XmlAttribute
    private String enableSelectByExample;
    @XmlAttribute
    private String selectByExampleQueryId;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getEnableCountByExample() {
        return enableCountByExample;
    }

    public void setEnableCountByExample(String enableCountByExample) {
        this.enableCountByExample = enableCountByExample;
    }

    public String getEnableDeleteByExample() {
        return enableDeleteByExample;
    }

    public void setEnableDeleteByExample(String enableDeleteByExample) {
        this.enableDeleteByExample = enableDeleteByExample;
    }

    public String getEnableSelectByExample() {
        return enableSelectByExample;
    }

    public void setEnableSelectByExample(String enableSelectByExample) {
        this.enableSelectByExample = enableSelectByExample;
    }

    public String getSelectByExampleQueryId() {
        return selectByExampleQueryId;
    }

    public void setSelectByExampleQueryId(String selectByExampleQueryId) {
        this.selectByExampleQueryId = selectByExampleQueryId;
    }
}

© 著作权归作者所有

it_ulis
粉丝 0
博文 1
码字总数 814
作品 0
淮北
私信 提问
【MyBatis】学习纪要十一:逆向工程

写在前面的话 前面学习MyBatis的运行原理,刚学完,回头想想还是非常复杂的,也因为之前没有这样去分析过源码,所以这一节算是卡住了,可能会花一定的时间,为了不卡住学习进度,所以我们继续...

Wenyi_Feng
2018/05/10
0
0
mybatis-generator使用教程

一、前提条件 (1)JRE环境 (2)数据库连接驱动(jar包) 相应数据库的jdbc jar包 (3)mybatis-generator-core-1.x.x.jar https://github.com/mybatis/generator/releases 二、配置 准备一个...

莫铭
2015/12/09
1K
1
Mybatis 实战教程 代码生成工具的使用

代码生成工具的使用 Mybatis 应用程序,需要大量的配置文件,对于一个成百上千的数据库表来说,完全手工配置,这是一个很恐怖的工作量. 所以 Mybatis 官方也推出了一个 Mybatis 代码生成工具...

steven
2016/11/16
38
0
Spring框架 - 数据访问 整合MyBatis

整合MyBatis SqlSessionFactory 在一般的数据库项目当中,我们需要构建SqlSessionFactoryBuilder,获取session,在使用MyBatis的session API去操作数据库。 在Spring中,MyBatis提供了SqlSe...

抢小孩糖吃
2016/10/26
41
0
笨笨龍/mybatis-generator

使用说明 一、工具介绍 本工具可以通过读取固定PDM文件,获取数据库中相应列名对应的中文名称,然后在生成实体类的使用添加到相应字段上。 二、使用方法 导入项目到Eclipse中。 配置Maven打包...

笨笨龍
2016/09/12
0
0

没有更多内容

加载失败,请刷新页面

加载更多

读书replay《maven实战》.1.20190526

前情提要 maven这个工具用了好久了,但是一直都用的迷迷糊糊的,没有对它进行过系统性的学习,只是知道一些常用的功能怎么实现,所以20190516这一天我从JD购买了徐晓斌老师所著的《maven实战...

wanxiangming
39分钟前
0
0
真实项目案例实战——【状态设计模式】使用场景

什么是状态模式 状态模式允许一个对象在其内部状态改变的时候改变其行为。这个对象看上去就像是改变了它的类一样。 状态模式应用场景 1.一个对象的行为取决于它的状态,并且它必须在运行时刻根...

须臾之余
46分钟前
1
0
Java 实现把字符串转换成整数【底层实现】

https://blog.csdn.net/zl18310999566/article/details/80263396

qimh
49分钟前
0
0
IDEA的debugger

1、win下节省内存空间 3、条件断点

一只小青蛙
今天
3
0
炸!亿级数据DB秒级平滑扩容

一步一步,娓娓道来。 一般来说,并发量大,吞吐量大的互联网分层架构是怎么样的? 数据库上层都有一个微服务,服务层记录“业务库”与“数据库实例配置”的映射关系,通过数据库连接池向数据...

编程SHA
今天
2
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部