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

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


    FullyQualifiedJavaType intType = FullyQualifiedJavaType
        .getIntInstance();
    addField("startIndex", intType, topLevelClass, "// 开始索引号");
    addField("pageSize", intType, topLevelClass, "// 每页大小");

    Method newConstructorMethod = new Method();
    newConstructorMethod.setConstructor(true);
    newConstructorMethod.addParameter(new Parameter(intType, "pageSize"));
    newConstructorMethod.addParameter(new Parameter(intType, "startIndex"));
    newConstructorMethod.addBodyLine("this();");
    newConstructorMethod.addBodyLine("this.pageSize=pageSize;");
    newConstructorMethod.addBodyLine("this.startIndex=startIndex;");
    newConstructorMethod.setVisibility(JavaVisibility.PUBLIC);
    newConstructorMethod.setName(topLevelClass.getType().getShortName());

    topLevelClass.addMethod(newConstructorMethod);
    return true;
  }
View Full Code Here


    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    FullyQualifiedJavaType type = new FullyQualifiedJavaType(
        introspectedTable.getBaseRecordType());
    importedTypes.add(type);

    Method method = new Method();
    method.setReturnType(new FullyQualifiedJavaType("int"));
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName("update");
    method.addParameter(new Parameter(type, "entity"));
    method.addBodyLine("return " + mapperObjName + ".updateByPrimaryKeySelective(entity);");
    method.addAnnotation("@Override");
    topLevelClass.addMethod(method);
    topLevelClass.addImportedTypes(importedTypes);

  }
View Full Code Here

    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    FullyQualifiedJavaType type = new FullyQualifiedJavaType(
        introspectedTable.getBaseRecordType());
    importedTypes.add(type);

    Method method = new Method();
    method.setReturnType(new FullyQualifiedJavaType("int"));
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName("delete");
    method.addParameter(new Parameter(type, "entity"));
    method.addBodyLine("return " + mapperObjName + ".deleteByPrimaryKey(entity.getId());");
    method.addAnnotation("@Override");
    topLevelClass.addMethod(method);
    topLevelClass.addImportedTypes(importedTypes);
  }
View Full Code Here

    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    FullyQualifiedJavaType type = new FullyQualifiedJavaType(
        introspectedTable.getBaseRecordType());
    importedTypes.add(type);

    Method method = new Method();
    method.setReturnType(new FullyQualifiedJavaType("int"));
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName("add");
    method.addParameter(new Parameter(type, "entity"));
    method.addBodyLine("return " + mapperObjName + ".insert(entity);");
    method.addAnnotation("@Override");
    topLevelClass.addMethod(method);
    topLevelClass.addImportedTypes(importedTypes);

  }
View Full Code Here

  {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    FullyQualifiedJavaType type = new FullyQualifiedJavaType(
        introspectedTable.getBaseRecordType());
    importedTypes.add(type);
    Method method = new Method();
    method.setReturnType(new FullyQualifiedJavaType("int"));
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName("add");
    method.addParameter(new Parameter(type, "entity"))
    method.addJavaDocLine("/**\n" + "* @Description:\n" + "* @param entity\n" + "*/");
    interfaze.addImportedTypes(importedTypes);
    interfaze.addMethod(method);
  }
 
View Full Code Here

  {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    FullyQualifiedJavaType type = new FullyQualifiedJavaType(
        introspectedTable.getBaseRecordType());
    importedTypes.add(type);
    Method method = new Method();
    method.setReturnType(new FullyQualifiedJavaType("int"));
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName("update");
    method.addParameter(new Parameter(type, "entity"))
    method.addJavaDocLine("/**\n" + "* @Description:\n" + "* @param entity\n" + "*/");
    interfaze.addImportedTypes(importedTypes);
    interfaze.addMethod(method);
  }
 
View Full Code Here

  {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    FullyQualifiedJavaType type = new FullyQualifiedJavaType(
        introspectedTable.getBaseRecordType());
    importedTypes.add(type);
    Method method = new Method();
    method.setReturnType(new FullyQualifiedJavaType("int"));
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName("delete");
    method.addParameter(new Parameter(type, "entity"))
    method.addJavaDocLine("/**\n" + "* @Description:\n" + "* @param entity\n" + "*/");
    interfaze.addImportedTypes(importedTypes);
    interfaze.addMethod(method);
  }
 
View Full Code Here

    type.addTypeArgument(FullyQualifiedJavaType.getObjectInstance());
    importedTypes.add(type);

    FullyQualifiedJavaType returnType = new FullyQualifiedJavaType("com.eatle.utils.Pagination");
    importedTypes.add(returnType);
    Method method = new Method();
    method.setReturnType(returnType);
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName("findPagination");
    method.addParameter(new Parameter(type, "queryMap"))
    method.addParameter(new Parameter(FullyQualifiedJavaType
        .getIntInstance(), "currentPage"));// int currentPage
    method.addParameter(new Parameter(FullyQualifiedJavaType
        .getIntInstance(), "pageSize"));// int pageSize
    method.addJavaDocLine("/**\n" + "* @Description:\n" + "* @param queryMap 查询参数\n"
        + "* @param currentPage 当前页\n" + "* @param pageSize 每页大小\n" + "*/");
    interfaze.addImportedTypes(importedTypes);
    interfaze.addMethod(method);
  }
 
View Full Code Here

  {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    FullyQualifiedJavaType returnType = new FullyQualifiedJavaType(
        introspectedTable.getBaseRecordType());
    importedTypes.add(returnType);
    Method method = new Method();
    method.setReturnType(returnType);
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName("findById");
    method.addParameter(new Parameter(
        new FullyQualifiedJavaType("long"), "id"))
    method.addJavaDocLine("/**\n" + "* @Description:\n" + "* @param id\n" + "*/");
    interfaze.addImportedTypes(importedTypes);
    interfaze.addMethod(method);
  }
 
View Full Code Here

    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("findAll");
    method.addJavaDocLine("/**\n" + "* @Description:\n" + "*/");
    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.