|
@@ -70,6 +70,7 @@ type SieveCondition struct {
|
|
|
SearchGroup int `json:"searchGroup"` // 搜索分组:默认0:全部;1:招标采购公告;2:超前项目
|
|
|
SearchMode int `json:"searchMode"` // 搜索模式:0:精准搜索;1:模糊搜索
|
|
|
WordsMode int `json:"wordsMode"` // 搜索关键词模式;默认0:包含所有,1:包含任意
|
|
|
+ District string `json:"district"`
|
|
|
}
|
|
|
|
|
|
const (
|
|
@@ -153,6 +154,17 @@ func getDataExportSql(scd *SieveCondition) string {
|
|
|
areaquery += `]}}`
|
|
|
areaCity = append(areaCity, areaquery)
|
|
|
}
|
|
|
+
|
|
|
+ district := scd.District
|
|
|
+ if district != "" {
|
|
|
+ for _, v := range strings.Split(district, ",") {
|
|
|
+ cityName := strings.Split(v, "_")[0]
|
|
|
+ districtName := strings.Split(v, "_")[1]
|
|
|
+ query_bool_must_and_district := `{"bool":{"must":[{"terms":{"city":["%s"]}},{"terms":{"district":["%s"]}}]}}`
|
|
|
+ areaCity = append(areaCity, fmt.Sprintf(query_bool_must_and_district, cityName, districtName))
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
if len(areaCity) > 0 {
|
|
|
musts = append(musts, fmt.Sprintf(query_bool_should, strings.Join(areaCity, ",")))
|
|
|
}
|
|
@@ -492,6 +504,7 @@ func GetSqlObjFromId(mongo mg.MongodbSim, _id string) *SieveCondition {
|
|
|
SearchGroup: qutil.IntAll((*query)["searchGroup"]), //搜索分组:默认0:全部;1:招标采购公告;2:超前项目
|
|
|
SearchMode: qutil.IntAll((*query)["searchMode"]), // 搜索模式:0:精准搜索;1:模糊搜索
|
|
|
WordsMode: qutil.IntAll((*query)["wordsMode"]), // 搜索关键词模式;默认0:包含所有,1:包含任意
|
|
|
+ District: qutil.ObjToString((*query)["publishtime"]),
|
|
|
}
|
|
|
}
|
|
|
|