• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Ibatis2FormattingUtilities类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities的典型用法代码示例。如果您正苦于以下问题:Java Ibatis2FormattingUtilities类的具体用法?Java Ibatis2FormattingUtilities怎么用?Java Ibatis2FormattingUtilities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Ibatis2FormattingUtilities类属于org.mybatis.generator.codegen.ibatis2包,在下文中一共展示了Ibatis2FormattingUtilities类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getNoValueMethod

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
private Method getNoValueMethod(IntrospectedColumn introspectedColumn,
        String nameFragment, String operator) {
    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    StringBuilder sb = new StringBuilder();
    sb.append(introspectedColumn.getJavaProperty());
    sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
    sb.insert(0, "and"); //$NON-NLS-1$
    sb.append(nameFragment);
    method.setName(sb.toString());
    method.setReturnType(FullyQualifiedJavaType.getCriteriaInstance());
    sb.setLength(0);
    sb.append("addCriterion(\""); //$NON-NLS-1$
    sb.append(Ibatis2FormattingUtilities
            .getAliasedActualColumnName(introspectedColumn));
    sb.append(' ');
    sb.append(operator);
    sb.append("\");"); //$NON-NLS-1$
    method.addBodyLine(sb.toString());
    method.addBodyLine("return (Criteria) this;"); //$NON-NLS-1$

    return method;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:24,代码来源:ExampleGenerator.java


示例2: getNoValueMethod

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
private Method getNoValueMethod(IntrospectedColumn introspectedColumn, String nameFragment, String operator) {
	Method method = new Method();
	method.setVisibility(JavaVisibility.PUBLIC);
	StringBuilder sb = new StringBuilder();
	sb.append(introspectedColumn.getJavaProperty());
	sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
	sb.insert(0, "and"); //$NON-NLS-1$
	sb.append(nameFragment);
	method.setName(sb.toString());
	method.setReturnType(FullyQualifiedJavaType.getCriteriaInstance());
	sb.setLength(0);
	sb.append("addCriterion(\""); //$NON-NLS-1$
	sb.append(Ibatis2FormattingUtilities.getAliasedActualColumnName(introspectedColumn));
	sb.append(' ');
	sb.append(operator);
	sb.append("\");"); //$NON-NLS-1$
	method.addBodyLine(sb.toString());
	method.addBodyLine("return (Criteria) this;"); //$NON-NLS-1$

	return method;
}
 
开发者ID:fnyexx,项目名称:mybator,代码行数:22,代码来源:ExampleGenerator.java


示例3: addElements

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
    XmlElement answer = new XmlElement("sql"); //$NON-NLS-1$

    answer.addAttribute(new Attribute("id", //$NON-NLS-1$
            introspectedTable.getBlobColumnListId()));

    context.getCommentGenerator().addComment(answer);

    StringBuilder sb = new StringBuilder();

    Iterator<IntrospectedColumn> iter = introspectedTable.getBLOBColumns()
            .iterator();
    while (iter.hasNext()) {
        sb.append(Ibatis2FormattingUtilities.getSelectListPhrase(iter
                .next()));

        if (iter.hasNext()) {
            sb.append(", "); //$NON-NLS-1$
        }

        if (sb.length() > 80) {
            answer.addElement(new TextElement(sb.toString()));
            sb.setLength(0);
        }
    }

    if (sb.length() > 0) {
        answer.addElement(new TextElement(sb.toString()));
    }

    if (context.getPlugins().sqlMapBlobColumnListElementGenerated(
            answer, introspectedTable)) {
        parentElement.addElement(answer);
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:37,代码来源:BlobColumnListElementGenerator.java


示例4: addElements

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
    XmlElement answer = new XmlElement("sql"); //$NON-NLS-1$

    answer.addAttribute(new Attribute("id", //$NON-NLS-1$
            introspectedTable.getBaseColumnListId()));

    context.getCommentGenerator().addComment(answer);

    StringBuilder sb = new StringBuilder();
    Iterator<IntrospectedColumn> iter = introspectedTable
            .getNonBLOBColumns().iterator();
    while (iter.hasNext()) {
        sb.append(Ibatis2FormattingUtilities.getSelectListPhrase(iter
                .next()));

        if (iter.hasNext()) {
            sb.append(", "); //$NON-NLS-1$
        }

        if (sb.length() > 80) {
            answer.addElement(new TextElement(sb.toString()));
            sb.setLength(0);
        }
    }

    if (sb.length() > 0) {
        answer.addElement(new TextElement(sb.toString()));
    }

    if (context.getPlugins().sqlMapBaseColumnListElementGenerated(
            answer, introspectedTable)) {
        parentElement.addElement(answer);
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:36,代码来源:BaseColumnListElementGenerator.java


示例5: addElements

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
    XmlElement answer = new XmlElement("sql"); //$NON-NLS-1$

    answer.addAttribute(new Attribute("id", //$NON-NLS-1$
            introspectedTable.getBlobColumnListId()));

    context.getCommentGenerator().addComment(answer);

    StringBuilder sb = new StringBuilder();

    Iterator<IntrospectedColumn> iter = introspectedTable.getBLOBColumns()
            .iterator();
    while (iter.hasNext()) {
        sb.append(Ibatis2FormattingUtilities.getSelectListPhrase(iter
                .next()));

        if (iter.hasNext()) {
            sb.append(", "); //$NON-NLS-1$
        }

        if (sb.length() > 80) {
            answer.addElement(new TextElement(sb.toString()));
            sb.setLength(0);
        }
    }

    if (sb.length() > 0) {
        answer.addElement((new TextElement(sb.toString())));
    }

    if (context.getPlugins().sqlMapBlobColumnListElementGenerated(
            answer, introspectedTable)) {
        parentElement.addElement(answer);
    }
}
 
开发者ID:backkoms,项目名称:mybatis-generator-comments,代码行数:37,代码来源:BlobColumnListElementGenerator.java


示例6: addElements

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
    XmlElement answer = new XmlElement("sql"); //$NON-NLS-1$

    answer.addAttribute(new Attribute("id", //$NON-NLS-1$
            introspectedTable.getBaseColumnListId()));

    context.getCommentGenerator().addComment(answer);

    StringBuilder sb = new StringBuilder();
    Iterator<IntrospectedColumn> iter = introspectedTable
            .getNonBLOBColumns().iterator();
    while (iter.hasNext()) {
        sb.append(Ibatis2FormattingUtilities.getSelectListPhrase(iter
                .next()));

        if (iter.hasNext()) {
            sb.append(", "); //$NON-NLS-1$
        }

        if (sb.length() > 80) {
            answer.addElement(new TextElement(sb.toString()));
            sb.setLength(0);
        }
    }

    if (sb.length() > 0) {
        answer.addElement((new TextElement(sb.toString())));
    }

    if (context.getPlugins().sqlMapBaseColumnListElementGenerated(
            answer, introspectedTable)) {
        parentElement.addElement(answer);
    }
}
 
开发者ID:backkoms,项目名称:mybatis-generator-comments,代码行数:36,代码来源:BaseColumnListElementGenerator.java


示例7: addElements

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
	XmlElement answer = new XmlElement("sql"); //$NON-NLS-1$

	answer.addAttribute(new Attribute("id", //$NON-NLS-1$
			introspectedTable.getBlobColumnListId()));

	context.getCommentGenerator().addComment(answer);

	StringBuilder sb = new StringBuilder();

	Iterator<IntrospectedColumn> iter = introspectedTable.getBLOBColumns().iterator();
	while (iter.hasNext()) {
		sb.append(Ibatis2FormattingUtilities.getSelectListPhrase(iter.next()));

		if (iter.hasNext()) {
			sb.append(", "); //$NON-NLS-1$
		}

		if (sb.length() > 80) {
			answer.addElement(new TextElement(sb.toString()));
			sb.setLength(0);
		}
	}

	if (sb.length() > 0) {
		answer.addElement((new TextElement(sb.toString())));
	}

	if (context.getPlugins().sqlMapBlobColumnListElementGenerated(answer, introspectedTable)) {
		parentElement.addElement(answer);
	}
}
 
