Package org.mybatis.generator.api.dom.java

Examples of org.mybatis.generator.api.dom.java.Method


    FullyQualifiedJavaType returnType = FullyQualifiedJavaType
        .getNewListInstance();
    returnType.addTypeArgument(new FullyQualifiedJavaType(introspectedTable
        .getBaseRecordType()));
    importedTypes.add(returnType);
    Method method = new Method();
    method.setReturnType(returnType);
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName("findByCriteria");
    FullyQualifiedJavaType pType = new FullyQualifiedJavaType(
        introspectedTable.getExampleType());
    importedTypes.add(pType);
    method.addParameter(new Parameter(pType, "criteria"));
    method.addJavaDocLine("/**\n" + "* @Description:\n" + "*/");
    interfaze.addImportedTypes(importedTypes);
    interfaze.addMethod(method);
  }
 
View Full Code Here


    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    FullyQualifiedJavaType returnType = new FullyQualifiedJavaType("java.util.LinkedHashMap");
    returnType.addTypeArgument(new FullyQualifiedJavaType("java.lang.String"));
    returnType.addTypeArgument(new FullyQualifiedJavaType("java.util.List"));
    importedTypes.add(returnType);
    Method method = new Method();
    method.addSuppressTypeWarningsAnnotation();
    method.setReturnType(returnType);
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName("getExportData");
    method.addJavaDocLine("/**\n" + "* @Description: 获取导出到Excel的数据\n" + "*/");
    interfaze.addImportedTypes(importedTypes);
    interfaze.addMethod(method);
  }
 
View Full Code Here

  }

  @Override
  public void addImplementationElements(TopLevelClass topLevelClass) {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    Method method = getMethodShell(importedTypes);

    StringBuilder sb = new StringBuilder();
    sb.append("int rows = "); //$NON-NLS-1$
    sb.append(daoTemplate.getDeleteMethod(introspectedTable.getIbatis2SqlMapNamespace(),
        introspectedTable.getDeleteByExampleStatementId(), "example")); //$NON-NLS-1$
    method.addBodyLine(sb.toString());
    method.addBodyLine("return rows;"); //$NON-NLS-1$

    if (context.getPlugins().clientDeleteByExampleMethodGenerated(method, topLevelClass, introspectedTable)) {
      topLevelClass.addImportedTypes(importedTypes);
      topLevelClass.addMethod(method);
    }
View Full Code Here

  @Override
  public void addInterfaceElements(Interface interfaze) {
    if (getExampleMethodVisibility() == JavaVisibility.PUBLIC) {
      Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
      Method method = getMethodShell(importedTypes);
      context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable, "根据条件删除记录");
      if (context.getPlugins().clientDeleteByExampleMethodGenerated(method, interfaze, introspectedTable)) {
        interfaze.addImportedTypes(importedTypes);
        interfaze.addMethod(method);
      }
View Full Code Here

  private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
    FullyQualifiedJavaType type = new FullyQualifiedJavaType(introspectedTable.getExampleType());
    importedTypes.add(type);

    Method method = new Method();
    method.setVisibility(getExampleMethodVisibility());
    method.setReturnType(FullyQualifiedJavaType.getIntInstance());
    method.setName(getDAOMethodNameCalculator().getDeleteByExampleMethodName(introspectedTable));
    method.addParameter(new Parameter(type, "example")); //$NON-NLS-1$

    for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
      method.addException(fqjt);
      importedTypes.add(fqjt);
    }

    context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
View Full Code Here

  }

  @Override
  public void addImplementationElements(TopLevelClass topLevelClass) {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    Method method = getMethodShell(importedTypes);

    StringBuilder sb = new StringBuilder();
    sb.append("int rows = "); //$NON-NLS-1$
    sb.append(daoTemplate.getUpdateMethod(introspectedTable.getIbatis2SqlMapNamespace(),
        introspectedTable.getUpdateByPrimaryKeySelectiveStatementId(), "record")); //$NON-NLS-1$
    method.addBodyLine(sb.toString());

    method.addBodyLine("return rows;"); //$NON-NLS-1$

    if (context.getPlugins().clientUpdateByPrimaryKeySelectiveMethodGenerated(method, topLevelClass,
        introspectedTable)) {
      topLevelClass.addImportedTypes(importedTypes);
      topLevelClass.addMethod(method);
View Full Code Here

  }

  @Override
  public void addInterfaceElements(Interface interfaze) {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    Method method = getMethodShell(importedTypes);
    context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable, "根据主键更新属性不为空的记录");
    if (context.getPlugins().clientUpdateByPrimaryKeySelectiveMethodGenerated(method, interfaze, introspectedTable)) {
      interfaze.addImportedTypes(importedTypes);
      interfaze.addMethod(method);
    }
View Full Code Here

      parameterType = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
    }

    importedTypes.add(parameterType);

    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setReturnType(FullyQualifiedJavaType.getIntInstance());
    method.setName(getDAOMethodNameCalculator().getUpdateByPrimaryKeySelectiveMethodName(introspectedTable));
    method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$

    for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
      method.addException(fqjt);
      importedTypes.add(fqjt);
    }

    context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
View Full Code Here

  }

  @Override
  public void addImplementationElements(TopLevelClass topLevelClass) {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    Method method = getMethodShell(importedTypes);

    if (generateForJava5) {
      method.addSuppressTypeWarningsAnnotation();
    }

    StringBuilder sb = new StringBuilder();
    sb.append(method.getReturnType().getShortName());
    sb.append(" list = "); //$NON-NLS-1$
    sb.append(daoTemplate.getQueryForListMethod(introspectedTable.getIbatis2SqlMapNamespace(),
        introspectedTable.getSelectByExampleWithBLOBsStatementId(), "example")); //$NON-NLS-1$
    method.addBodyLine(sb.toString());
    method.addBodyLine("return list;"); //$NON-NLS-1$

    if (context.getPlugins()
        .clientSelectByExampleWithBLOBsMethodGenerated(method, topLevelClass, introspectedTable)) {
      topLevelClass.addImportedTypes(importedTypes);
      topLevelClass.addMethod(method);
View Full Code Here

  @Override
  public void addInterfaceElements(Interface interfaze) {
    if (getExampleMethodVisibility() == JavaVisibility.PUBLIC) {
      Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
      Method method = getMethodShell(importedTypes);
      context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable, "根据条件查询记录集");
      if (context.getPlugins()
          .clientSelectByExampleWithBLOBsMethodGenerated(method, interfaze, introspectedTable)) {
        interfaze.addImportedTypes(importedTypes);
        interfaze.addMethod(method);
View Full Code Here

TOP

Related Classes of org.mybatis.generator.api.dom.java.Method

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.