com.github.javahao.config.TableConfig Maven / Gradle / Ivy
The newest version!
package com.github.javahao.config;
import com.github.javahao.entity.Relation;
import com.github.javahao.entity.Table;
import com.github.javahao.entity.Template;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* usedfor:生成表的配置
* Created by javahao on 2017/7/1.
* auth:JavaHao
*/
public class TableConfig {
private String catalog;
/**
* 生成表的名称
*/
private String tableName;
/**
* 生成名称
*/
private String genName;
/**
* 所属数据库
*/
private String schema;
/**
* 主键列名
*/
private String primary;
private String types;
private String var;
private String gen;
/**
* table标签的内部扩展变量,可以覆盖全局变量
*/
private Map extVars = new HashMap();
/**
* 模板文件配置
*/
private Map templateConfig = new HashMap();
/**
* 表结构
*/
private Table table;
/**
* 关系
*/
private List relations = new ArrayList();
private Map parents = new HashMap();
private Map childs = new HashMap();
public String getCatalog() {
return catalog;
}
public void setCatalog(String catalog) {
this.catalog = catalog;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getGenName() {
return genName;
}
public void setGenName(String genName) {
this.genName = genName;
}
public String getSchema() {
return schema;
}
public void setSchema(String schema) {
this.schema = schema;
}
public String getPrimary() {
return primary;
}
public void setPrimary(String primary) {
this.primary = primary;
}
public String[] getTypes() {
return types!=null?types.split(","):null;
}
public void setTypes(String types) {
this.types = types;
}
public Map getTemplateConfig() {
return templateConfig;
}
public void addTemplateConfig(Map templateConfig) {
this.templateConfig.putAll(templateConfig);
}
public void addTemplateConfig(String name, Template template) {
this.templateConfig.put(name,template);
}
public String getVar() {
return var;
}
public void setVar(String var) {
this.var = var;
}
public String getGen() {
return gen;
}
public void setGen(String gen) {
this.gen = gen;
}
public boolean isGen(){
return Boolean.TRUE.toString().equals(getGen());
}
public Map getExtVars() {
return extVars;
}
public void addExtVars(String key,Object value) {
this.extVars.put(key,value);
}
public Table getTable() {
return table;
}
public void setTable(Table table) {
this.table = table;
}
public List getRelations() {
return relations;
}
public void addRelations(Relation relation) {
if(relation==null)
return;
this.relations.add(relation);
}
public Map getParents() {
return parents;
}
public void addParents(Relation relation,TableConfig parent) {
if(parent==null)
return;
this.parents.put(relation,parent);
}
public Map getChilds() {
return childs;
}
public void addChilds(Relation relation,TableConfig child) {
if(child==null)
return;
this.childs.put(relation,child);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy