提交 e87b8102 authored 作者: xuyanqi's avatar xuyanqi

搜索返回结构更改

上级 43c2d416
......@@ -15,6 +15,7 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -77,7 +78,7 @@ public class EsUtil_fanshe {
* @Author: dongjili
* @Date:
*/
public static ArrayList<Basebridgealldata> queryBridge(String keyword, String index, String type, int start, int row) throws Exception {
public static Map<String,Object> queryBridge(String keyword, String index, String type, int start, int row) throws Exception {
// 搜索数据
SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(index).setTypes(type).setFrom(start).setSize(row);
//isNotBlank(str) 等价于 str != null && str.length > 0 && str.trim().length> 0(去掉字符串两端的多余的空格的长度)
......@@ -231,7 +232,10 @@ public class EsUtil_fanshe {
}
basebridgealldataList.add(basebridgealldata);
}
return basebridgealldataList;
return new HashMap<String,Object>(){{
put("total",hits.getTotalHits());
put("list",basebridgealldataList);
}};
}
/**
* @Description: termquery()桥梁代码词条查询
......@@ -431,7 +435,7 @@ public class EsUtil_fanshe {
* @Author: dongjili
* @Date:
*/
public static ArrayList<Basehighwayalldata> queryHighWay(String keyword, String index, String type, int start, int row) throws Exception {
public static HashMap<String,Object> queryHighWay(String keyword, String index, String type, int start, int row) throws Exception {
//搜索数据
SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(index).setTypes(type).setFrom(start).setSize(row);
//isNotBlank(str) 等价于 str != null && str.length > 0 && str.trim().length> 0(去掉字符串两端的多余的空格的长度)
......@@ -562,7 +566,10 @@ public class EsUtil_fanshe {
}
basehighwayalldataList.add(basehighwayalldata);
}
return basehighwayalldataList;
return new HashMap<String,Object>(){{
put("total",hits.getTotalHits());
put("list",basehighwayalldataList);
}};
}
/**
* @Description: termquery()路线编号词条查询
......@@ -741,7 +748,7 @@ public class EsUtil_fanshe {
* @Author: dongjili
* @Date: 2019/4/28 0028
*/
public static List<Basetunnelalldata> queryTunnel(String keyword, String index, String type, int start, int row) throws Exception {
public static HashMap<String, Object> queryTunnel(String keyword, String index, String type, int start, int row) throws Exception {
//搜索数据
SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(index).setTypes(type).setFrom(start).setSize(row);
//isNotBlank(str) 等价于 str != null && str.length > 0 && str.trim().length> 0(去掉字符串两端的多余的空格的长度)
......@@ -825,7 +832,10 @@ public class EsUtil_fanshe {
}
basetunnelalldataList.add(basetunnelalldata);
}
return basetunnelalldataList;
return new HashMap<String,Object>(){{
put("total",hits.getTotalHits());
put("list",basetunnelalldataList);
}};
}
/**
* @Description: termquery()隧道代码词条匹配查询
......@@ -955,7 +965,7 @@ public class EsUtil_fanshe {
* @Author: dongjili
* @Date: 2019/4/28 0028
*/
public static ArrayList<BaseRoadToll_String> queryBaseRoadTollString(String keyword, String index, String type, int start, int row) throws Exception {
public static HashMap<String, Object> queryBaseRoadTollString(String keyword, String index, String type, int start, int row) throws Exception {
//搜索数据
SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(index).setTypes(type).setFrom(start).setSize(row);
//isNotBlank(str) 等价于 str != null && str.length > 0 && str.trim().length> 0(去掉字符串两端的多余的空格的长度)
......@@ -1016,7 +1026,10 @@ public class EsUtil_fanshe {
baseRoadTollStrings.add(baseRoadTollString);
}
return baseRoadTollStrings;
return new HashMap<String,Object>(){{
put("total",hits.getTotalHits());
put("list",baseRoadTollStrings);
}};
}
/**
......@@ -1055,7 +1068,7 @@ public class EsUtil_fanshe {
* @Author: dongjili
* @Date: 2019/5/8 0008
*/
public static ArrayList<BaseHighWayService> queryBaseHighWayService(String keyword, String index, String type, int start, int row) throws Exception {
public static HashMap<String, Object> queryBaseHighWayService(String keyword, String index, String type, int start, int row) throws Exception {
//搜索数据
SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(index).setTypes(type).setFrom(start).setSize(row);
//isNotBlank(str) 等价于 str != null && str.length > 0 && str.trim().length> 0(去掉字符串两端的多余的空格的长度)
......@@ -1120,7 +1133,10 @@ public class EsUtil_fanshe {
baseHighWayServices.add(baseHighWayService);
}
return baseHighWayServices;
return new HashMap<String,Object>(){{
put("total",hits.getTotalHits());
put("list",baseHighWayServices);
}};
}
/**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论