code: private String replaceVariables(String query, Map<String, Object> parameters) {
  		if (StringUtils.isNotEmpty(query)) {
  			try {
  				if (parameters != null) {
  					// 执行变量替换, 变量格式为:var
  					Set<String> keySet = parameters.keySet();
  					for (String key : keySet) {
  						Object value = parameters.get(key);
  
  						if (value instanceof String) {
  							value = String.format("'%s'", value);
  						} else if (value instanceof List) {
  							StringBuffer valueBuffer = new StringBuffer();
  
  							List<?> list = (List<?>) value;
  							for (Object item : list) {
  								if (item instanceof String) {
  									valueBuffer.append(String.format("'%s'", item) + ",");
  								} else {
  									valueBuffer.append(item.toString() + ",");
  								}
  							}
  							value = StringUtils.removeEnd(valueBuffer.toString(), ",");
  						} else if (value == null) {
  							continue;
  						} else if (value instanceof Date) {
  							value = String.format("'%s'", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format((Date) value));
  						} else {
  							value = value.toString();
  						}
  
  						key = ":" + key;
  						query = StringUtils.replace(query, key, (String) value);
  					}
  				}
  
  				// 多个空格替换为单个空格
  				if (query != null) {
  					query = query.replaceAll(" +", " ");
  				}
  			} catch (Exception e) {
  				return null;
  			}
  		}
  
  		return query;
  	}
docs: /*
  替换SQL语句的变量
  
  @param sql SQL语句
  
  @param parameters 参数表
  
  @return 构建后的SQL语句