当前位置: 首页>>代码示例>>Java>>正文


Java IntrospectedColumn.getActualColumnName方法代码示例

本文整理汇总了Java中org.mybatis.generator.api.IntrospectedColumn.getActualColumnName方法的典型用法代码示例。如果您正苦于以下问题:Java IntrospectedColumn.getActualColumnName方法的具体用法?Java IntrospectedColumn.getActualColumnName怎么用?Java IntrospectedColumn.getActualColumnName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mybatis.generator.api.IntrospectedColumn的用法示例。


在下文中一共展示了IntrospectedColumn.getActualColumnName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRenamedColumnNameForResultMap

import org.mybatis.generator.api.IntrospectedColumn; //导入方法依赖的package包/类
/**
 * The renamed column name for a select statement. If there is a table alias, the value will be alias_columnName.
 * This is appropriate for use in a result map.
 *
 * @param introspectedColumn
 *            the introspected column
 * @return the renamed column name
 */
public static String getRenamedColumnNameForResultMap(
        IntrospectedColumn introspectedColumn) {
    if (stringHasValue(introspectedColumn.getTableAlias())) {
        StringBuilder sb = new StringBuilder();

        sb.append(introspectedColumn.getTableAlias());
        sb.append('_');
        sb.append(introspectedColumn.getActualColumnName());
        return sb.toString();
    } else {
        return introspectedColumn.getActualColumnName();
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:22,代码来源:Ibatis2FormattingUtilities.java

示例2: addBatchUpdateXml

import org.mybatis.generator.api.IntrospectedColumn; //导入方法依赖的package包/类
public void addBatchUpdateXml(Document document, IntrospectedTable introspectedTable) {
	List<IntrospectedColumn> columns = introspectedTable.getAllColumns();
	String keyColumn=introspectedTable.getPrimaryKeyColumns().get(0).getActualColumnName();
	
	XmlElement insertBatchElement = new XmlElement("update");
	insertBatchElement.addAttribute(new Attribute("id", "updateBatchByPrimaryKeySelective"));
	insertBatchElement.addAttribute(new Attribute("parameterType", "java.util.List"));
	
	XmlElement foreach=new XmlElement("foreach");
	foreach.addAttribute(new Attribute("collection","list"));
	foreach.addAttribute(new Attribute("item","item"));
	foreach.addAttribute(new Attribute("index","index"));
	foreach.addAttribute(new Attribute("separator",";"));
	
	foreach.addElement(new TextElement("update " + introspectedTable.getAliasedFullyQualifiedTableNameAtRuntime()));

	XmlElement trim1Element = new XmlElement("set");
	for (IntrospectedColumn introspectedColumn : columns) {
		String columnName = introspectedColumn.getActualColumnName();
		if(!columnName.toUpperCase().equalsIgnoreCase(keyColumn)){//不是自增字段的才会出现在批量插入中
			XmlElement ifxml=new XmlElement("if");
			ifxml.addAttribute(new Attribute("test", "item."+introspectedColumn.getJavaProperty()+"!=null"));
			ifxml.addElement(new TextElement(columnName+"=#{item."+introspectedColumn.getJavaProperty()+",jdbcType="+introspectedColumn.getJdbcTypeName() + "},"));
			trim1Element.addElement(ifxml);
		}
	}
	foreach.addElement(trim1Element);

	foreach.addElement(new TextElement("where "));
	int index=0;
	for(IntrospectedColumn i:introspectedTable.getPrimaryKeyColumns()){
		foreach.addElement(new TextElement((index>0?" AND ":"")+i.getActualColumnName()+" = #{item."+i.getJavaProperty()+",jdbcType="+i.getJdbcTypeName()+"}"));
	}
	
	insertBatchElement.addElement(foreach);

	document.getRootElement().addElement(insertBatchElement);
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:39,代码来源:BatchUpdatePlugin.java

示例3: addGeneralMethodAnnotation

import org.mybatis.generator.api.IntrospectedColumn; //导入方法依赖的package包/类
@Override
public void addGeneralMethodAnnotation(Method method, IntrospectedTable introspectedTable,
                                       IntrospectedColumn introspectedColumn, Set<FullyQualifiedJavaType> imports) {
    imports.add(new FullyQualifiedJavaType("javax.annotation.Generated")); //$NON-NLS-1$
    String comment = "Source field: " //$NON-NLS-1$
            + introspectedTable.getFullyQualifiedTable().toString()
            + "." //$NON-NLS-1$
            + introspectedColumn.getActualColumnName();
    method.addAnnotation(getGeneratedAnnotation(comment));
}
 
开发者ID:itfsw,项目名称:mybatis-generator-plugin,代码行数:11,代码来源:TemplateCommentGenerator.java

示例4: addFieldAnnotation

import org.mybatis.generator.api.IntrospectedColumn; //导入方法依赖的package包/类
@Override
public void addFieldAnnotation(Field field, IntrospectedTable introspectedTable,
                               IntrospectedColumn introspectedColumn, Set<FullyQualifiedJavaType> imports) {
    imports.add(new FullyQualifiedJavaType("javax.annotation.Generated")); //$NON-NLS-1$
    String comment = "Source field: " //$NON-NLS-1$
            + introspectedTable.getFullyQualifiedTable().toString()
            + "." //$NON-NLS-1$
            + introspectedColumn.getActualColumnName();
    field.addAnnotation(getGeneratedAnnotation(comment));
}
 
开发者ID:itfsw,项目名称:mybatis-generator-plugin,代码行数:11,代码来源:TemplateCommentGenerator.java

示例5: addBatchInsertSelectiveXml

import org.mybatis.generator.api.IntrospectedColumn; //导入方法依赖的package包/类
public void addBatchInsertSelectiveXml(Document document, IntrospectedTable introspectedTable) {
	List<IntrospectedColumn> columns = introspectedTable.getAllColumns();
	//获得要自增的列名
	String incrementField = introspectedTable.getTableConfiguration().getProperties().getProperty("incrementField");
	if(incrementField!=null){
		incrementField = incrementField.toUpperCase();
	}
	XmlElement javaPropertyAndDbType = new XmlElement("trim");
	javaPropertyAndDbType.addAttribute(new Attribute("prefix", " ("));
	javaPropertyAndDbType.addAttribute(new Attribute("suffix", ")"));
	javaPropertyAndDbType.addAttribute(new Attribute("suffixOverrides", ","));
	
	XmlElement insertBatchElement = new XmlElement("insert");
	insertBatchElement.addAttribute(new Attribute("id", "insertBatchSelective"));
	insertBatchElement.addAttribute(new Attribute("parameterType", "java.util.List"));

	XmlElement trim1Element = new XmlElement("trim");
	trim1Element.addAttribute(new Attribute("prefix", "("));
	trim1Element.addAttribute(new Attribute("suffix", ")"));
	trim1Element.addAttribute(new Attribute("suffixOverrides", ","));
	for (IntrospectedColumn introspectedColumn : columns) {
		String columnName = introspectedColumn.getActualColumnName();
		if(!columnName.toUpperCase().equals(incrementField)){//不是自增字段的才会出现在批量插入中
			XmlElement iftest=new XmlElement("if");
			iftest.addAttribute(new Attribute("test","list[0]."+introspectedColumn.getJavaProperty()+"!=null"));
			iftest.addElement(new TextElement(columnName+","));
			trim1Element.addElement(iftest);
			XmlElement trimiftest=new XmlElement("if");
			trimiftest.addAttribute(new Attribute("test","item."+introspectedColumn.getJavaProperty()+"!=null"));
			trimiftest.addElement(new TextElement("#{item." + introspectedColumn.getJavaProperty() + ",jdbcType=" + introspectedColumn.getJdbcTypeName() + "},"));
			javaPropertyAndDbType.addElement(trimiftest);
		}
	}

	XmlElement foreachElement = new XmlElement("foreach");
	foreachElement.addAttribute(new Attribute("collection", "list"));
	foreachElement.addAttribute(new Attribute("index", "index"));
	foreachElement.addAttribute(new Attribute("item", "item"));
	foreachElement.addAttribute(new Attribute("separator", ","));
	insertBatchElement.addElement(new TextElement("insert into " + introspectedTable.getAliasedFullyQualifiedTableNameAtRuntime()));
	insertBatchElement.addElement(trim1Element);
	insertBatchElement.addElement(new TextElement(" values "));
	foreachElement.addElement(javaPropertyAndDbType);
	insertBatchElement.addElement(foreachElement);

	document.getRootElement().addElement(insertBatchElement);
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:48,代码来源:BatchInsertPlugin.java


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