本文整理汇总了Java中org.mybatis.generator.config.TableConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java TableConfiguration类的具体用法?Java TableConfiguration怎么用?Java TableConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TableConfiguration类属于org.mybatis.generator.config包,在下文中一共展示了TableConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeIgnoredColumns
import org.mybatis.generator.config.TableConfiguration; //导入依赖的package包/类
/**
* Removes the ignored columns.
*
* @param tc
* the tc
* @param columns
* the columns
*/
private void removeIgnoredColumns(TableConfiguration tc,
Map<ActualTableName, List<IntrospectedColumn>> columns) {
for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns
.entrySet()) {
Iterator<IntrospectedColumn> tableColumns = entry.getValue()
.iterator();
while (tableColumns.hasNext()) {
IntrospectedColumn introspectedColumn = tableColumns.next();
if (tc
.isColumnIgnored(introspectedColumn
.getActualColumnName())) {
tableColumns.remove();
if (logger.isDebugEnabled()) {
logger.debug(getString("Tracing.3", //$NON-NLS-1$
introspectedColumn.getActualColumnName(), entry
.getKey().toString()));
}
}
}
}
}
示例2: calculateIdentityColumns
import org.mybatis.generator.config.TableConfiguration; //导入依赖的package包/类
/**
* Calculate identity columns.
*
* @param tc
* the tc
* @param columns
* the columns
*/
private void calculateIdentityColumns(TableConfiguration tc,
Map<ActualTableName, List<IntrospectedColumn>> columns) {
GeneratedKey gk = tc.getGeneratedKey();
if (gk == null) {
// no generated key, then no identity or sequence columns
return;
}
for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns
.entrySet()) {
for (IntrospectedColumn introspectedColumn : entry.getValue()) {
if (isMatchedColumn(introspectedColumn, gk)) {
if (gk.isIdentity() || gk.isJdbcStandard()) {
introspectedColumn.setIdentity(true);
introspectedColumn.setSequenceColumn(false);
} else {
introspectedColumn.setIdentity(false);
introspectedColumn.setSequenceColumn(true);
}
}
}
}
}
示例3: parseOneToOne
import org.mybatis.generator.config.TableConfiguration; //导入依赖的package包/类
private void parseOneToOne(TableConfiguration tc,Node node) throws XMLParserException{
Properties attributes = parseAttributes(node);
String mappingTable=attributes.getProperty("mappingTable");
String column=attributes.getProperty("column");
if (!stringHasValue(mappingTable)) {
throw new XMLParserException(getString("RuntimeError.23", mappingTable)); //$NON-NLS-1$
}else if(!stringHasValue(column)){
throw new XMLParserException(getString("RuntimeError.24", column)); //$NON-NLS-1$
}
OneToOne oto=new OneToOne(mappingTable,column);
String joinColumn=attributes.getProperty("joinColumn");
if(stringHasValue(joinColumn)){
oto.setJoinColumn(joinColumn);
}
String where=attributes.getProperty("where");
if(stringHasValue(where)){
oto.setWhere(where);
}
tc.getOneToOnes().add(oto);
}
示例4: parseOneToMany
import org.mybatis.generator.config.TableConfiguration; //导入依赖的package包/类
private void parseOneToMany(TableConfiguration tc,Node node) throws XMLParserException{
Properties attributes = parseAttributes(node);
String mappingTable=attributes.getProperty("mappingTable");
String column=attributes.getProperty("column");
if (!stringHasValue(mappingTable)) {
throw new XMLParserException(getString("RuntimeError.23", mappingTable)); //$NON-NLS-1$
}else if(!stringHasValue(column)){
throw new XMLParserException(getString("RuntimeError.24", column)); //$NON-NLS-1$
}
OneToMany oto=new OneToMany(mappingTable,column);
String joinColumn=attributes.getProperty("joinColumn");
if(stringHasValue(joinColumn)){
oto.setJoinColumn(joinColumn);
}
String where=attributes.getProperty("where");
if(stringHasValue(where)){
oto.setWhere(where);
}
tc.getOneToManys().add(oto);
}
示例5: parseIgnoreColumnByRegex
import org.mybatis.generator.config.TableConfiguration; //导入依赖的package包/类
private void parseIgnoreColumnByRegex(TableConfiguration tc, Node node) {
Properties attributes = parseAttributes(node);
String pattern = attributes.getProperty("pattern"); //$NON-NLS-1$
IgnoredColumnPattern icPattern = new IgnoredColumnPattern(pattern);
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
if ("except".equals(childNode.getNodeName())) { //$NON-NLS-1$
parseException(icPattern, childNode);
}
}
tc.addIgnoredColumnPattern(icPattern);
}
示例6: validate
import org.mybatis.generator.config.TableConfiguration; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean validate(List<String> warnings) {
// 如果配置了searchString 或者 replaceString,二者不允许单独存在
if ((getProperties().getProperty(PRO_SEARCH_STRING) == null && getProperties().getProperty(PRO_REPLACE_STRING) != null)
|| (getProperties().getProperty(PRO_SEARCH_STRING) != null && getProperties().getProperty(PRO_REPLACE_STRING) == null)) {
warnings.add("itfsw:插件" + this.getClass().getTypeName() + "插件的searchString、replaceString属性需配合使用,不能单独存在!");
return false;
}
// 如果table配置了domainObjectName或者mapperName就不要再启动该插件了
for (TableConfiguration tableConfiguration : context.getTableConfigurations()) {
if (tableConfiguration.getDomainObjectName() != null || tableConfiguration.getMapperName() != null) {
warnings.add("itfsw:插件" + this.getClass().getTypeName() + "插件请不要配合table的domainObjectName或者mapperName一起使用!");
return false;
}
}
return super.validate(warnings);
}
示例7: removeIgnoredColumns
import org.mybatis.generator.config.TableConfiguration; //导入依赖的package包/类
/**
* Removes the ignored columns.
*
* @param tc
* the tc
* @param columns
* the columns
*/
private void removeIgnoredColumns(TableConfiguration tc,
Map<ActualTableName, List<IntrospectedColumn>> columns) {
for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns
.entrySet()) {
Iterator<IntrospectedColumn> tableColumns = (entry.getValue())
.iterator();
while (tableColumns.hasNext()) {
IntrospectedColumn introspectedColumn = tableColumns.next();
if (tc
.isColumnIgnored(introspectedColumn
.getActualColumnName())) {
tableColumns.remove();
if (logger.isDebugEnabled()) {
logger.debug(getString("Tracing.3", //$NON-NLS-1$
introspectedColumn.getActualColumnName(), entry
.getKey().toString()));
}
}
}
}
}
示例8: calculateIdentityColumns
import org.mybatis.generator.config.TableConfiguration; //导入依赖的package包/类
private void calculateIdentityColumns(TableConfiguration tc, Map<ActualTableName, List<IntrospectedColumn>> columns) {
GeneratedKey gk = tc.getGeneratedKey();
if (gk == null) {
// no generated key, then no identity or sequence columns
return;
}
for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns.entrySet()) {
for (IntrospectedColumn introspectedColumn : entry.getValue()) {
if (isMatchedColumn(introspectedColumn, gk)) {
if (gk.isIdentity() || gk.isJdbcStandard()) {
introspectedColumn.setIdentity(true);
introspectedColumn.setSequenceColumn(false);
} else {
introspectedColumn.setIdentity(false);
introspectedColumn.setSequenceColumn(true);
}
}
}
}
}
示例9: clientGenerated
import org.mybatis.generator.config.TableConfiguration; //导入依赖的package包/类
@Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
List<TableConfiguration> tableConfigurations = context.getTableConfigurations();
for (TableConfiguration tableConfiguration : tableConfigurations) {
if (tableConfiguration.getTableName().equals("%")) {
globalTableConfiguration = tableConfiguration;
break;
}
}
if (null != superDao) {
FullyQualifiedJavaType superDaoFqjt = new FullyQualifiedJavaType(superDao);
FullyQualifiedJavaType objectFqjt = new FullyQualifiedJavaType(context.getJavaModelGeneratorConfiguration().getTargetPackage() + "." + introspectedTable.getFullyQualifiedTable().getDomainObjectName());
FullyQualifiedJavaType objectExample = new FullyQualifiedJavaType(objectFqjt.getFullyQualifiedName() + "Example");
superDaoFqjt.addTypeArgument(objectFqjt);
if (addExampleArg) {
superDaoFqjt.addTypeArgument(objectExample);
}
interfaze.addSuperInterface(superDaoFqjt);
interfaze.addImportedType(new FullyQualifiedJavaType(superDao));
}
return super.clientGenerated(interfaze, topLevelClass, introspectedTable);
}
示例10: removeIgnoredColumns
import org.mybatis.generator.config.TableConfiguration; //导入依赖的package包/类
/**
* @param tc
* @param columns
*/
private void removeIgnoredColumns(TableConfiguration tc,
Map<ActualTableName, List<IntrospectedColumn>> columns) {
for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns
.entrySet()) {
Iterator<IntrospectedColumn> tableColumns = (entry.getValue())
.iterator();
while (tableColumns.hasNext()) {
IntrospectedColumn introspectedColumn = tableColumns.next();
if (tc
.isColumnIgnored(introspectedColumn
.getActualColumnName())) {
tableColumns.remove();
if (logger.isDebugEnabled()) {
logger.debug(getString("Tracing.3", //$NON-NLS-1$
introspectedColumn.getActualColumnName(), entry
.getKey().toString()));
}
}
}
}
}
示例11: calculateIdentityColumns
import org.mybatis.generator.config.TableConfiguration; //导入依赖的package包/类
private void calculateIdentityColumns(TableConfiguration tc,
Map<ActualTableName, List<IntrospectedColumn>> columns) {
GeneratedKey gk = tc.getGeneratedKey();
if (gk == null) {
// no generated key, then no identity or sequence columns
return;
}
for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns
.entrySet()) {
for (IntrospectedColumn introspectedColumn : entry.getValue()) {
if (isMatchedColumn(introspectedColumn, gk)) {
if (gk.isIdentity() || gk.isJdbcStandard()) {
introspectedColumn.setIdentity(true);
introspectedColumn.setSequenceColumn(false);
} else {
introspectedColumn.setIdentity(false);
introspectedColumn.setSequenceColumn(true);
}
}
}
}
}
示例12: adaptInsertSelective
import org.mybatis.generator.config.TableConfiguration; //导入依赖的package包/类
/**
* 在单条插入动态sql中增加查询序列,以实现oracle主键自增
*
* @author 吴帅
* @parameter @param element
* @parameter @param introspectedTable
* @createDate 2015年9月29日 下午12:00:37
*/
@Override
public void adaptInsertSelective(XmlElement element, IntrospectedTable introspectedTable) {
TableConfiguration tableConfiguration = introspectedTable.getTableConfiguration();
Properties properties = tableConfiguration.getProperties();
String incrementFieldName = properties.getProperty("incrementField");
if (incrementFieldName != null) {// 有自增字段的配置
List<Element> elements = element.getElements();
XmlElement selectKey = new XmlElement("selectKey");
selectKey.addAttribute(new Attribute("keyProperty", incrementFieldName));
selectKey.addAttribute(new Attribute("resultType", "java.lang.Long"));
selectKey.addAttribute(new Attribute("order", "BEFORE"));
selectKey.addElement(new TextElement("select "));
XmlElement includeSeq = new XmlElement("include");
includeSeq.addAttribute(new Attribute("refid", "TABLE_SEQUENCE"));
selectKey.addElement(includeSeq);
selectKey.addElement(new TextElement(" from dual"));
elements.add(0, selectKey);
}
}
示例13: addDataSourceNameField
import org.mybatis.generator.config.TableConfiguration; //导入依赖的package包/类
/**
* 增加数据源名称字段
*
* @author 吴帅
* @parameter @param interfaze
* @parameter @param introspectedTable
* @createDate 2015年10月2日 上午10:06:47
*/
private void addDataSourceNameField(Interface interfaze, IntrospectedTable introspectedTable) {
TableConfiguration tableConfiguration = introspectedTable.getTableConfiguration();
Properties properties = tableConfiguration.getProperties();
String dataSourceName = properties.getProperty("dataSourceName");
if (dataSourceName == null || dataSourceName == "") {
return;
}
Field field = new Field();
field.setVisibility(JavaVisibility.PUBLIC);
field.setStatic(true);
field.setFinal(true);
field.setType(FullyQualifiedJavaType.getStringInstance());
field.setName("DATA_SOURCE_NAME");
field.setInitializationString("\"" + dataSourceName + "\"");
interfaze.addField(field);
}
示例14: removeIgnoredColumns
import org.mybatis.generator.config.TableConfiguration; //导入依赖的package包/类
/**
* @param tc
* @param columns
*/
private void removeIgnoredColumns(TableConfiguration tc, Map<ActualTableName, List<IntrospectedColumn>> columns) {
for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns.entrySet()) {
Iterator<IntrospectedColumn> tableColumns = (entry.getValue()).iterator();
while (tableColumns.hasNext()) {
IntrospectedColumn introspectedColumn = tableColumns.next();
if (tc.isColumnIgnored(introspectedColumn.getActualColumnName())) {
tableColumns.remove();
if (logger.isDebugEnabled()) {
logger.debug(getString("Tracing.3", //$NON-NLS-1$
introspectedColumn.getActualColumnName(), entry.getKey().toString()));
}
}
}
}
}
示例15: calculateIdentityColumns
import org.mybatis.generator.config.TableConfiguration; //导入依赖的package包/类
private void calculateIdentityColumns(TableConfiguration tc, Map<ActualTableName, List<IntrospectedColumn>> columns) {
GeneratedKey gk = tc.getGeneratedKey();
if (gk == null) {
// no generated key, then no identity or sequence columns
return;
}
for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns.entrySet()) {
for (IntrospectedColumn introspectedColumn : entry.getValue()) {
if (isMatchedColumn(introspectedColumn, gk)) {
if (gk.isIdentity() || gk.isJdbcStandard()) {
introspectedColumn.setIdentity(true);
introspectedColumn.setSequenceColumn(false);
} else {
introspectedColumn.setIdentity(false);
introspectedColumn.setSequenceColumn(true);
}
}
}
}
}