本文整理匯總了Java中org.mybatis.generator.api.dom.xml.XmlElement.addAttribute方法的典型用法代碼示例。如果您正苦於以下問題:Java XmlElement.addAttribute方法的具體用法?Java XmlElement.addAttribute怎麽用?Java XmlElement.addAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.mybatis.generator.api.dom.xml.XmlElement
的用法示例。
在下文中一共展示了XmlElement.addAttribute方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addElements
import org.mybatis.generator.api.dom.xml.XmlElement; //導入方法依賴的package包/類
@Override
public void addElements(XmlElement parentElement) {
XmlElement answer = new XmlElement("delete"); //$NON-NLS-1$
String fqjt = introspectedTable.getExampleType();
answer.addAttribute(new Attribute(
"id", introspectedTable.getDeleteByExampleStatementId())); //$NON-NLS-1$
answer.addAttribute(new Attribute("parameterType", fqjt)); //$NON-NLS-1$
context.getCommentGenerator().addComment(answer);
StringBuilder sb = new StringBuilder();
sb.append("delete from "); //$NON-NLS-1$
sb.append(introspectedTable
.getAliasedFullyQualifiedTableNameAtRuntime());
answer.addElement(new TextElement(sb.toString()));
answer.addElement(getExampleIncludeElement());
if (context.getPlugins().sqlMapDeleteByExampleElementGenerated(
answer, introspectedTable)) {
parentElement.addElement(answer);
}
}
示例2: getSqlMapElement
import org.mybatis.generator.api.dom.xml.XmlElement; //導入方法依賴的package包/類
protected XmlElement getSqlMapElement() {
FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
progressCallback.startTask(getString("Progress.12", table.toString())); //$NON-NLS-1$
XmlElement answer = new XmlElement("mapper"); //$NON-NLS-1$
String namespace = introspectedTable.getMyBatis3SqlMapNamespace();
answer.addAttribute(new Attribute("namespace", //$NON-NLS-1$
namespace));
context.getCommentGenerator().addRootComment(answer);
addResultMapElement(answer);
addDeleteByPrimaryKeyElement(answer);
addInsertElement(answer);
addUpdateByPrimaryKeyElement(answer);
addSelectByPrimaryKeyElement(answer);
addSelectAllElement(answer);
return answer;
}
示例3: addResultMapElements
import org.mybatis.generator.api.dom.xml.XmlElement; //導入方法依賴的package包/類
private void addResultMapElements(XmlElement answer) {
for (IntrospectedColumn introspectedColumn : introspectedTable
.getBLOBColumns()) {
XmlElement resultElement = new XmlElement("result"); //$NON-NLS-1$
resultElement
.addAttribute(new Attribute(
"column", MyBatis3FormattingUtilities.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);
}
}
示例4: generateSqlBaseColumns
import org.mybatis.generator.api.dom.xml.XmlElement; //導入方法依賴的package包/類
/**
* 生成包含全部列的 sql 元素
*/
private void generateSqlBaseColumns(Document document, IntrospectedTable introspectedTable) {
// 新建 sql 元素標簽
XmlElement sqlElement = new XmlElement("sql");
// 新建 sql 元素屬性
Attribute attr = new Attribute("id", id);
sqlElement.addAttribute(attr);
// 新建 sql 元素內容,填寫注釋
sqlElement.addElement(new TextElement(Constants.WARNING));
// 獲取全部列名稱
StringBuilder columnsBuilder = new StringBuilder();
List<IntrospectedColumn> columnList = introspectedTable.getAllColumns();
for (IntrospectedColumn column : columnList) {
columnsBuilder.append(MyBatis3FormattingUtilities.getSelectListPhrase(column)).append(", ");
}
// 刪除最後一個逗號
String columns = columnsBuilder.substring(0, columnsBuilder.length() - 2);
// 新建 sql 元素內容,填寫列名稱
sqlElement.addElement(new TextElement(columns));
// 將 sql 元素放到根元素下
XmlElement rootElement = document.getRootElement();
rootElement.addElement(new TextElement(""));
rootElement.addElement(sqlElement);
rootElement.addElement(new TextElement(""));
}
示例5: toXmlElement
import org.mybatis.generator.api.dom.xml.XmlElement; //導入方法依賴的package包/類
@Override
public XmlElement toXmlElement() {
XmlElement xmlElement = new XmlElement("except"); //$NON-NLS-1$
xmlElement.addAttribute(new Attribute("column", columnName)); //$NON-NLS-1$
if (stringHasValue(configuredDelimitedColumnName)) {
xmlElement.addAttribute(new Attribute(
"delimitedColumnName", configuredDelimitedColumnName)); //$NON-NLS-1$
}
return xmlElement;
}
示例6: toXmlElement
import org.mybatis.generator.api.dom.xml.XmlElement; //導入方法依賴的package包/類
public XmlElement toXmlElement() {
XmlElement answer = new XmlElement("plugin"); //$NON-NLS-1$
if (getConfigurationType() != null) {
answer.addAttribute(new Attribute("type", getConfigurationType())); //$NON-NLS-1$
}
addPropertyXmlElements(answer);
return answer;
}
示例7: addElements
import org.mybatis.generator.api.dom.xml.XmlElement; //導入方法依賴的package包/類
@Override
public void addElements(XmlElement parentElement) {
XmlElement answer = new XmlElement("select"); //$NON-NLS-1$
answer.addAttribute(new Attribute(
"id", introspectedTable.getCountByExampleStatementId())); //$NON-NLS-1$
answer.addAttribute(new Attribute(
"parameterClass", introspectedTable.getExampleType())); //$NON-NLS-1$
answer.addAttribute(new Attribute("resultClass", "java.lang.Long")); //$NON-NLS-1$ //$NON-NLS-2$
context.getCommentGenerator().addComment(answer);
StringBuilder sb = new StringBuilder();
sb.append("select count(*) from "); //$NON-NLS-1$
sb.append(introspectedTable
.getAliasedFullyQualifiedTableNameAtRuntime());
answer.addElement(new TextElement(sb.toString()));
XmlElement includeElement = new XmlElement("include"); //$NON-NLS-1$
sb.setLength(0);
sb.append(introspectedTable.getIbatis2SqlMapNamespace());
sb.append('.');
sb.append(introspectedTable.getExampleWhereClauseId());
includeElement.addAttribute(new Attribute("refid", //$NON-NLS-1$
sb.toString()));
answer.addElement(includeElement);
if (context.getPlugins().sqlMapCountByExampleElementGenerated(
answer, introspectedTable)) {
parentElement.addElement(answer);
}
}
開發者ID:xiachengwei5,項目名稱:org.mybatis.generator.core-1.3.5,代碼行數:34,代碼來源:CountByExampleElementGenerator.java
示例8: toXmlElement
import org.mybatis.generator.api.dom.xml.XmlElement; //導入方法依賴的package包/類
public XmlElement toXmlElement() {
XmlElement xmlElement = new XmlElement("columnRenamingRule"); //$NON-NLS-1$
xmlElement.addAttribute(new Attribute("searchString", searchString)); //$NON-NLS-1$
if (replaceString != null) {
xmlElement.addAttribute(new Attribute(
"replaceString", replaceString)); //$NON-NLS-1$
}
return xmlElement;
}
示例9: toXmlElement
import org.mybatis.generator.api.dom.xml.XmlElement; //導入方法依賴的package包/類
/**
* To xml element.
*
* @return the xml element
*/
public XmlElement toXmlElement() {
XmlElement xmlElement = new XmlElement("generatedKey"); //$NON-NLS-1$
xmlElement.addAttribute(new Attribute("column", column)); //$NON-NLS-1$
xmlElement.addAttribute(new Attribute(
"sqlStatement", configuredSqlStatement)); //$NON-NLS-1$
if (stringHasValue(type)) {
xmlElement.addAttribute(new Attribute("type", type)); //$NON-NLS-1$
}
xmlElement.addAttribute(new Attribute("identity", //$NON-NLS-1$
isIdentity ? "true" : "false")); //$NON-NLS-1$ //$NON-NLS-2$
return xmlElement;
}
示例10: getSqlMapElement
import org.mybatis.generator.api.dom.xml.XmlElement; //導入方法依賴的package包/類
private XmlElement getSqlMapElement(CommentGenerator commentGenerator) {
XmlElement answer = new XmlElement("mapper");
String namespace = "org.mybatis.test.TestMapper";
answer.addAttribute(new Attribute("namespace", namespace));
commentGenerator.addRootComment(answer);
addInsertElement(commentGenerator, answer);
addCdataNode1(commentGenerator, answer);
addCdataNode2(commentGenerator, answer);
return answer;
}
示例11: toXmlElement
import org.mybatis.generator.api.dom.xml.XmlElement; //導入方法依賴的package包/類
public XmlElement toXmlElement() {
XmlElement answer = new XmlElement("sqlMapGenerator"); //$NON-NLS-1$
if (targetPackage != null) {
answer.addAttribute(new Attribute("targetPackage", targetPackage)); //$NON-NLS-1$
}
if (targetProject != null) {
answer.addAttribute(new Attribute("targetProject", targetProject)); //$NON-NLS-1$
}
addPropertyXmlElements(answer);
return answer;
}
示例12: addElements
import org.mybatis.generator.api.dom.xml.XmlElement; //導入方法依賴的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);
}
}
示例13: addElements
import org.mybatis.generator.api.dom.xml.XmlElement; //導入方法依賴的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 (!isSimple && introspectedTable.getRules().generatePrimaryKeyClass()) {
parameterClass = introspectedTable.getPrimaryKeyType();
} else {
// PK fields are in the base class. If more than on PK
// field, then they are coming in a map.
if (introspectedTable.getPrimaryKeyColumns().size() > 1) {
parameterClass = "map"; //$NON-NLS-1$
} else {
parameterClass = introspectedTable.getPrimaryKeyColumns()
.get(0).getFullyQualifiedJavaType().toString();
}
}
answer.addAttribute(new Attribute("parameterType", //$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(MyBatis3FormattingUtilities
.getEscapedColumnName(introspectedColumn));
sb.append(" = "); //$NON-NLS-1$
sb.append(MyBatis3FormattingUtilities
.getParameterClause(introspectedColumn));
answer.addElement(new TextElement(sb.toString()));
}
if (context.getPlugins()
.sqlMapDeleteByPrimaryKeyElementGenerated(answer,
introspectedTable)) {
parentElement.addElement(answer);
}
}
示例14: addElements
import org.mybatis.generator.api.dom.xml.XmlElement; //導入方法依賴的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:Yanweichen,項目名稱:MybatisGeneatorUtil,代碼行數:61,代碼來源:UpdateByExampleWithBLOBsElementGenerator.java
示例15: addElements
import org.mybatis.generator.api.dom.xml.XmlElement; //導入方法依賴的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:nextyu,項目名稱:summer-mybatis-generator,代碼行數:60,代碼來源:UpdateByExampleWithoutBLOBsElementGenerator.java