开发者ID:fnyexx,项目名称:mybator,代码行数:34,代码来源:BlobColumnListElementGenerator.java


示例8: addElements

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
	XmlElement answer = new XmlElement("sql"); //$NON-NLS-1$

	answer.addAttribute(new Attribute("id", //$NON-NLS-1$
			introspectedTable.getBaseColumnListId()));

	context.getCommentGenerator().addComment(answer);

	StringBuilder sb = new StringBuilder();
	Iterator<IntrospectedColumn> iter = introspectedTable.getNonBLOBColumns().iterator();
	while (iter.hasNext()) {
		sb.append(Ibatis2FormattingUtilities.getSelectListPhrase(iter.next()));

		if (iter.hasNext()) {
			sb.append(", "); //$NON-NLS-1$
		}

		if (sb.length() > 80) {
			answer.addElement(new TextElement(sb.toString()));
			sb.setLength(0);
		}
	}

	if (sb.length() > 0) {
		answer.addElement((new TextElement(sb.toString())));
	}

	if (context.getPlugins().sqlMapBaseColumnListElementGenerated(answer, introspectedTable)) {
		parentElement.addElement(answer);
	}
}
 
开发者ID:fnyexx,项目名称:mybator,代码行数:33,代码来源:BaseColumnListElementGenerator.java


