Browse Source

not id 处理

zhangqiankun 3 years ago
parent
commit
d94f2b8eff

+ 27 - 12
src/main/java/com/persagy/proxy/object/service/impl/AdmSpaceServiceImpl.java

@@ -1,8 +1,19 @@
 package com.persagy.proxy.object.service.impl;
 
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.json.JSONUtil;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -12,7 +23,6 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.common.collect.Sets;
 import com.persagy.dmp.basic.model.QueryCriteria;
-import com.persagy.dmp.common.constant.CommonConstant;
 import com.persagy.dmp.common.context.AppContext;
 import com.persagy.dmp.common.helper.SpringHelper;
 import com.persagy.dmp.common.model.entity.BaseEntity;
@@ -40,13 +50,11 @@ import com.persagy.proxy.object.model.AdmSystem;
 import com.persagy.proxy.object.service.IAdmEquipmentService;
 import com.persagy.proxy.object.service.IAdmSpaceService;
 import com.persagy.proxy.object.service.IAdmSystemService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
 
-import javax.servlet.http.HttpServletRequest;
-import java.util.*;
-import java.util.stream.Collectors;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
+import lombok.extern.slf4j.Slf4j;
 
 /**
  * ADM 空间 实现类
@@ -363,9 +371,17 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
         if (null==criteria){
             return;
         }
+        
+        ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+        if (criteria.has("not id")) {
+    		ObjectNode objectNode = objectMapper.createObjectNode();
+    		objectNode.putPOJO("$not in", criteria.get("not id"));
+    		criteria.putPOJO("id", objectNode);
+    		criteria.remove("not id");
+		}
+        
         if (criteria.has("floorId")){
             // 有建筑id过滤
-            ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
             ObjectNode relationTo = objectMapper.createObjectNode();
             relationTo.put("graphCode", GraphCodeEnum.ArchSubset.name());
             relationTo.put("relCode", RelCodeEnum.Fl2Sp.name());
@@ -378,7 +394,6 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
         }
         if (criteria.has("buildingId")){
             // 有建筑id过滤
-            ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
             ObjectNode relationTo = objectMapper.createObjectNode();
             relationTo.put("graphCode", GraphCodeEnum.ArchSubset.name());
             relationTo.put("relCode", RelCodeEnum.Bd2Sp.name());