|
@@ -22,6 +22,7 @@ import com.persagy.ibms.core.data.SceneDataValue;
|
|
import com.persagy.ibms.core.data.SceneProperty;
|
|
import com.persagy.ibms.core.data.SceneProperty;
|
|
import com.persagy.ibms.core.util.ComputeUtil;
|
|
import com.persagy.ibms.core.util.ComputeUtil;
|
|
import com.persagy.ibms.core.util.FastJsonReaderUtil;
|
|
import com.persagy.ibms.core.util.FastJsonReaderUtil;
|
|
|
|
+import com.persagy.ibms.core.util.FilterUtil;
|
|
import com.persagy.ibms.core.util.IntWrapper;
|
|
import com.persagy.ibms.core.util.IntWrapper;
|
|
import com.persagy.ibms.core.util.LogUtil;
|
|
import com.persagy.ibms.core.util.LogUtil;
|
|
import com.persagy.ibms.core.util.QueryAssist;
|
|
import com.persagy.ibms.core.util.QueryAssist;
|
|
@@ -58,7 +59,7 @@ public class RestUtil {
|
|
Content = sdv.toJSON(true, read_level == 0 ? -1 : read_level);
|
|
Content = sdv.toJSON(true, read_level == 0 ? -1 : read_level);
|
|
} else {
|
|
} else {
|
|
SceneDataPrimitive sdv = (SceneDataPrimitive) queryResult;
|
|
SceneDataPrimitive sdv = (SceneDataPrimitive) queryResult;
|
|
- Content = sdv.value;
|
|
|
|
|
|
+ Content = sdv.value;
|
|
}
|
|
}
|
|
result.put("Result", "success");
|
|
result.put("Result", "success");
|
|
result.put("Content", Content);
|
|
result.put("Content", Content);
|
|
@@ -75,6 +76,38 @@ public class RestUtil {
|
|
return JSONObject.toJSONString(result, SerializerFeature.WriteMapNullValue);
|
|
return JSONObject.toJSONString(result, SerializerFeature.WriteMapNullValue);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static String general_query(String param) {
|
|
|
|
+ try {
|
|
|
|
+ JSONObject sql_json = JSON.parseObject(param);
|
|
|
|
+ JSONObject query_json;
|
|
|
|
+ if (sql_json.containsKey("query_json")) {
|
|
|
|
+ query_json = sql_json.getJSONObject("query_json");
|
|
|
|
+ } else {
|
|
|
|
+ String QueryName = sql_json.getString("QueryName");
|
|
|
|
+ RepositoryImpl Repository = RepositoryContainer.instance;
|
|
|
|
+ query_json = Repository.general_queryMap.get(QueryName);
|
|
|
|
+ }
|
|
|
|
+ JSONObject params = sql_json.getJSONObject("params");
|
|
|
|
+ JSONObject CriteriaObject = query_json.getJSONObject("Criteria");
|
|
|
|
+ List<String> refPropertyList = new ArrayList<String>();
|
|
|
|
+ JSONObject CriteriaNew = (JSONObject) FilterUtil.parseCriteria(CriteriaObject, params, refPropertyList);
|
|
|
|
+ JSONObject query_json_new = new JSONObject();
|
|
|
|
+ for (String key : query_json.keySet()) {
|
|
|
|
+ if (key.equals("Criteria")) {
|
|
|
|
+ query_json_new.put(key, CriteriaNew);
|
|
|
|
+ } else {
|
|
|
|
+ query_json_new.put(key, query_json.get(key));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String result = RestUtil.query(JSONObject.toJSONString(query_json_new, SerializerFeature.WriteMapNullValue));
|
|
|
|
+ return result;
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ String error = LogUtil.GetExceptionStackTrace(e);
|
|
|
|
+ return error;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
public static String showTree() {
|
|
public static String showTree() {
|
|
RepositoryImpl Repository = RepositoryContainer.instance;
|
|
RepositoryImpl Repository = RepositoryContainer.instance;
|
|
JSONObject JSON = (JSONObject) Repository.objectData.toJSON(-1);
|
|
JSONObject JSON = (JSONObject) Repository.objectData.toJSON(-1);
|