|
@@ -28,27 +28,28 @@ type KeyWord struct {
|
|
|
|
|
|
/*筛选条件*/
|
|
/*筛选条件*/
|
|
type SieveCondition struct {
|
|
type SieveCondition struct {
|
|
- Id string `json:"id"`
|
|
|
|
- PublishTime string `json:"publishtime"` //发布时间
|
|
|
|
- Area []string `json:"area"` //地区-省份
|
|
|
|
- City []string `json:"city"` //地区-城市
|
|
|
|
- Region []string `json:"region"` //地区-省份+城市
|
|
|
|
- Industry []string `json:"industry"` //行业
|
|
|
|
- Keyword []KeyWord `json:"keywords"` //关键词
|
|
|
|
- Buyer []string `json:"buyer"` //招标单位(采购单位)
|
|
|
|
- Buyerclass []string `json:"buyerclass"` //采购单位类型
|
|
|
|
- HasBuyerTel string `json:"hasBuyertel"` //是否有采购单位电话
|
|
|
|
- Winner []string `json:"winner"` //中标单位
|
|
|
|
- HasWinnerTel string `json:"hasWinnertel"` //是否有中标单位电话
|
|
|
|
- ComeInTime int64 `json:"comeintime"` //入库时间(秒)
|
|
|
|
- OpenId string `json:"openid"` //用户openid
|
|
|
|
- MinPrice string `json:"minprice"` //金额——最少
|
|
|
|
- MaxPrice string `json:"maxprice"` //金额——最多
|
|
|
|
- SelectType string `json:"selectType"` //筛选(正文 or 标题)
|
|
|
|
- Subtype string `json:"subtype"` //信息类型
|
|
|
|
- SelectIds []string `json:"selectId"` //选择信息导出
|
|
|
|
- Comeinfrom string `json:"comeinfrom"` //查询来源
|
|
|
|
- FileExists string `json:"fileExists"` //是否有附件
|
|
|
|
|
|
+ Id string `json:"id"`
|
|
|
|
+ PublishTime string `json:"publishtime"` //发布时间
|
|
|
|
+ Area []string `json:"area"` //地区-省份
|
|
|
|
+ City []string `json:"city"` //地区-城市
|
|
|
|
+ Region []string `json:"region"` //地区-省份+城市
|
|
|
|
+ Industry []string `json:"industry"` //行业
|
|
|
|
+ Keyword []KeyWord `json:"keywords"` //关键词
|
|
|
|
+ Buyer []string `json:"buyer"` //招标单位(采购单位)
|
|
|
|
+ Buyerclass []string `json:"buyerclass"` //采购单位类型
|
|
|
|
+ HasBuyerTel string `json:"hasBuyertel"` //是否有采购单位电话
|
|
|
|
+ Winner []string `json:"winner"` //中标单位
|
|
|
|
+ HasWinnerTel string `json:"hasWinnertel"` //是否有中标单位电话
|
|
|
|
+ ComeInTime int64 `json:"comeintime"` //入库时间(秒)
|
|
|
|
+ OpenId string `json:"openid"` //用户openid
|
|
|
|
+ MinPrice string `json:"minprice"` //金额——最少
|
|
|
|
+ MaxPrice string `json:"maxprice"` //金额——最多
|
|
|
|
+ SelectType string `json:"selectType"` //筛选(正文 or 标题)
|
|
|
|
+ Subtype string `json:"subtype"` //信息类型
|
|
|
|
+ SelectIds []string `json:"selectId"` //选择信息导出
|
|
|
|
+ Comeinfrom string `json:"comeinfrom"` //查询来源
|
|
|
|
+ FileExists string `json:"fileExists"` //是否有附件
|
|
|
|
+ SearchTypeSwitch bool `json:"searchTypeSwitch"` //是否开启 正文 标题同时搜索只搜正文的开关
|
|
}
|
|
}
|
|
|
|
|
|
const (
|
|
const (
|
|
@@ -77,6 +78,11 @@ func DetailFileORTitle(findfields string) bool {
|
|
return (strings.Contains(findfields, "detail") || strings.Contains(findfields, "filetext")) && !strings.Contains(findfields, "title")
|
|
return (strings.Contains(findfields, "detail") || strings.Contains(findfields, "filetext")) && !strings.Contains(findfields, "title")
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//包含正文包含标题
|
|
|
|
+func DetailANDTitle(findfields string) bool {
|
|
|
|
+ return strings.Contains(findfields, "detail") && strings.Contains(findfields, "title")
|
|
|
|
+}
|
|
|
|
+
|
|
//获取数据导出查询语句
|
|
//获取数据导出查询语句
|
|
func getDataExportSql(scd *SieveCondition) string {
|
|
func getDataExportSql(scd *SieveCondition) string {
|
|
if len(scd.SelectIds) > 0 {
|
|
if len(scd.SelectIds) > 0 {
|
|
@@ -240,6 +246,14 @@ func getDataExportSql(scd *SieveCondition) string {
|
|
} else if scd.SelectType == "all" {
|
|
} else if scd.SelectType == "all" {
|
|
queryItem = "detail\", \"title"
|
|
queryItem = "detail\", \"title"
|
|
} else {
|
|
} else {
|
|
|
|
+ if scd.SearchTypeSwitch && DetailANDTitle(scd.SelectType) {
|
|
|
|
+ if strings.Contains(scd.SelectType, "title,") {
|
|
|
|
+ scd.SelectType = strings.Replace(scd.SelectType, "title,", "", -1)
|
|
|
|
+ } else if strings.Contains(scd.SelectType, ",title") {
|
|
|
|
+ scd.SelectType = strings.Replace(scd.SelectType, ",title", "", -1)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
queryItem = strings.ReplaceAll(scd.SelectType, ",", "\",\"")
|
|
queryItem = strings.ReplaceAll(scd.SelectType, ",", "\",\"")
|
|
}
|
|
}
|
|
multi_match_new := fmt.Sprintf(multi_match, "%s", "\""+queryItem+"\"")
|
|
multi_match_new := fmt.Sprintf(multi_match, "%s", "\""+queryItem+"\"")
|
|
@@ -364,26 +378,28 @@ func GetSqlObjFromId(mongo mg.MongodbSim, _id string) *SieveCondition {
|
|
if query, ok = mongo.FindById(ExportTable, _id, nil); !ok {
|
|
if query, ok = mongo.FindById(ExportTable, _id, nil); !ok {
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
+ searchTypeSwitch, _ := (*query)["searchTypeSwitch"].(bool)
|
|
return &SieveCondition{
|
|
return &SieveCondition{
|
|
- Id: _id,
|
|
|
|
- Keyword: getKeyWordArrFromDbResult((*query)["keywords"]),
|
|
|
|
- Industry: getStringArrFromDbResult((*query)["industry"]),
|
|
|
|
- MinPrice: qutil.ObjToString((*query)["minprice"]),
|
|
|
|
- MaxPrice: qutil.ObjToString((*query)["maxprice"]),
|
|
|
|
- Subtype: qutil.ObjToString((*query)["subtype"]),
|
|
|
|
- Area: getStringArrFromDbResult((*query)["area"]),
|
|
|
|
- City: getStringArrFromDbResult((*query)["city"]),
|
|
|
|
- SelectType: qutil.ObjToString((*query)["selectType"]),
|
|
|
|
- PublishTime: qutil.ObjToString((*query)["publishtime"]),
|
|
|
|
- Buyer: getStringArrFromDbResult((*query)["buyer"]),
|
|
|
|
- Buyerclass: getStringArrFromDbResult((*query)["buyerclass"]),
|
|
|
|
- HasBuyerTel: qutil.ObjToString((*query)["hasBuyertel"]),
|
|
|
|
- Winner: getStringArrFromDbResult((*query)["winner"]),
|
|
|
|
- HasWinnerTel: qutil.ObjToString((*query)["hasWinnertel"]),
|
|
|
|
- ComeInTime: qutil.Int64All((*query)["comeintime"]),
|
|
|
|
- Comeinfrom: qutil.ObjToString((*query)["comeinfrom"]),
|
|
|
|
- SelectIds: getStringArrFromDbResult((*query)["selectIds"]),
|
|
|
|
- FileExists: qutil.ObjToString((*query)["fileExists"]),
|
|
|
|
|
|
+ Id: _id,
|
|
|
|
+ Keyword: getKeyWordArrFromDbResult((*query)["keywords"]),
|
|
|
|
+ Industry: getStringArrFromDbResult((*query)["industry"]),
|
|
|
|
+ MinPrice: qutil.ObjToString((*query)["minprice"]),
|
|
|
|
+ MaxPrice: qutil.ObjToString((*query)["maxprice"]),
|
|
|
|
+ Subtype: qutil.ObjToString((*query)["subtype"]),
|
|
|
|
+ Area: getStringArrFromDbResult((*query)["area"]),
|
|
|
|
+ City: getStringArrFromDbResult((*query)["city"]),
|
|
|
|
+ SelectType: qutil.ObjToString((*query)["selectType"]),
|
|
|
|
+ PublishTime: qutil.ObjToString((*query)["publishtime"]),
|
|
|
|
+ Buyer: getStringArrFromDbResult((*query)["buyer"]),
|
|
|
|
+ Buyerclass: getStringArrFromDbResult((*query)["buyerclass"]),
|
|
|
|
+ HasBuyerTel: qutil.ObjToString((*query)["hasBuyertel"]),
|
|
|
|
+ Winner: getStringArrFromDbResult((*query)["winner"]),
|
|
|
|
+ HasWinnerTel: qutil.ObjToString((*query)["hasWinnertel"]),
|
|
|
|
+ ComeInTime: qutil.Int64All((*query)["comeintime"]),
|
|
|
|
+ Comeinfrom: qutil.ObjToString((*query)["comeinfrom"]),
|
|
|
|
+ SelectIds: getStringArrFromDbResult((*query)["selectIds"]),
|
|
|
|
+ FileExists: qutil.ObjToString((*query)["fileExists"]),
|
|
|
|
+ SearchTypeSwitch: searchTypeSwitch,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|