示例9: getSingleValueMethod

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
private Method getSingleValueMethod(IntrospectedColumn introspectedColumn,
        String nameFragment, String operator) {
    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.addParameter(new Parameter(introspectedColumn
            .getFullyQualifiedJavaType(), "value")); //$NON-NLS-1$
    StringBuilder sb = new StringBuilder();
    sb.append(introspectedColumn.getJavaProperty());
    sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
    sb.insert(0, "and"); //$NON-NLS-1$
    sb.append(nameFragment);
    method.setName(sb.toString());
    method.setReturnType(FullyQualifiedJavaType.getCriteriaInstance());
    sb.setLength(0);

    if (introspectedColumn.isJDBCDateColumn()) {
        sb.append("addCriterionForJDBCDate(\""); //$NON-NLS-1$
    } else if (introspectedColumn.isJDBCTimeColumn()) {
        sb.append("addCriterionForJDBCTime(\""); //$NON-NLS-1$
    } else if (stringHasValue(introspectedColumn
            .getTypeHandler())) {
        sb.append("add"); //$NON-NLS-1$
        sb.append(introspectedColumn.getJavaProperty());
        sb.setCharAt(3, Character.toUpperCase(sb.charAt(3)));
        sb.append("Criterion(\""); //$NON-NLS-1$
    } else {
        sb.append("addCriterion(\""); //$NON-NLS-1$
    }

    sb.append(Ibatis2FormattingUtilities
            .getAliasedActualColumnName(introspectedColumn));
    sb.append(' ');
    sb.append(operator);
    sb.append("\", "); //$NON-NLS-1$

    if (introspectedColumn.getFullyQualifiedJavaType().isPrimitive() && !introspectedTable.isJava5Targeted()) {
        sb.append("new "); //$NON-NLS-1$
        sb.append(introspectedColumn.getFullyQualifiedJavaType()
                .getPrimitiveTypeWrapper().getShortName());
        sb.append("(value)"); //$NON-NLS-1$
    } else {
        sb.append("value"); //$NON-NLS-1$
    }

    sb.append(", \""); //$NON-NLS-1$
    sb.append(introspectedColumn.getJavaProperty());
    sb.append("\");"); //$NON-NLS-1$
    method.addBodyLine(sb.toString());
    method.addBodyLine("return (Criteria) this;"); //$NON-NLS-1$

    return method;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:53,代码来源:ExampleGenerator.java


示例10: getSetBetweenOrNotBetweenMethod

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
/**
 * Generates methods that set between and not between conditions
 * 
 * @param introspectedColumn
 * @param betweenMethod
 * @return a generated method for the between or not between method
 */
private Method getSetBetweenOrNotBetweenMethod(
        IntrospectedColumn introspectedColumn, boolean betweenMethod) {
    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    FullyQualifiedJavaType type = introspectedColumn
            .getFullyQualifiedJavaType();

    method.addParameter(new Parameter(type, "value1")); //$NON-NLS-1$
    method.addParameter(new Parameter(type, "value2")); //$NON-NLS-1$
    StringBuilder sb = new StringBuilder();
    sb.append(introspectedColumn.getJavaProperty());
    sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
    sb.insert(0, "and"); //$NON-NLS-1$
    if (betweenMethod) {
        sb.append("Between"); //$NON-NLS-1$
    } else {
        sb.append("NotBetween"); //$NON-NLS-1$
    }
    method.setName(sb.toString());
    method.setReturnType(FullyQualifiedJavaType.getCriteriaInstance());
    sb.setLength(0);

    if (introspectedColumn.isJDBCDateColumn()) {
        sb.append("addCriterionForJDBCDate(\""); //$NON-NLS-1$
    } else if (introspectedColumn.isJDBCTimeColumn()) {
        sb.append("addCriterionForJDBCTime(\""); //$NON-NLS-1$
    } else if (stringHasValue(introspectedColumn
            .getTypeHandler())) {
        sb.append("add"); //$NON-NLS-1$
        sb.append(introspectedColumn.getJavaProperty());
        sb.setCharAt(3, Character.toUpperCase(sb.charAt(3)));
        sb.append("Criterion(\""); //$NON-NLS-1$
    } else {
        sb.append("addCriterion(\""); //$NON-NLS-1$
    }

    sb.append(Ibatis2FormattingUtilities
            .getAliasedActualColumnName(introspectedColumn));
    if (betweenMethod) {
        sb.append(" between"); //$NON-NLS-1$
    } else {
        sb.append(" not between"); //$NON-NLS-1$
    }
    sb.append("\", "); //$NON-NLS-1$
    if (introspectedColumn.getFullyQualifiedJavaType().isPrimitive() && !introspectedTable.isJava5Targeted()) {
        sb.append("new "); //$NON-NLS-1$
        sb.append(introspectedColumn.getFullyQualifiedJavaType()
                .getPrimitiveTypeWrapper().getShortName());
        sb.append("(value1), "); //$NON-NLS-1$
        sb.append("new "); //$NON-NLS-1$
        sb.append(introspectedColumn.getFullyQualifiedJavaType()
                .getPrimitiveTypeWrapper().getShortName());
        sb.append("(value2)"); //$NON-NLS-1$
    } else {
        sb.append("value1, value2"); //$NON-NLS-1$
    }

    sb.append(", \""); //$NON-NLS-1$
    sb.append(introspectedColumn.getJavaProperty());
    sb.append("\");"); //$NON-NLS-1$
    method.addBodyLine(sb.toString());
    method.addBodyLine("return (Criteria) this;"); //$NON-NLS-1$

    return method;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:73,代码来源:ExampleGenerator.java


示例11: getSetInOrNotInMethod

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
/**
 * 
 * @param introspectedColumn
 * @param inMethod
 *            if true generates an "in" method, else generates a "not in"
 *            method
 * @return a generated method for the in or not in method
 */
private Method getSetInOrNotInMethod(IntrospectedColumn introspectedColumn,
        boolean inMethod) {
    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    FullyQualifiedJavaType type = FullyQualifiedJavaType
            .getNewListInstance();
    if (generateForJava5) {
        if (introspectedColumn.getFullyQualifiedJavaType().isPrimitive()) {
            type.addTypeArgument(introspectedColumn
                    .getFullyQualifiedJavaType().getPrimitiveTypeWrapper());
        } else {
            type.addTypeArgument(introspectedColumn
                    .getFullyQualifiedJavaType());
        }
    }

    method.addParameter(new Parameter(type, "values")); //$NON-NLS-1$
    StringBuilder sb = new StringBuilder();
    sb.append(introspectedColumn.getJavaProperty());
    sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
    sb.insert(0, "and"); //$NON-NLS-1$
    if (inMethod) {
        sb.append("In"); //$NON-NLS-1$
    } else {
        sb.append("NotIn"); //$NON-NLS-1$
    }
    method.setName(sb.toString());
    method.setReturnType(FullyQualifiedJavaType.getCriteriaInstance());
    sb.setLength(0);

    if (introspectedColumn.isJDBCDateColumn()) {
        sb.append("addCriterionForJDBCDate(\""); //$NON-NLS-1$
    } else if (introspectedColumn.isJDBCTimeColumn()) {
        sb.append("addCriterionForJDBCTime(\""); //$NON-NLS-1$
    } else if (stringHasValue(introspectedColumn
            .getTypeHandler())) {
        sb.append("add"); //$NON-NLS-1$
        sb.append(introspectedColumn.getJavaProperty());
        sb.setCharAt(3, Character.toUpperCase(sb.charAt(3)));
        sb.append("Criterion(\""); //$NON-NLS-1$
    } else {
        sb.append("addCriterion(\""); //$NON-NLS-1$
    }

    sb.append(Ibatis2FormattingUtilities
            .getAliasedActualColumnName(introspectedColumn));
    if (inMethod) {
        sb.append(" in"); //$NON-NLS-1$
    } else {
        sb.append(" not in"); //$NON-NLS-1$
    }
    sb.append("\", values, \""); //$NON-NLS-1$
    sb.append(introspectedColumn.getJavaProperty());
    sb.append("\");"); //$NON-NLS-1$
    method.addBodyLine(sb.toString());
    method.addBodyLine("return (Criteria) this;"); //$NON-NLS-1$

    return method;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:68,代码来源:ExampleGenerator.java


示例12: addElements

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
    boolean useColumnIndex = isTrue(introspectedTable
                    .getTableConfigurationProperty(PropertyRegistry.TABLE_USE_COLUMN_INDEXES));
    XmlElement answer = new XmlElement("resultMap"); //$NON-NLS-1$
    answer.addAttribute(new Attribute("id", //$NON-NLS-1$
            introspectedTable.getBaseResultMapId()));

    String returnType;
    if (introspectedTable.getRules().generateBaseRecordClass()) {
        returnType = introspectedTable.getBaseRecordType();
    } else {
        returnType = introspectedTable.getPrimaryKeyType();
    }

    answer.addAttribute(new Attribute("class", //$NON-NLS-1$
            returnType));

    context.getCommentGenerator().addComment(answer);

    int i = 1;
    if (stringHasValue(introspectedTable
            .getSelectByPrimaryKeyQueryId())
            || stringHasValue(introspectedTable
                    .getSelectByExampleQueryId())) {
        i++;
    }

    for (IntrospectedColumn introspectedColumn : introspectedTable
            .getNonBLOBColumns()) {
        XmlElement resultElement = new XmlElement("result"); //$NON-NLS-1$

        if (useColumnIndex) {
            resultElement.addAttribute(new Attribute(
                    "columnIndex", Integer.toString(i++))); //$NON-NLS-1$
        } else {
            resultElement
                    .addAttribute(new Attribute(
                            "column", Ibatis2FormattingUtilities.getRenamedColumnNameForResultMap(introspectedColumn))); //$NON-NLS-1$
        }

        resultElement.addAttribute(new Attribute(
                "property", introspectedColumn.getJavaProperty())); //$NON-NLS-1$
        resultElement.addAttribute(new Attribute("jdbcType", //$NON-NLS-1$
                introspectedColumn.getJdbcTypeName()));

        if (stringHasValue(introspectedColumn
                .getTypeHandler())) {
            resultElement.addAttribute(new Attribute(
                    "typeHandler", introspectedColumn.getTypeHandler())); //$NON-NLS-1$
        }

        answer.addElement(resultElement);
    }

    if (context.getPlugins()
            .sqlMapResultMapWithoutBLOBsElementGenerated(answer,
                    introspectedTable)) {
        parentElement.addElement(answer);
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:62,代码来源:ResultMapWithoutBLOBsElementGenerator.java


示例13: addElements

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
    XmlElement answer = new XmlElement("update"); //$NON-NLS-1$

    answer
            .addAttribute(new Attribute(
                    "id", introspectedTable.getUpdateByExampleSelectiveStatementId())); //$NON-NLS-1$

    context.getCommentGenerator().addComment(answer);

    StringBuilder sb = new StringBuilder();

    sb.append("update "); //$NON-NLS-1$
    sb.append(introspectedTable
            .getAliasedFullyQualifiedTableNameAtRuntime());
    answer.addElement(new TextElement(sb.toString()));

    XmlElement dynamicElement = new XmlElement("dynamic"); //$NON-NLS-1$
    dynamicElement.addAttribute(new Attribute("prepend", "set")); //$NON-NLS-1$ //$NON-NLS-2$
    answer.addElement(dynamicElement);

    for (IntrospectedColumn introspectedColumn : introspectedTable
            .getAllColumns()) {
        XmlElement isNotNullElement = new XmlElement("isNotNull"); //$NON-NLS-1$
        isNotNullElement.addAttribute(new Attribute("prepend", ",")); //$NON-NLS-1$ //$NON-NLS-2$
        isNotNullElement.addAttribute(new Attribute(
                "property", introspectedColumn.getJavaProperty("record."))); //$NON-NLS-1$ //$NON-NLS-2$
        dynamicElement.addElement(isNotNullElement);

        sb.setLength(0);
        sb.append(Ibatis2FormattingUtilities
                .getAliasedEscapedColumnName(introspectedColumn));
        sb.append(" = "); //$NON-NLS-1$
        sb.append(Ibatis2FormattingUtilities.getParameterClause(
                introspectedColumn, "record.")); //$NON-NLS-1$

        isNotNullElement.addElement(new TextElement(sb.toString()));
    }

    XmlElement isParameterPresentElement = new XmlElement(
            "isParameterPresent"); //$NON-NLS-1$
    answer.addElement(isParameterPresentElement);

    XmlElement includeElement = new XmlElement("include"); //$NON-NLS-1$
    includeElement.addAttribute(new Attribute("refid", //$NON-NLS-1$
            introspectedTable.getIbatis2SqlMapNamespace()
                    + "." + introspectedTable.getExampleWhereClauseId())); //$NON-NLS-1$
    isParameterPresentElement.addElement(includeElement);

    if (context.getPlugins()
            .sqlMapUpdateByExampleSelectiveElementGenerated(answer,
                    introspectedTable)) {
        parentElement.addElement(answer);
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:56,代码来源:UpdateByExampleSelectiveElementGenerator.java


示例14: addElements

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
    boolean useColumnIndex = isTrue(introspectedTable
                    .getTableConfigurationProperty(PropertyRegistry.TABLE_USE_COLUMN_INDEXES));

    XmlElement answer = new XmlElement("resultMap"); //$NON-NLS-1$

    answer.addAttribute(new Attribute("id", //$NON-NLS-1$
            introspectedTable.getResultMapWithBLOBsId()));

    String returnType;
    if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
        returnType = introspectedTable.getRecordWithBLOBsType();
    } else {
        // table has BLOBs, but no BLOB class - BLOB fields must be
        // in the base class
        returnType = introspectedTable.getBaseRecordType();
    }

    answer.addAttribute(new Attribute("class", //$NON-NLS-1$
            returnType));

    StringBuilder sb = new StringBuilder();
    sb.append(introspectedTable.getIbatis2SqlMapNamespace());
    sb.append('.');
    sb.append(introspectedTable.getBaseResultMapId());
    answer.addAttribute(new Attribute("extends", sb.toString())); //$NON-NLS-1$

    context.getCommentGenerator().addComment(answer);

    int i = introspectedTable.getNonBLOBColumnCount() + 1;
    if (stringHasValue(introspectedTable
            .getSelectByPrimaryKeyQueryId())
            || stringHasValue(introspectedTable
                    .getSelectByExampleQueryId())) {
        i++;
    }

    for (IntrospectedColumn introspectedColumn : introspectedTable
            .getBLOBColumns()) {
        XmlElement resultElement = new XmlElement("result"); //$NON-NLS-1$

        if (useColumnIndex) {
            resultElement.addAttribute(new Attribute(
                    "columnIndex", Integer.toString(i++))); //$NON-NLS-1$
        } else {
            resultElement
                    .addAttribute(new Attribute(
                            "column", Ibatis2FormattingUtilities.getRenamedColumnNameForResultMap(introspectedColumn))); //$NON-NLS-1$
        }
        resultElement.addAttribute(new Attribute(
                "property", introspectedColumn.getJavaProperty())); //$NON-NLS-1$
        resultElement.addAttribute(new Attribute(
                "jdbcType", introspectedColumn.getJdbcTypeName())); //$NON-NLS-1$

        if (stringHasValue(introspectedColumn
                .getTypeHandler())) {
            resultElement.addAttribute(new Attribute(
                    "typeHandler", introspectedColumn.getTypeHandler())); //$NON-NLS-1$
        }

        answer.addElement(resultElement);
    }

    if (context.getPlugins()
            .sqlMapResultMapWithBLOBsElementGenerated(answer,
                    introspectedTable)) {
        parentElement.addElement(answer);
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:71,代码来源:ResultMapWithBLOBsElementGenerator.java


示例15: addElements

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
    XmlElement answer = new XmlElement("update"); //$NON-NLS-1$

    answer
            .addAttribute(new Attribute(
                    "id", introspectedTable.getUpdateByExampleWithBLOBsStatementId())); //$NON-NLS-1$

    context.getCommentGenerator().addComment(answer);

    StringBuilder sb = new StringBuilder();
    sb.append("update "); //$NON-NLS-1$
    sb.append(introspectedTable
            .getAliasedFullyQualifiedTableNameAtRuntime());
    answer.addElement(new TextElement(sb.toString()));

    // set up for first column
    sb.setLength(0);
    sb.append("set "); //$NON-NLS-1$

    Iterator<IntrospectedColumn> iter = introspectedTable.getAllColumns()
            .iterator();
    while (iter.hasNext()) {
        IntrospectedColumn introspectedColumn = iter.next();

        sb.append(Ibatis2FormattingUtilities
                .getAliasedEscapedColumnName(introspectedColumn));
        sb.append(" = "); //$NON-NLS-1$
        sb.append(Ibatis2FormattingUtilities.getParameterClause(
                introspectedColumn, "record.")); //$NON-NLS-1$

        if (iter.hasNext()) {
            sb.append(',');
        }

        answer.addElement(new TextElement(sb.toString()));

        // set up for the next column
        if (iter.hasNext()) {
            sb.setLength(0);
            OutputUtilities.xmlIndent(sb, 1);
        }
    }

    XmlElement isParameterPresentElement = new XmlElement(
            "isParameterPresent"); //$NON-NLS-1$
    answer.addElement(isParameterPresentElement);

    XmlElement includeElement = new XmlElement("include"); //$NON-NLS-1$
    includeElement.addAttribute(new Attribute("refid", //$NON-NLS-1$
            introspectedTable.getIbatis2SqlMapNamespace()
                    + "." + introspectedTable.getExampleWhereClauseId())); //$NON-NLS-1$
    isParameterPresentElement.addElement(includeElement);

    if (context.getPlugins()
            .sqlMapUpdateByExampleWithBLOBsElementGenerated(answer,
                    introspectedTable)) {
        parentElement.addElement(answer);
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:61,代码来源:UpdateByExampleWithBLOBsElementGenerator.java


示例16: addElements

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
    XmlElement answer = new XmlElement("update"); //$NON-NLS-1$

    answer.addAttribute(new Attribute(
            "id", introspectedTable.getUpdateByExampleStatementId())); //$NON-NLS-1$

    context.getCommentGenerator().addComment(answer);

    StringBuilder sb = new StringBuilder();
    sb.append("update "); //$NON-NLS-1$
    sb.append(introspectedTable
            .getAliasedFullyQualifiedTableNameAtRuntime());
    answer.addElement(new TextElement(sb.toString()));

    // set up for first column
    sb.setLength(0);
    sb.append("set "); //$NON-NLS-1$

    Iterator<IntrospectedColumn> iter = introspectedTable
            .getNonBLOBColumns().iterator();
    while (iter.hasNext()) {
        IntrospectedColumn introspectedColumn = iter.next();

        sb.append(Ibatis2FormattingUtilities
                .getAliasedEscapedColumnName(introspectedColumn));
        sb.append(" = "); //$NON-NLS-1$
        sb.append(Ibatis2FormattingUtilities.getParameterClause(
                introspectedColumn, "record.")); //$NON-NLS-1$

        if (iter.hasNext()) {
            sb.append(',');
        }

        answer.addElement(new TextElement(sb.toString()));

        // set up for the next column
        if (iter.hasNext()) {
            sb.setLength(0);
            OutputUtilities.xmlIndent(sb, 1);
        }
    }

    XmlElement isParameterPresentElement = new XmlElement(
            "isParameterPresent"); //$NON-NLS-1$
    answer.addElement(isParameterPresentElement);

    XmlElement includeElement = new XmlElement("include"); //$NON-NLS-1$
    includeElement.addAttribute(new Attribute("refid", //$NON-NLS-1$
            introspectedTable.getIbatis2SqlMapNamespace()
                    + "." + introspectedTable.getExampleWhereClauseId())); //$NON-NLS-1$
    isParameterPresentElement.addElement(includeElement);

    if (context.getPlugins()
            .sqlMapUpdateByExampleWithoutBLOBsElementGenerated(answer,
                    introspectedTable)) {
        parentElement.addElement(answer);
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:60,代码来源:UpdateByExampleWithoutBLOBsElementGenerator.java


示例17: addElements

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
    XmlElement answer = new XmlElement("delete"); //$NON-NLS-1$

    answer.addAttribute(new Attribute(
            "id", introspectedTable.getDeleteByPrimaryKeyStatementId())); //$NON-NLS-1$
    String parameterClass;
    if (introspectedTable.getRules().generatePrimaryKeyClass()) {
        parameterClass = introspectedTable.getPrimaryKeyType();
    } else {
        parameterClass = introspectedTable.getBaseRecordType();
    }
    answer.addAttribute(new Attribute("parameterClass", //$NON-NLS-1$
            parameterClass));

    context.getCommentGenerator().addComment(answer);

    StringBuilder sb = new StringBuilder();
    sb.append("delete from "); //$NON-NLS-1$
    sb.append(introspectedTable.getFullyQualifiedTableNameAtRuntime());
    answer.addElement(new TextElement(sb.toString()));

    boolean and = false;
    for (IntrospectedColumn introspectedColumn : introspectedTable
            .getPrimaryKeyColumns()) {
        sb.setLength(0);
        if (and) {
            sb.append("  and "); //$NON-NLS-1$
        } else {
            sb.append("where "); //$NON-NLS-1$
            and = true;
        }

        sb.append(Ibatis2FormattingUtilities
                .getEscapedColumnName(introspectedColumn));
        sb.append(" = "); //$NON-NLS-1$
        sb.append(Ibatis2FormattingUtilities
                .getParameterClause(introspectedColumn));
        answer.addElement(new TextElement(sb.toString()));
    }

    if (context.getPlugins()
            .sqlMapDeleteByPrimaryKeyElementGenerated(answer,
                    introspectedTable)) {
        parentElement.addElement(answer);
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:48,代码来源:DeleteByPrimaryKeyElementGenerator.java


示例18: addElements

import org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
    XmlElement answer = new XmlElement("select"); //$NON-NLS-1$

    answer.addAttribute(new Attribute(
            "id", introspectedTable.getSelectByPrimaryKeyStatementId())); //$NON-NLS-1$
    if (introspectedTable.getRules().generateResultMapWithBLOBs()) {
        answer.addAttribute(new Attribute("resultMap", //$NON-NLS-1$
                introspectedTable.getResultMapWithBLOBsId()));
    } else {
        answer.addAttribute(new Attribute("resultMap", //$NON-NLS-1$
                introspectedTable.getBaseResultMapId()));
    }

    String parameterType;
    if (introspectedTable.getRules().generatePrimaryKeyClass()) {
        parameterType = introspectedTable.getPrimaryKeyType();
    } else {
        // select by primary key, but no primary key class. Fields
        // must be in the base record
        parameterType = introspectedTable.getBaseRecordType();
    }

    answer.addAttribute(new Attribute("parameterClass", //$NON-NLS-1$
            parameterType));

    context.getCommentGenerator().addComment(answer);

    StringBuilder sb = new StringBuilder();
    sb.append("select "); //$NON-NLS-1$

    if (stringHasValue(introspectedTable
            .getSelectByPrimaryKeyQueryId())) {
        sb.append('\'');
        sb.append(introspectedTable.getSelectByPrimaryKeyQueryId());
        sb.append("' as QUERYID,"); //$NON-NLS-1$
    }
    answer.addElement(new TextElement(sb.toString()));
    answer.addElement(getBaseColumnListElement());
    if (introspectedTable.hasBLOBColumns()) {
        answer.addElement(new TextElement(",")); //$NON-NLS-1$
        answer.addElement(getBlobColumnListElement());
    }

    sb.setLength(0);
    sb.append("from "); //$NON-NLS-1$
    sb.append(introspectedTable
            .getAliasedFullyQualifiedTableNameAtRuntime());
    answer.addElement(new TextElement(sb.toString()));

    boolean and = false;
    for (IntrospectedColumn introspectedColumn : introspectedTable
            .getPrimaryKeyColumns()) {
        sb.setLength(0);
        if (and) {
            sb.append("  and "); //$NON-NLS-1$
        } else {
            sb.append("where "); //$NON-NLS-1$
            and = true;
        }

        sb.append(Ibatis2FormattingUtilities
                .getAliasedEscapedColumnName(introspectedColumn));
        sb.append(" = "); //$NON-NLS-1$
        sb.append(Ibatis2FormattingUtilities
                .getParameterClause(introspectedColumn));
        answer.addElement(new TextElement(sb.toString()));
    }

    if (context.getPlugins()
            .sqlMapSelectByPrimaryKeyElementGenerated(answer,
                    introspectedTable)) {
        parentElement.addElement(answer);
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:76,代码来源:SelectByPrimaryKeyElementGenerator.java



注:本文中的org.mybatis.generator.codegen.ibatis2.Ibatis2FormattingUtilities类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AnimationMetadataSectionSerializer类代码示例发布时间:2022-05-22
下一篇:
Java KeycloakDeploymentBuilder类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap