code: protected String genCountStatement() {
      StringBuilder countString = new StringBuilder("select count(*) ");
      // 原始查询语句
      final String genQueryStr = genQueryStatement(false);
      if (isEmpty(genQueryStr)) { return ""; }
      final String lowerCaseQueryStr = genQueryStr.toLowerCase();
  
      if (contains(lowerCaseQueryStr, " group ")) { return ""; }
      if (contains(lowerCaseQueryStr, " union ")) { return ""; }
  
      final int indexOfFrom = findIndexOfFrom(lowerCaseQueryStr);
      final String selectWhat = lowerCaseQueryStr.substring(0, indexOfFrom);
      final int indexOfDistinct = selectWhat.indexOf("distinct");
      // select distinct a from table;
      if (-1 != indexOfDistinct) {
        if (contains(selectWhat, ",")) {
          return "";
        } else {
          countString = new StringBuilder("select count(");
          countString.append(genQueryStr.substring(indexOfDistinct, indexOfFrom)).append(") ");
        }
      }
  
      int orderIdx = genQueryStr.lastIndexOf(" order ");
      if (-1 == orderIdx) orderIdx = genQueryStr.length();
      countString.append(genQueryStr.substring(indexOfFrom, orderIdx));
      return countString.toString();
    }
docs: 形成计数查询语句，如果不能形成，则返回""
  
  @return a {@link java.lang.String} object.