Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/develop' into develop

lijie 3 anni fa
parent
commit
3b7f273552

+ 16 - 0
src/main/java/com/persagy/proxy/adm/request/AdmQueryCriteria.java

@@ -1,5 +1,6 @@
 package com.persagy.proxy.adm.request;
 
+import cn.hutool.core.util.StrUtil;
 import com.fasterxml.jackson.annotation.JsonAlias;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -46,6 +47,21 @@ public class AdmQueryCriteria {
     private ObjectNode relationTo;
 
     /**
+     * 拼接条件
+     * @param addFilter
+     */
+    public void addFilters(String addFilter) {
+        if(StrUtil.isBlank(addFilter)) {
+            return;
+        }
+        if(StrUtil.isBlank(filters)) {
+            filters = addFilter;
+            return;
+        }
+        filters = filters + " and " + addFilter;
+    }
+
+    /**
      * 设置关系条件
      * @param isFrom 是否查询from结果
      * @param graphCode

+ 5 - 7
src/main/java/com/persagy/proxy/object/controller/AdmISpaceController.java

@@ -1,15 +1,15 @@
 package com.persagy.proxy.object.controller;
 
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
-import com.persagy.proxy.object.model.AdmISpace;
+import com.persagy.dmp.common.utils.JsonHelper;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
-import com.persagy.proxy.object.service.IAdmISpaceService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
+import com.persagy.proxy.object.model.AdmISpace;
+import com.persagy.proxy.object.service.IAdmISpaceService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -105,13 +105,11 @@ public class AdmISpaceController {
      */
     @PostMapping("/query")
     public AdmResponse query(@RequestBody JSONObject param) throws Exception {
-        AdmQueryCriteria request = new AdmQueryCriteria();
+        AdmQueryCriteria request = JsonHelper.toSingleEntity(param, AdmQueryCriteria.class);
         request.setName(AdmISpace.OBJ_TYPE);
-        request.setPageNumber(null==param.getInteger("pageNumber")?1:param.getInteger("pageNumber"));
-        request.setPageSize(null==param.getInteger("pageSize")?1:param.getInteger("pageSize"));
         if (StrUtil.isNotBlank(param.getString("floorId"))){
             String filters = " floorId = '"+param.getString("floorId")+"' ";
-            request.setFilters(filters);
+            request.addFilters(filters);
         }
         AdmResponse admResponse = service.doQuery(AdmContextUtil.toDmpContext(), request, AdmISpace.class);
         admResponse.setMessage(param.getString("floorId"));