wangchuanjin 9 mesi fa
parent
commit
554ba8d950
2 ha cambiato i file con 16 aggiunte e 12 eliminazioni
  1. 1 1
      api/internal/service/owner.go
  2. 15 11
      api/internal/service/plistService.go

+ 1 - 1
api/internal/service/owner.go

@@ -727,7 +727,7 @@ func (t *OwnerService) ProjectHandle(buyerArr []string, businessStr string, moni
 		allArgs = append(allArgs, args...)
 	}
 	if len(ors2) > 0 {
-		ors1 = append(ors1, `(buyer_id in (select buyer_id from transaction_info_all where `+strings.Join(ors2, " or ")+`))`)
+		ors1 = append(ors1, `(buyer_id in (select buyer_id from transaction_info_all where (`+strings.Join(ors2, " or ")+`) and buyer_id<>''))`)
 	}
 	ands := []string{}
 	if len(monitorBuyers) > 0 {

+ 15 - 11
api/internal/service/plistService.go

@@ -171,19 +171,23 @@ func getQuerySql(req *types.ProjectListReq, plist []string, businessStr string)
 	}
 	wm := map[string]bool{}
 	winner_ids := []string{}
-	for _, v := range strings.Split(req.Supplier, ",") {
-		if wm[v] {
-			continue
+	if req.Supplier != "" {
+		for _, v := range strings.Split(req.Supplier, ",") {
+			if wm[v] {
+				continue
+			}
+			winner_ids = append(winner_ids, v)
+			wm[v] = true
 		}
-		winner_ids = append(winner_ids, v)
-		wm[v] = true
 	}
-	for _, v := range strings.Split(req.Heterotophy, ",") {
-		if wm[v] {
-			continue
+	if req.Heterotophy != "" {
+		for _, v := range strings.Split(req.Heterotophy, ",") {
+			if wm[v] {
+				continue
+			}
+			winner_ids = append(winner_ids, v)
+			wm[v] = true
 		}
-		winner_ids = append(winner_ids, v)
-		wm[v] = true
 	}
 	ors2 := []string{}
 	if len(winner_ids) > 0 {
@@ -197,7 +201,7 @@ func getQuerySql(req *types.ProjectListReq, plist []string, businessStr string)
 		allArgs = append(allArgs, args...)
 	}
 	if len(ors2) > 0 {
-		ors1 = append(ors1, `(buyer_id in (select buyer_id from transaction_info_all where `+strings.Join(ors2, " or ")+`))`)
+		ors1 = append(ors1, `(buyer_id in (select buyer_id from transaction_info_all where (`+strings.Join(ors2, " or ")+`) and buyer_id<>''))`)
 	}
 	ands := []string{}
 	//业务类型