public static String createSearchSql(String sql, int firstIndex,
			int lastIndex, Map<String, String> OrderBy, Element classElement,
			Map<Element, Object> condition, int flag, int countFlag) {

		System.out.println(condition);
		Iterator<Element> conditionElement = condition.keySet().iterator();
		while (conditionElement.hasNext()) {
			Element prop = conditionElement.next();

			if (flag == 0) {

				sql = sql + " " + prop.attributeValue("column") + "=? and";
			} else {
				sql = sql + " " + prop.attributeValue("column") + "=? or";
			}
		}
		if (flag == 0) {
			sql = sql.substring(0, sql.lastIndexOf("and"));
		} else {
			sql = sql.substring(0, sql.lastIndexOf("or"));
		}

		if (countFlag == 1) {
			sql = EntitySearchHelper.createOrderBySql(OrderBy, sql,
					classElement);
			sql = sql + " limit " + firstIndex + "," + lastIndex;
		}

		return sql;
	}