Package org.mybatis.generator.api.dom.xml

Examples of org.mybatis.generator.api.dom.xml.TextElement


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

    XmlElement outerisNotEmptyElement = new XmlElement("if");
    outerisNotEmptyElement.addAttribute(new Attribute("test", "limit != null and start != null"));
    outerisNotEmptyElement.addElement(new TextElement("<![CDATA[ limit #{start} , #{limit} ]]>"));
    answer.addElement(outerisNotEmptyElement);
    return answer;
  }
View Full Code Here


      sb.setLength(0);
      sb.append(Ibatis2FormattingUtilities.getEscapedColumnName(introspectedColumn));
      sb.append(" = "); //$NON-NLS-1$
      sb.append(Ibatis2FormattingUtilities.getParameterClause(introspectedColumn, "condition."));
      isNotNullElement.addElement(new TextElement(sb.toString()));
    }

    return true;
  }
View Full Code Here

    XmlElement dynamicElement = new XmlElement("dynamic");
    XmlElement outerisNotEmptyElement = new XmlElement("isNotNull");
    outerisNotEmptyElement.addAttribute(new Attribute("property", "limit"));
    XmlElement innerisNotEmptyElement = new XmlElement("isNotNull");
    innerisNotEmptyElement.addAttribute(new Attribute("property", "start"));
    innerisNotEmptyElement.addElement(new TextElement("<![CDATA[ select * from ( select row_.*, rownum rownum_ from ( ]]>"));
    outerisNotEmptyElement.addElement(innerisNotEmptyElement);
    dynamicElement.addElement(outerisNotEmptyElement);
    answer.addElement(dynamicElement);
    return answer;
  }
View Full Code Here

    XmlElement dynamicElement = new XmlElement("dynamic");
    XmlElement outerisNotEmptyElement = new XmlElement("isNotNull");
    outerisNotEmptyElement.addAttribute(new Attribute("property", "limit"));
    XmlElement innerisNotEmptyElement = new XmlElement("isNotNull");
    innerisNotEmptyElement.addAttribute(new Attribute("property", "start"));
    innerisNotEmptyElement.addElement(new TextElement(
        "<![CDATA[ ) row_ where rownum <= (#limit# + #start#) ) where rownum_ > #start# ]]>"));
    outerisNotEmptyElement.addElement(innerisNotEmptyElement);
    dynamicElement.addElement(outerisNotEmptyElement);
    answer.addElement(dynamicElement);
    return answer;
View Full Code Here

    XmlElement dynamicElement = new XmlElement("dynamic");
    XmlElement outerisNotEmptyElement = new XmlElement("isNotNull");
    outerisNotEmptyElement.addAttribute(new Attribute("property", "limit"));
    XmlElement innerisNotEmptyElement = new XmlElement("isNotNull");
    innerisNotEmptyElement.addAttribute(new Attribute("property", "start"));
    innerisNotEmptyElement.addElement(new TextElement("<![CDATA[ limit #start# , #limit# ]]>"));
    outerisNotEmptyElement.addElement(innerisNotEmptyElement);
    dynamicElement.addElement(outerisNotEmptyElement);
    answer.addElement(dynamicElement);
    return answer;
  }
View Full Code Here

      } else {

        sb.append(MyBatis3FormattingUtilities.getParameterClause(introspectedColumn, "condition."));
      }
      isNotNullElement.addElement(new TextElement(sb.toString()));
    }
    if (!isAllInOne) {

      // Example_Where_Clause
      Where_Clause = (XmlElement) document.getRootElement().getElements().get(2);
      // 移除第一个
      Where_Clause.removeElement(0);

      sb = new StringBuilder();
      dynamicElement = new XmlElement("trim"); //$NON-NLS-1$
      dynamicElement.addAttribute(new Attribute("prefix", "where")); //$NON-NLS-1$ //$NON-NLS-2$
      dynamicElement.addAttribute(new Attribute("prefixOverrides", "and|or")); //$NON-NLS-1$ //$NON-NLS-2$
      Where_Clause.addElement(dynamicElement);

      for (IntrospectedColumn introspectedColumn : introspectedTable.getNonPrimaryKeyColumns()) {
        XmlElement isNotNullElement = new XmlElement("if"); //$NON-NLS-1$
        String va = introspectedColumn.getJavaProperty("example.condition.") + " != null";
        isNotNullElement.addAttribute(new Attribute("test", va)); //$NON-NLS-1$ //$NON-NLS-2$
        dynamicElement.addElement(isNotNullElement);

        sb.setLength(0);
        sb.append(" and "); //$NON-NLS-1$
        sb.append(Ibatis2FormattingUtilities.getEscapedColumnName(introspectedColumn));
        sb.append(" = "); //$NON-NLS-1$
        sb.append(MyBatis3FormattingUtilities.getParameterClause(introspectedColumn, "example.condition."));
        isNotNullElement.addElement(new TextElement(sb.toString()));
      }
    } else {
      document.getRootElement().getElements().remove(2);
    }
    return true;
View Full Code Here

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

    XmlElement outerisNotEmptyElement = new XmlElement("if");
    outerisNotEmptyElement.addAttribute(new Attribute("test", "limit != null and start != null"));
    outerisNotEmptyElement.addElement(new TextElement("<![CDATA[ select * from ( select row_.*, rownum rownum_ from ( ]]>"));
    answer.addElement(outerisNotEmptyElement);
    return answer;
  }
View Full Code Here

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

    XmlElement outerisNotEmptyElement = new XmlElement("if");
    outerisNotEmptyElement.addAttribute(new Attribute("test", "limit != null and start != null"));
    outerisNotEmptyElement.addElement(new TextElement(
        "<![CDATA[ ) row_ where rownum <= (#{limit} + #{start}) ) where rownum_ > #{start} ]]>"));
    answer.addElement(outerisNotEmptyElement);
    return answer;
  }
View Full Code Here

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

    XmlElement outerisNotEmptyElement = new XmlElement("if");
    outerisNotEmptyElement.addAttribute(new Attribute("test", "limit != null and start != null"));
    outerisNotEmptyElement.addElement(new TextElement("<![CDATA[ limit #{start} , #{limit} ]]>"));
    answer.addElement(outerisNotEmptyElement);
    return answer;
  }
View Full Code Here

        XmlConstants.MYBATIS3_MAPPER_CONFIG_SYSTEM_ID);

    XmlElement root = new XmlElement("configuration"); //$NON-NLS-1$
    document.setRootElement(root);

    root.addElement(new TextElement("<!--")); //$NON-NLS-1$
    root.addElement(new TextElement("  This file is generated by MyBatis Generator.")); //$NON-NLS-1$
    root.addElement(new TextElement(
        "  This file is the shell of a Mapper Config file - in many cases you will need to add")); //$NON-NLS-1$
    root.addElement(new TextElement("    to this file before it is usable by MyBatis.")); //$NON-NLS-1$

    StringBuilder sb = new StringBuilder();
    sb.append("  This file was generated on "); //$NON-NLS-1$
    sb.append(new Date());
    sb.append('.');
    root.addElement(new TextElement(sb.toString()));

    root.addElement(new TextElement("-->")); //$NON-NLS-1$

    XmlElement mappers = new XmlElement("mappers"); //$NON-NLS-1$
    root.addElement(mappers);

    XmlElement mapper;
View Full Code Here

TOP

Related Classes of org.mybatis.generator.api.dom.xml.TextElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.