|
@@ -98,11 +98,14 @@ public class ObjectInstanceQueryService extends BaseService {
|
|
|
Iterator<String> stringIterator = object.fieldNames();
|
|
|
while (stringIterator.hasNext()) {
|
|
|
String infoCode = stringIterator.next();
|
|
|
- if (RwdConstants.isBasicColumn(infoCode) || set.contains(infoCode)) {
|
|
|
+ if (RwdConstants.isBasicColumn(infoCode) || set.contains(infoCode) || "$search".equals(infoCode)) {
|
|
|
continue;
|
|
|
}
|
|
|
+
|
|
|
String exp = "json_extract({0}, '$." + infoCode + "')";
|
|
|
JsonNode value = object.get(infoCode);
|
|
|
+
|
|
|
+ // TODO 此处通过入参的值的类型来判断json中字段对应的值的类型,这个方法不妥,应该根据信息点定义的类型来推断
|
|
|
FuncidDataType funcidDataType = parseDataType(value);
|
|
|
if (funcidDataType == FuncidDataType.STRING) {
|
|
|
list.addAll(CriteriaUtils.parse(Expressions.stringTemplate(exp, qt.infos), value));
|
|
@@ -114,6 +117,37 @@ public class ObjectInstanceQueryService extends BaseService {
|
|
|
// 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(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");
|
|
@@ -229,6 +263,17 @@ public class ObjectInstanceQueryService extends BaseService {
|
|
|
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) {
|