Przeglądaj źródła

dmp-rwd/rwd/instance/object/query
这个接口调取对象,如果不传"grouping": 1,默认就是"grouping": 1

fengyanjie 3 lat temu
rodzic
commit
6529a5de30

+ 339 - 335
dmp-rwd/src/main/java/com/persagy/dmp/rwd/service/ObjectInstanceQueryService.java

@@ -31,362 +31,366 @@ import java.util.stream.Collectors;
 @Service
 public class ObjectInstanceQueryService extends BaseService {
 
-	@Autowired
-	private FuncidDefService funcidDefService;
+    @Autowired
+    private FuncidDefService funcidDefService;
 
-	private Set<String> set = new HashSet<>();
+    private Set<String> set = new HashSet<>();
 
-	{
-		set.add("ProjID");
-		set.add("ProjName");
-		set.add("ProjLocalID");
-		set.add("ProjLocalName");
-		set.add("BuildID");
-		set.add("BuildName");
-		set.add("BuildLocalID");
-		set.add("BuildLocalName");
-		set.add("FloorID");
-		set.add("FloorName");
-		set.add("FloorLocalID");
-		set.add("FloorLocalName");
-		set.add("RoomID");
-		set.add("RoomName");
-		set.add("RoomLocalID");
-		set.add("RoomLocalName");
-		set.add("SysID");
-		set.add("SysName");
-		set.add("SysLocalID");
-		set.add("SysLocalName");
-		set.add("EquipID");
-		set.add("EquipName");
-		set.add("EquipLocalID");
-		set.add("EquipLocalName");
-	}
+    {
+        set.add("ProjID");
+        set.add("ProjName");
+        set.add("ProjLocalID");
+        set.add("ProjLocalName");
+        set.add("BuildID");
+        set.add("BuildName");
+        set.add("BuildLocalID");
+        set.add("BuildLocalName");
+        set.add("FloorID");
+        set.add("FloorName");
+        set.add("FloorLocalID");
+        set.add("FloorLocalName");
+        set.add("RoomID");
+        set.add("RoomName");
+        set.add("RoomLocalID");
+        set.add("RoomLocalName");
+        set.add("SysID");
+        set.add("SysName");
+        set.add("SysLocalID");
+        set.add("SysLocalName");
+        set.add("EquipID");
+        set.add("EquipName");
+        set.add("EquipLocalID");
+        set.add("EquipLocalName");
+    }
 
 
-	private List<BooleanExpression> parse(ObjectNode object) {
-		// TODO
-		List<BooleanExpression> list = new LinkedList<>();
-		QObjectInstance qt = QObjectInstance.objectInstance;
+    private List<BooleanExpression> parse(ObjectNode object) {
+        // TODO
+        List<BooleanExpression> list = new LinkedList<>();
+        QObjectInstance qt = QObjectInstance.objectInstance;
 
-		// TODO 兼容以前的命名
-		list.addAll(CriteriaUtils.parse(qt.id, object.get("ProjID")));
-		list.addAll(CriteriaUtils.parse(qt.name, object.get("ProjName")));
-		list.addAll(CriteriaUtils.parse(qt.localId, object.get("ProjLocalID")));
-		list.addAll(CriteriaUtils.parse(qt.localName, object.get("ProjLocalName")));
-		list.addAll(CriteriaUtils.parse(qt.id, object.get("BuildID")));
-		list.addAll(CriteriaUtils.parse(qt.name, object.get("BuildName")));
-		list.addAll(CriteriaUtils.parse(qt.localId, object.get("BuildLocalID")));
-		list.addAll(CriteriaUtils.parse(qt.localName, object.get("BuildLocalName")));
-		list.addAll(CriteriaUtils.parse(qt.id, object.get("FloorID")));
-		list.addAll(CriteriaUtils.parse(qt.name, object.get("FloorName")));
-		list.addAll(CriteriaUtils.parse(qt.localId, object.get("FloorLocalID")));
-		list.addAll(CriteriaUtils.parse(qt.localName, object.get("FloorLocalName")));
-		list.addAll(CriteriaUtils.parse(qt.id, object.get("RoomID")));
-		list.addAll(CriteriaUtils.parse(qt.name, object.get("RoomName")));
-		list.addAll(CriteriaUtils.parse(qt.localId, object.get("RoomLocalID")));
-		list.addAll(CriteriaUtils.parse(qt.localName, object.get("RoomLocalName")));
-		list.addAll(CriteriaUtils.parse(qt.id, object.get("SysID")));
-		list.addAll(CriteriaUtils.parse(qt.name, object.get("SysName")));
-		list.addAll(CriteriaUtils.parse(qt.localId, object.get("SysLocalID")));
-		list.addAll(CriteriaUtils.parse(qt.localName, object.get("SysLocalName")));
-		list.addAll(CriteriaUtils.parse(qt.id, object.get("EquipID")));
-		list.addAll(CriteriaUtils.parse(qt.name, object.get("EquipName")));
-		list.addAll(CriteriaUtils.parse(qt.localId, object.get("EquipLocalID")));
-		list.addAll(CriteriaUtils.parse(qt.localName, object.get("EquipLocalName")));
+        // TODO 兼容以前的命名
+        list.addAll(CriteriaUtils.parse(qt.id, object.get("ProjID")));
+        list.addAll(CriteriaUtils.parse(qt.name, object.get("ProjName")));
+        list.addAll(CriteriaUtils.parse(qt.localId, object.get("ProjLocalID")));
+        list.addAll(CriteriaUtils.parse(qt.localName, object.get("ProjLocalName")));
+        list.addAll(CriteriaUtils.parse(qt.id, object.get("BuildID")));
+        list.addAll(CriteriaUtils.parse(qt.name, object.get("BuildName")));
+        list.addAll(CriteriaUtils.parse(qt.localId, object.get("BuildLocalID")));
+        list.addAll(CriteriaUtils.parse(qt.localName, object.get("BuildLocalName")));
+        list.addAll(CriteriaUtils.parse(qt.id, object.get("FloorID")));
+        list.addAll(CriteriaUtils.parse(qt.name, object.get("FloorName")));
+        list.addAll(CriteriaUtils.parse(qt.localId, object.get("FloorLocalID")));
+        list.addAll(CriteriaUtils.parse(qt.localName, object.get("FloorLocalName")));
+        list.addAll(CriteriaUtils.parse(qt.id, object.get("RoomID")));
+        list.addAll(CriteriaUtils.parse(qt.name, object.get("RoomName")));
+        list.addAll(CriteriaUtils.parse(qt.localId, object.get("RoomLocalID")));
+        list.addAll(CriteriaUtils.parse(qt.localName, object.get("RoomLocalName")));
+        list.addAll(CriteriaUtils.parse(qt.id, object.get("SysID")));
+        list.addAll(CriteriaUtils.parse(qt.name, object.get("SysName")));
+        list.addAll(CriteriaUtils.parse(qt.localId, object.get("SysLocalID")));
+        list.addAll(CriteriaUtils.parse(qt.localName, object.get("SysLocalName")));
+        list.addAll(CriteriaUtils.parse(qt.id, object.get("EquipID")));
+        list.addAll(CriteriaUtils.parse(qt.name, object.get("EquipName")));
+        list.addAll(CriteriaUtils.parse(qt.localId, object.get("EquipLocalID")));
+        list.addAll(CriteriaUtils.parse(qt.localName, object.get("EquipLocalName")));
 
-		Iterator<String> stringIterator = object.fieldNames();
-		while (stringIterator.hasNext()) {
-			String infoCode = stringIterator.next();
-			if (RwdConstants.isBasicColumn(infoCode) || set.contains(infoCode) || "$search".equals(infoCode)) {
-				continue;
-			}
+        Iterator<String> stringIterator = object.fieldNames();
+        while (stringIterator.hasNext()) {
+            String infoCode = stringIterator.next();
+            if (RwdConstants.isBasicColumn(infoCode) || set.contains(infoCode) || "$search".equals(infoCode)) {
+                continue;
+            }
 
-			String exp = "json_extract({0}, '$." + infoCode + "')";
-			JsonNode value = object.get(infoCode);
+            String exp = "json_extract({0}, '$." + infoCode + "')";
+            JsonNode value = object.get(infoCode);
 
-			// TODO 此处通过入参的值的类型来判断json中字段对应的值的类型,这个方法不妥,应该根据信息点定义的类型来推断
-			FuncidDataType funcidDataType = parseDataType(value);
-			if (funcidDataType == FuncidDataType.STRING) {
-				exp = "json_unquote(json_extract({0}, '$." + infoCode + "'))";
-				list.addAll(CriteriaUtils.parse(Expressions.stringTemplate(exp, qt.infos), value));
-			} else if (funcidDataType == FuncidDataType.INTEGER) {
-				exp = "ifnull(json_extract({0}, '$." + infoCode + "'), -9999)";
-				list.addAll(CriteriaUtils.parse(Expressions.numberTemplate(Long.class, exp, qt.infos), value));
-			} else if (funcidDataType == FuncidDataType.DOUBLE) {
-				exp = "ifnull(json_extract({0}, '$." + infoCode + "'), -9999.99)";
-				list.addAll(CriteriaUtils.parse(Expressions.numberTemplate(Double.class, exp, qt.infos), value));
-			} else if (funcidDataType == FuncidDataType.BOOLEAN) {
-				// TODO
-				//list.addAll(CriteriaUtils.parse(Expressions.booleanTemplate(exp, qt.infos), value));
-			}
+            // TODO 此处通过入参的值的类型来判断json中字段对应的值的类型,这个方法不妥,应该根据信息点定义的类型来推断
+            FuncidDataType funcidDataType = parseDataType(value);
+            if (funcidDataType == FuncidDataType.STRING) {
+                exp = "json_unquote(json_extract({0}, '$." + infoCode + "'))";
+                list.addAll(CriteriaUtils.parse(Expressions.stringTemplate(exp, qt.infos), value));
+            } else if (funcidDataType == FuncidDataType.INTEGER) {
+                exp = "ifnull(json_extract({0}, '$." + infoCode + "'), -9999)";
+                list.addAll(CriteriaUtils.parse(Expressions.numberTemplate(Long.class, exp, qt.infos), value));
+            } else if (funcidDataType == FuncidDataType.DOUBLE) {
+                exp = "ifnull(json_extract({0}, '$." + infoCode + "'), -9999.99)";
+                list.addAll(CriteriaUtils.parse(Expressions.numberTemplate(Double.class, exp, qt.infos), value));
+            } else if (funcidDataType == FuncidDataType.BOOLEAN) {
+                // TODO
+                //list.addAll(CriteriaUtils.parse(Expressions.booleanTemplate(exp, qt.infos), value));
+            }
 
-			if (value.isObject()) {
-				ObjectNode valueObject = (ObjectNode) value;
-				if(valueObject.has("$contains")){
-					String containExp = "json_contains({0}, {1}, '$." + infoCode + "')";
-					JsonNode $contains = valueObject.get("$contains");
-					if ($contains.isTextual()) {
-						list.add(Expressions.numberTemplate(Integer.class, containExp,  qt.infos, $contains.asText()).eq(1));
-					} else {
-						list.add(Expressions.numberTemplate(Integer.class, containExp,  qt.infos, $contains.toString()).eq(1));
-					}
-				}
-				if(valueObject.has("$notcontains")){
-					String containExp = "json_contains({0}, {1}, '$." + infoCode + "')";
-					JsonNode $notcontains = valueObject.get("$notcontains");
-					if ($notcontains.isTextual()) {
-						list.add(Expressions.numberTemplate(Integer.class, containExp,  qt.infos, $notcontains.asText()).eq(0));
-					} else {
-						list.add(Expressions.numberTemplate(Integer.class, containExp,  qt.infos, $notcontains.toString()).eq(0));
-					}
-				}
-			}
-		}
+            if (value.isObject()) {
+                ObjectNode valueObject = (ObjectNode) value;
+                if (valueObject.has("$contains")) {
+                    String containExp = "json_contains({0}, {1}, '$." + infoCode + "')";
+                    JsonNode $contains = valueObject.get("$contains");
+                    if ($contains.isTextual()) {
+                        list.add(Expressions.numberTemplate(Integer.class, containExp, qt.infos, $contains.asText()).eq(1));
+                    } else {
+                        list.add(Expressions.numberTemplate(Integer.class, containExp, qt.infos, $contains.toString()).eq(1));
+                    }
+                }
+                if (valueObject.has("$notcontains")) {
+                    String containExp = "json_contains({0}, {1}, '$." + infoCode + "')";
+                    JsonNode $notcontains = valueObject.get("$notcontains");
+                    if ($notcontains.isTextual()) {
+                        list.add(Expressions.numberTemplate(Integer.class, containExp, qt.infos, $notcontains.asText()).eq(0));
+                    } else {
+                        list.add(Expressions.numberTemplate(Integer.class, containExp, qt.infos, $notcontains.toString()).eq(0));
+                    }
+                }
+            }
+        }
 
-		if(object.has("$search")){
-			JsonNode $search = object.get("$search");
-			if ($search.isTextual()) {
-				String target = $search.asText();
-				String exp = "json_search({0}, 'one', {1})";
-				list.add(Expressions.stringTemplate(exp,  qt.infos, target).isNotNull());
-			}
-		}
+        if (object.has("$search")) {
+            JsonNode $search = object.get("$search");
+            if ($search.isTextual()) {
+                String target = $search.asText();
+                String exp = "json_search({0}, 'one', {1})";
+                list.add(Expressions.stringTemplate(exp, qt.infos, target).isNotNull());
+            }
+        }
 
-		JsonNode relationFrom = object.get("relationFrom");
-		QRelationInstance rq = QRelationInstance.relationInstance;
-		if (relationFrom != null && relationFrom.isObject() && relationFrom.size() > 0) {
-			ObjectNode fromNode = (ObjectNode) relationFrom;
-			List<BooleanExpression> relationExps = new LinkedList<>();
-			relationExps.add(rq.projectId.eq(DmpParameterStorage.getProjectId()));
-			relationExps.add(rq.groupCode.eq(DmpParameterStorage.getGroupCode()));
-			relationExps.addAll(CriteriaUtils.parse(rq.graphId, fromNode.get("graphId")));
-			relationExps.addAll(CriteriaUtils.parse(rq.graphCode, fromNode.get("graphCode")));
-			relationExps.addAll(CriteriaUtils.parse(rq.relCode, fromNode.get("relCode")));
-			relationExps.addAll(CriteriaUtils.parse(rq.objTo, fromNode.get("objTo")));
-			List<String> ids = jpaQueryFactory.select(rq.objFrom).from(rq).where(relationExps.toArray(new BooleanExpression[]{})).fetch();
-			if (ids != null && ids.size() > 0) {
-				list.add(qt.id.in(ids));
-			} else {
-				list.add(qt.id.eq("0"));
-			}
-		}
+        JsonNode relationFrom = object.get("relationFrom");
+        QRelationInstance rq = QRelationInstance.relationInstance;
+        if (relationFrom != null && relationFrom.isObject() && relationFrom.size() > 0) {
+            ObjectNode fromNode = (ObjectNode) relationFrom;
+            List<BooleanExpression> relationExps = new LinkedList<>();
+            relationExps.add(rq.projectId.eq(DmpParameterStorage.getProjectId()));
+            relationExps.add(rq.groupCode.eq(DmpParameterStorage.getGroupCode()));
+            relationExps.addAll(CriteriaUtils.parse(rq.graphId, fromNode.get("graphId")));
+            relationExps.addAll(CriteriaUtils.parse(rq.graphCode, fromNode.get("graphCode")));
+            relationExps.addAll(CriteriaUtils.parse(rq.relCode, fromNode.get("relCode")));
+            relationExps.addAll(CriteriaUtils.parse(rq.objTo, fromNode.get("objTo")));
+            List<String> ids = jpaQueryFactory.select(rq.objFrom).from(rq).where(relationExps.toArray(new BooleanExpression[]{})).fetch();
+            if (ids != null && ids.size() > 0) {
+                list.add(qt.id.in(ids));
+            } else {
+                list.add(qt.id.eq("0"));
+            }
+        }
 
-		JsonNode relationTo = object.get("relationTo");
-		if (relationTo != null && relationTo.isObject() && relationTo.size() > 0) {
-			ObjectNode toNode = (ObjectNode) relationTo;
-			List<BooleanExpression> relationExps = new LinkedList<>();
-			relationExps.add(rq.projectId.eq(DmpParameterStorage.getProjectId()));
-			relationExps.add(rq.groupCode.eq(DmpParameterStorage.getGroupCode()));
-			relationExps.addAll(CriteriaUtils.parse(rq.graphId, toNode.get("graphId")));
-			relationExps.addAll(CriteriaUtils.parse(rq.graphCode, toNode.get("graphCode")));
-			relationExps.addAll(CriteriaUtils.parse(rq.relCode, toNode.get("relCode")));
-			relationExps.addAll(CriteriaUtils.parse(rq.objFrom, toNode.get("objFrom")));
-			List<String> ids = jpaQueryFactory.select(rq.objTo).from(rq).where(relationExps.toArray(new BooleanExpression[]{})).fetch();
-			if (ids != null && ids.size() > 0) {
-				list.add(qt.id.in(ids));
-			} else {
-				list.add(qt.id.eq("0"));
-			}
-		}
-		return list;
-	}
+        JsonNode relationTo = object.get("relationTo");
+        if (relationTo != null && relationTo.isObject() && relationTo.size() > 0) {
+            ObjectNode toNode = (ObjectNode) relationTo;
+            List<BooleanExpression> relationExps = new LinkedList<>();
+            relationExps.add(rq.projectId.eq(DmpParameterStorage.getProjectId()));
+            relationExps.add(rq.groupCode.eq(DmpParameterStorage.getGroupCode()));
+            relationExps.addAll(CriteriaUtils.parse(rq.graphId, toNode.get("graphId")));
+            relationExps.addAll(CriteriaUtils.parse(rq.graphCode, toNode.get("graphCode")));
+            relationExps.addAll(CriteriaUtils.parse(rq.relCode, toNode.get("relCode")));
+            relationExps.addAll(CriteriaUtils.parse(rq.objFrom, toNode.get("objFrom")));
+            List<String> ids = jpaQueryFactory.select(rq.objTo).from(rq).where(relationExps.toArray(new BooleanExpression[]{})).fetch();
+            if (ids != null && ids.size() > 0) {
+                list.add(qt.id.in(ids));
+            } else {
+                list.add(qt.id.eq("0"));
+            }
+        }
+        return list;
+    }
 
-	private void prepareCriteria(JacksonCriteria criteria) {
-		ObjectNode objectNode = criteria.getCriteria();
+    private void prepareCriteria(JacksonCriteria criteria) {
+        ObjectNode objectNode = criteria.getCriteria();
 
-		if (objectNode.has(RwdConstants.OBJECT_CLASSCODE)) {
-			JsonNode classCodeNode = objectNode.get(RwdConstants.OBJECT_CLASSCODE);
-			if (classCodeNode.isArray()) {
-				List<String> list1 = new LinkedList<>();
-				List<String> list2 = new LinkedList<>();
-				for (JsonNode jsonNode : classCodeNode) {
-					String str = jsonNode.asText();
-					if (str.indexOf("&") == -1) {
-						list1.add(str);
-					} else {
-						list2.add(str);
-					}
-				}
+        if (objectNode.has(RwdConstants.OBJECT_CLASSCODE)) {
+            JsonNode classCodeNode = objectNode.get(RwdConstants.OBJECT_CLASSCODE);
+            if (classCodeNode.isArray()) {
+                List<String> list1 = new LinkedList<>();
+                List<String> list2 = new LinkedList<>();
+                for (JsonNode jsonNode : classCodeNode) {
+                    String str = jsonNode.asText();
+                    if (str.indexOf("&") == -1) {
+                        list1.add(str);
+                    } else {
+                        list2.add(str);
+                    }
+                }
 
-				if (list2.size() == 0) {
-					// 不用拆分
-				} else {
-					if (list1.size() == 0 && list2.size() == 1) {
-						// 数组长度为1且需要拆分
-						String code = list2.get(0);
-						String[] split = code.split("&");
-						criteria.add(RwdConstants.OBJECT_CLASSCODE, split[0]);
-						for (int i = 1; i < split.length; i++) {
-							String s = split[i];
-							int idx = s.indexOf("=");
-							if (idx > -1) {
-								criteria.add(s.substring(0, idx), s.substring(idx + 1));
-							}
-						}
-					} else {
-						// 数组长度大于1
-						ArrayNode $or = criteria.getCriteria().putArray("$or");
-						if (list1.size() > 0) {
-							ObjectNode param = $or.addObject();
-							param.putPOJO(RwdConstants.OBJECT_CLASSCODE, list1);
-						}
-						for (String code : list2) {
-							ObjectNode param = $or.addObject();
-							String[] split = code.split("&");
-							param.put(RwdConstants.OBJECT_CLASSCODE, split[0]);
-							for (int i = 1; i < split.length; i++) {
-								String s = split[i];
-								int idx = s.indexOf("=");
-								if (idx > -1) {
-									param.put(s.substring(0, idx), s.substring(idx + 1));
-								}
-							}
-						}
-						criteria.getCriteria().remove(RwdConstants.OBJECT_CLASSCODE);
-					}
-				}
-			} else {
-				String code = classCodeNode.asText();
-				String[] split = code.split("&");
-				criteria.add(RwdConstants.OBJECT_CLASSCODE, split[0]);
+                if (list2.size() == 0) {
+                    // 不用拆分
+                } else {
+                    if (list1.size() == 0 && list2.size() == 1) {
+                        // 数组长度为1且需要拆分
+                        String code = list2.get(0);
+                        String[] split = code.split("&");
+                        criteria.add(RwdConstants.OBJECT_CLASSCODE, split[0]);
+                        for (int i = 1; i < split.length; i++) {
+                            String s = split[i];
+                            int idx = s.indexOf("=");
+                            if (idx > -1) {
+                                criteria.add(s.substring(0, idx), s.substring(idx + 1));
+                            }
+                        }
+                    } else {
+                        // 数组长度大于1
+                        ArrayNode $or = criteria.getCriteria().putArray("$or");
+                        if (list1.size() > 0) {
+                            ObjectNode param = $or.addObject();
+                            param.putPOJO(RwdConstants.OBJECT_CLASSCODE, list1);
+                        }
+                        for (String code : list2) {
+                            ObjectNode param = $or.addObject();
+                            String[] split = code.split("&");
+                            param.put(RwdConstants.OBJECT_CLASSCODE, split[0]);
+                            for (int i = 1; i < split.length; i++) {
+                                String s = split[i];
+                                int idx = s.indexOf("=");
+                                if (idx > -1) {
+                                    param.put(s.substring(0, idx), s.substring(idx + 1));
+                                }
+                            }
+                        }
+                        criteria.getCriteria().remove(RwdConstants.OBJECT_CLASSCODE);
+                    }
+                }
+            } else {
+                String code = classCodeNode.asText();
+                String[] split = code.split("&");
+                criteria.add(RwdConstants.OBJECT_CLASSCODE, split[0]);
 
-				for (int i = 1; i < split.length; i++) {
-					String s = split[i];
-					int idx = s.indexOf("=");
-					if (idx > -1) {
-						criteria.add(s.substring(0, idx), s.substring(idx + 1));
-					}
-				}
-			}
-		}
-	}
+                for (int i = 1; i < split.length; i++) {
+                    String s = split[i];
+                    int idx = s.indexOf("=");
+                    if (idx > -1) {
+                        criteria.add(s.substring(0, idx), s.substring(idx + 1));
+                    }
+                }
+            }
+        }
+    }
 
-	private FuncidDataType parseDataType(JsonNode value) {
-		if (value == null) {
-			return null;
-		}
-		if (value.isObject()) {
-			ObjectNode obj = (ObjectNode) value;
-			if(obj.has("$like")){
-				return FuncidDataType.STRING;
-			}
-			for (String key : Arrays.asList("$gt", "$lt", "$gte", "$lte", "$ne")) {
-				if (obj.has(key)) {
-					return parseDataType(obj.get(key));
-				}
-			}
-		}
-		if (value.isArray()) {
-			ArrayNode array = (ArrayNode) value;
-			if (array == null || array.size() == 0) {
-				return null;
-			}
-			return parseDataType(array.get(0));
-		} else if (value.isNull()) {
-			return null;
-		} else if (value.isTextual()) {
-			return FuncidDataType.STRING;
-		} else if (value.isDouble() || value.isFloat() || value.isBigDecimal()) {
-			return FuncidDataType.DOUBLE;
-		} else if (value.isInt() || value.isLong() || value.isShort() || value.isBigInteger()) {
-			return FuncidDataType.INTEGER;
-		} else if (value.isBoolean()) {
-			return FuncidDataType.BOOLEAN;
-		} else if (value.isPojo()) {
-			return FuncidDataType.STRING; // TODO
-		}
-		return null;
-	}
+    private FuncidDataType parseDataType(JsonNode value) {
+        if (value == null) {
+            return null;
+        }
+        if (value.isObject()) {
+            ObjectNode obj = (ObjectNode) value;
+            if (obj.has("$like")) {
+                return FuncidDataType.STRING;
+            }
+            for (String key : Arrays.asList("$gt", "$lt", "$gte", "$lte", "$ne")) {
+                if (obj.has(key)) {
+                    return parseDataType(obj.get(key));
+                }
+            }
+        }
+        if (value.isArray()) {
+            ArrayNode array = (ArrayNode) value;
+            if (array == null || array.size() == 0) {
+                return null;
+            }
+            return parseDataType(array.get(0));
+        } else if (value.isNull()) {
+            return null;
+        } else if (value.isTextual()) {
+            return FuncidDataType.STRING;
+        } else if (value.isDouble() || value.isFloat() || value.isBigDecimal()) {
+            return FuncidDataType.DOUBLE;
+        } else if (value.isInt() || value.isLong() || value.isShort() || value.isBigInteger()) {
+            return FuncidDataType.INTEGER;
+        } else if (value.isBoolean()) {
+            return FuncidDataType.BOOLEAN;
+        } else if (value.isPojo()) {
+            return FuncidDataType.STRING; // TODO
+        }
+        return null;
+    }
 
-	public PagedResponse<ObjectNode> query(JacksonCriteria criteria) {
-		PagedResponse<ObjectNode> result = new PagedResponse<>();
-		super.checkParam(result, RwdConstants.QUERY_GROUPCODE, RwdConstants.QUERY_PROJECTID);
-		if (!result.success()) {
-			return result;
-		}
-		criteria.add(RwdConstants.OBJECT_GROUPCODE, DmpParameterStorage.getGroupCode());
-		criteria.add(RwdConstants.OBJECT_PROJECTID, DmpParameterStorage.getProjectId());
-		prepareCriteria(criteria);
-		PagedResponse<ObjectInstance> resp = criteriaUtils.query(QObjectInstance.objectInstance, this::parse, criteria);
-		result.setCount(resp.getCount());
-		List<ObjectInstance> dataList = resp.getData();
-		Map<String, List<String>> infoCodes = new HashMap<>();
-		if (dataList != null && dataList.size() > 0) {
-			List<ObjectNode> collect = dataList.stream().map(entity -> {
-				ObjectNode model = JsonNodeFactory.instance.objectNode();
-				model.put(RwdConstants.OBJECT_ID, entity.getId());
-				model.put(RwdConstants.OBJECT_CLASSCODE, entity.getClassCode());
-				model.put(RwdConstants.OBJECT_PROJECTID, entity.getProjectId());
-				model.put(RwdConstants.OBJECT_GROUPING, entity.getGrouping());
-				model.put(RwdConstants.OBJECT_OBJTYPE, entity.getObjType());
-				model.put(RwdConstants.OBJECT_VALID, entity.getValid());
-				if (entity.getName() != null) {
-					model.put(RwdConstants.OBJECT_NAME, entity.getName());
-				}
-				if (entity.getLocalId() != null) {
-					model.put(RwdConstants.OBJECT_LOCALID, entity.getLocalId());
-				}
-				if (entity.getLocalName() != null) {
-					model.put(RwdConstants.OBJECT_LOCALNAME, entity.getLocalName());
-				}
-				if (entity.getCreateUser() != null) {
-					model.put(RwdConstants.OBJECT_CREATE_USER, entity.getCreateUser());
-				}
-				if (entity.getCreateTime() != null) {
-					model.putPOJO(RwdConstants.OBJECT_CREATE_TIME, entity.getCreateTime());
-				}
-				if (entity.getCreateApp() != null) {
-					model.put(RwdConstants.OBJECT_CREATE_APP, entity.getCreateApp());
-				}
-				if (entity.getUpdateUser() != null) {
-					model.put(RwdConstants.OBJECT_UPDATE_USER, entity.getUpdateUser());
-				}
-				if (entity.getUpdateTime() != null) {
-					model.putPOJO(RwdConstants.OBJECT_UPDATE_TIME, entity.getUpdateTime());
-				}
-				if (entity.getUpdateApp() != null) {
-					model.put(RwdConstants.OBJECT_UPDATE_APP, entity.getUpdateApp());
-				}
-				if (entity.getVirtualInfoCodes() != null || entity.getVirtualInfoCodes().size() == 0) {
-					model.putPOJO(RwdConstants.OBJECT_VIRTUAL_INFO_CODES, entity.getVirtualInfoCodes());
-				}
+    public PagedResponse<ObjectNode> query(JacksonCriteria criteria) {
+        PagedResponse<ObjectNode> result = new PagedResponse<>();
+        Integer grouping = criteria.getInteger("grouping");
+        if (grouping == null) {
+            criteria.add("grouping", 1);
+        }
+        super.checkParam(result, RwdConstants.QUERY_GROUPCODE, RwdConstants.QUERY_PROJECTID);
+        if (!result.success()) {
+            return result;
+        }
+        criteria.add(RwdConstants.OBJECT_GROUPCODE, DmpParameterStorage.getGroupCode());
+        criteria.add(RwdConstants.OBJECT_PROJECTID, DmpParameterStorage.getProjectId());
+        prepareCriteria(criteria);
+        PagedResponse<ObjectInstance> resp = criteriaUtils.query(QObjectInstance.objectInstance, this::parse, criteria);
+        result.setCount(resp.getCount());
+        List<ObjectInstance> dataList = resp.getData();
+        Map<String, List<String>> infoCodes = new HashMap<>();
+        if (dataList != null && dataList.size() > 0) {
+            List<ObjectNode> collect = dataList.stream().map(entity -> {
+                ObjectNode model = JsonNodeFactory.instance.objectNode();
+                model.put(RwdConstants.OBJECT_ID, entity.getId());
+                model.put(RwdConstants.OBJECT_CLASSCODE, entity.getClassCode());
+                model.put(RwdConstants.OBJECT_PROJECTID, entity.getProjectId());
+                model.put(RwdConstants.OBJECT_GROUPING, entity.getGrouping());
+                model.put(RwdConstants.OBJECT_OBJTYPE, entity.getObjType());
+                model.put(RwdConstants.OBJECT_VALID, entity.getValid());
+                if (entity.getName() != null) {
+                    model.put(RwdConstants.OBJECT_NAME, entity.getName());
+                }
+                if (entity.getLocalId() != null) {
+                    model.put(RwdConstants.OBJECT_LOCALID, entity.getLocalId());
+                }
+                if (entity.getLocalName() != null) {
+                    model.put(RwdConstants.OBJECT_LOCALNAME, entity.getLocalName());
+                }
+                if (entity.getCreateUser() != null) {
+                    model.put(RwdConstants.OBJECT_CREATE_USER, entity.getCreateUser());
+                }
+                if (entity.getCreateTime() != null) {
+                    model.putPOJO(RwdConstants.OBJECT_CREATE_TIME, entity.getCreateTime());
+                }
+                if (entity.getCreateApp() != null) {
+                    model.put(RwdConstants.OBJECT_CREATE_APP, entity.getCreateApp());
+                }
+                if (entity.getUpdateUser() != null) {
+                    model.put(RwdConstants.OBJECT_UPDATE_USER, entity.getUpdateUser());
+                }
+                if (entity.getUpdateTime() != null) {
+                    model.putPOJO(RwdConstants.OBJECT_UPDATE_TIME, entity.getUpdateTime());
+                }
+                if (entity.getUpdateApp() != null) {
+                    model.put(RwdConstants.OBJECT_UPDATE_APP, entity.getUpdateApp());
+                }
+                if (entity.getVirtualInfoCodes() != null || entity.getVirtualInfoCodes().size() == 0) {
+                    model.putPOJO(RwdConstants.OBJECT_VIRTUAL_INFO_CODES, entity.getVirtualInfoCodes());
+                }
 
 
-				String classCode = entity.getClassCode();
-				Set<String> withColumns = criteria.getWithColumns();
-				if (!infoCodes.containsKey(classCode)) {
-					JacksonCriteria funcidCriteria = JacksonCriteria.newInstance();
-					funcidCriteria.setWithoutCount(true);
-					funcidCriteria.add(RwdConstants.OBJECT_CLASSCODE, classCode);
-					ListResponse<FuncidDefModel> funcidDefModelListResponse = funcidDefService.queryFuncid(DmpParameterStorage.getGroupCode(),
-							DmpParameterStorage.getSchemaId(), DmpParameterStorage.getProjectId(), DmpParameterStorage.getAppId(), funcidCriteria);
+                String classCode = entity.getClassCode();
+                Set<String> withColumns = criteria.getWithColumns();
+                if (!infoCodes.containsKey(classCode)) {
+                    JacksonCriteria funcidCriteria = JacksonCriteria.newInstance();
+                    funcidCriteria.setWithoutCount(true);
+                    funcidCriteria.add(RwdConstants.OBJECT_CLASSCODE, classCode);
+                    ListResponse<FuncidDefModel> funcidDefModelListResponse = funcidDefService.queryFuncid(DmpParameterStorage.getGroupCode(),
+                            DmpParameterStorage.getSchemaId(), DmpParameterStorage.getProjectId(), DmpParameterStorage.getAppId(), funcidCriteria);
 
-					if (funcidDefModelListResponse.getData() == null) {
-						infoCodes.put(classCode, Collections.emptyList());
-					} else {
-						List<String> codes = funcidDefModelListResponse.getData().stream()
-								.map(FuncidDefModel::getCode)
-								.filter(code -> withColumns == null || withColumns.size() == 0 || withColumns.contains(code))
-								.collect(Collectors.toList());
-						infoCodes.put(classCode, codes);
-					}
-				}
-				List<String> codes = infoCodes.get(classCode);
-				ObjectNode infos = entity.getInfos();
-				if (codes.size() > 0 && infos != null) {
-					for (String code : codes) {
-						if (infos.has(code)) {
-							model.put(code, infos.get(code));
-						}
-					}
-				}
-				return model;
-			}).collect(Collectors.toList());
-			result.setData(collect);
-		}
-		return result;
-	}
+                    if (funcidDefModelListResponse.getData() == null) {
+                        infoCodes.put(classCode, Collections.emptyList());
+                    } else {
+                        List<String> codes = funcidDefModelListResponse.getData().stream()
+                                .map(FuncidDefModel::getCode)
+                                .filter(code -> withColumns == null || withColumns.size() == 0 || withColumns.contains(code))
+                                .collect(Collectors.toList());
+                        infoCodes.put(classCode, codes);
+                    }
+                }
+                List<String> codes = infoCodes.get(classCode);
+                ObjectNode infos = entity.getInfos();
+                if (codes.size() > 0 && infos != null) {
+                    for (String code : codes) {
+                        if (infos.has(code)) {
+                            model.put(code, infos.get(code));
+                        }
+                    }
+                }
+                return model;
+            }).collect(Collectors.toList());
+            result.setData(collect);
+        }
+        return result;
+    }
 
 
 }