public static String createInsertSql(String sql,
			Map<String, Object> fieldsValue, Element classElement,
			String primaryName) {
		List<Element> primaryElements = getColumnByPrimaryName(primaryName,
				classElement);
		// System.out.println(fieldsValue);
		// Boolean[] idIncrements = new Boolean[2];
		List<Boolean> idIncrements = new ArrayList<Boolean>();
		// System.out.println(primaryElements.size());
		for (Element primaryElement : primaryElements) {

			idIncrements.add(Boolean.parseBoolean(primaryElement
					.attributeValue("auto_increment")));
			sql = sql + primaryElement.attributeValue("column") + ",";
		}

		int countColumn = 0;

		Iterator<String> iterator = fieldsValue.keySet().iterator();
		while (iterator.hasNext()) {
			String fieldName = iterator.next();
			// 实体类对象对应的键值对不能为空
			if (fieldsValue.get(fieldName) != null) {
				Element prop = getColumnByPropertiesName(fieldName,
						classElement);
				if (prop != null
						&& (prop.attribute("key") == null || prop
								.attributeValue("key").equals("foreign"))) {
					sql = sql + prop.attributeValue("column") + ",";
					countColumn++;
				}
			}
		}

		sql = sql.substring(0, sql.lastIndexOf(",")) + ") values (";
		// System.out.println(sql);

		for (int i = 0; i < idIncrements.size(); i++) {

			if (idIncrements.get(i) == true) {
				sql = sql + "null,";
			} else {
				sql = sql + "?,";
			}
		}
		for (int i = 0; i < countColumn; i++) {
			sql = sql + "?,";
		}
		System.out.println(sql.substring(0, sql.lastIndexOf(',')) + ")");

		return sql.substring(0, sql.lastIndexOf(',')) + ")";

	}