private void destroyDialogAndCreateQueryUrl() { StringBuilder sb = new StringBuilder(); String geologyObject = ""; for (int i = 0; i < mContainer.getChildCount(); i++) { QueryItem item = (QueryItem) mContainer.getChildAt(i); String orAnd = item.getSpinnerValue(0); geologyObject = item.getSpinnerValue(1); String condition = item.getSpinnerValue(2); String conditionValue = item.getSpinnerValue(3); double max = item.getMaxValue(); double min = item.getMinValue(); if (conditionValue.equals("特大型")) { min = 1500; } else if (conditionValue.equals("超大型")) { max = 1500; min = 500; } else if (conditionValue.equals("大型")) { max = 500; min = 100; } else if (conditionValue.equals("中型")) { max = 100; min = 10; } else if (conditionValue.equals("小型")) { max = 10; } else if (conditionValue.equals("自定义")) { } String str = getURLPartByValues(orAnd, geologyObject, condition, conditionValue, max, min); if (str.endsWith("&")) { str = str.substring(0, str.length() - 1); } sb.append(str); } String key = sb.toString(); if (key.startsWith("&")) { key = key.substring(1); } mylog.i( TAG, "destroyDialogAndCreateQueryUrl URL is " + key + " geologyObject " + geologyObject); if (geologyObject.equals("盆地")) { executeNetworkForBasin(key); } if (geologyObject.equals("油气田")) { executeNetworkForOil(key); } if (geologyObject.equals("油气藏")) { executeNetworkForYouQi(key); } }
private String getURLPartByValues( String orAnd, String geologyObject, String condition, String conditionValue, double max, double min) { slog.p( TAG, "getURLPartByValues orAnd " + orAnd + " orAnd " + geologyObject + " condition " + condition + " conditionValue " + conditionValue + "max " + max + " min " + min); StringBuilder sb = new StringBuilder(); if (orAnd.equals(AND)) { // 多条加入的 sb.append("&"); } // 判断有没有最大值 if (max > 0 || min > 0) { if (max > 0) { // add max String conditionCode = getEncodeByMap(condition + "最大值"); sb.append(conditionCode + "=" + max); sb.append("&"); } if (min > 0) { // add min String conditionCode = getEncodeByMap(condition + "最小值"); sb.append(conditionCode + "=" + min); sb.append("&"); } } else { // 建立key value String conditionCode = getEncodeByMap(condition); String conditionValueCode = getEncodeByMap(conditionValue); sb.append(conditionCode + "=" + conditionValueCode); } slog.p(TAG, "getURLPartByValues url part is " + sb.toString()); return sb.toString(); }
public String whereSelectForOil(Long[] objArray) { StringBuilder builder = new StringBuilder("OBJ_ID = "); // StringBuilder builder = new StringBuilder("油气田名称 = "); for (int i = 0; i < objArray.length; i++) { if (i == objArray.length - 1) { // builder.append("'"); builder.append(objArray[i]); // builder.append("'"); } else { // builder.append("'"); builder.append(objArray[i]); // builder.append("'"); builder.append(" or OBJ_ID = "); } } return builder.toString(); }