소스 검색

Merge branch 'dev/v1.1.26_fuwencai' of BaseService/jyMicroservices into feature/v1.1.26

fuwencai 2 년 전
부모
커밋
eab3b68209
1개의 변경된 파일9개의 추가작업 그리고 4개의 파일을 삭제
  1. 9 4
      jyBXBuyer/rpc/model/buyerListBYEs.go

+ 9 - 4
jyBXBuyer/rpc/model/buyerListBYEs.go

@@ -37,10 +37,10 @@ type supplyDataStruct struct {
 
 // 获取采购单位查询query
 func BuyerListQuery(in *bxbuyer.BuyerListReq) (qstr string, CountQstr string) {
-	query := `{%s "query":{"bool":{"must":[%s],"must_not": [{"term": {"buyer_name": ""}}],"should":[%s],"minimum_should_match": %d}},"sort":[{"updatetime":"desc"}]}`
+	query := `{%s "query":{"bool":{"must":[%s],"must_not": [{"term": {"buyer_name": ""}}],"should":[%s],"minimum_should_match": %d}} %s}`
 	//21.1.20  为和画像保持一致  数据组要求 budget 改成 bidamount
 	query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
-
+	sort := ""
 	bools := []string{}
 	musts := []string{}
 	musts_should := []string{}
@@ -59,6 +59,9 @@ func BuyerListQuery(in *bxbuyer.BuyerListReq) (qstr string, CountQstr string) {
 	if in.BuyerName != "" {
 		entNameQuery := fmt.Sprintf(`{"multi_match": {"query": "%s","type": "phrase", "fields": ["name"]}}`, in.BuyerName)
 		musts = append(musts, entNameQuery)
+	} else {
+		sort = `,"sort":[{"updatetime":"desc"}]` // 仅无关键词时再
+
 	}
 	//采购单位类型
 	buyerclass := in.BuyerClass
@@ -80,8 +83,8 @@ func BuyerListQuery(in *bxbuyer.BuyerListReq) (qstr string, CountQstr string) {
 		musts = append(musts, isContactStr)
 	}
 	boolsNum := 0
-	qstr = fmt.Sprintf(query, fmt.Sprintf(`"from":%d,"size": %d,`, (in.PageNum-1)*in.PageSize, in.PageSize), strings.Join(musts, ","), strings.Join(bools, ","), boolsNum)
-	CountQstr = fmt.Sprintf(query, "", strings.Join(musts, ","), strings.Join(bools, ","), boolsNum)
+	qstr = fmt.Sprintf(query, fmt.Sprintf(`"from":%d,"size": %d,`, (in.PageNum-1)*in.PageSize, in.PageSize), strings.Join(musts, ","), strings.Join(bools, ","), boolsNum, sort)
+	CountQstr = fmt.Sprintf(query, "", strings.Join(musts, ","), strings.Join(bools, ","), boolsNum, sort)
 	return
 }
 
@@ -279,6 +282,8 @@ func SupplyFollowInfo(in *bxbuyer.BuyerListReq, buyerNames []string, resp *bxbuy
 				bv.IsReceived = true
 				bv.RecId = isRws[bv.Buyer]
 			}
+		}
+		if in.IsCheckFollow {
 			if isFws[bv.Buyer] {
 				bv.IsFollowed = true
 			}