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.addBodyLine("" + recordFullType + "Criteria " + recordLowCaseFullType + "Criteria = new " + recordFullType + "Criteria();");
method.addBodyLine("//Criteria criteria = " + recordLowCaseFullType + "Criteria.createCriteria();");
method.addBodyLine("// 设置搜索条件参数");
method.addBodyLine("//if(queryMap != null){");
method.addBodyLine("//if(queryMap.containsKey(\"username\")) {");
method.addBodyLine("//criteria.andUserNameLike(\"%\"+(String)queryMap.get(\"username\")+\"%\");");
method.addBodyLine("//}");
method.addBodyLine("//if(queryMap.containsKey(\"email\")){");
method.addBodyLine("//criteria.andEmailLike((String)queryMap.get(\"email\"));");
method.addBodyLine("//}");
method.addBodyLine("//}");
method.addBodyLine("// 设置分页参数");
method.addBodyLine(recordLowCaseFullType + "Criteria.setPageSize(pageSize);");
method.addBodyLine(recordLowCaseFullType + "Criteria.setStartIndex((currentPage-1)*pageSize);");
method.addBodyLine("List<" + recordFullType + "> items = " + mapperObjName + ".selectByCriteria(" + recordLowCaseFullType + "Criteria);");
method.addBodyLine("int totalCount = (int)" + mapperObjName + ".selectCountByCriteria(" + recordLowCaseFullType + "Criteria);");
method.addBodyLine("return new Pagination(pageSize, currentPage, totalCount, items);");
method.addAnnotation("@Override");
// import com.eatle.persistent.pojo.admin.ObjectCriteria.Criteria;
FullyQualifiedJavaType pType = new FullyQualifiedJavaType(
introspectedTable.getExampleType() + ".Criteria");
importedTypes.add(pType);