|
@@ -698,26 +698,22 @@ func BuyerList(partyA, supplier, heterotophy, intermediary, agency string, posit
|
|
|
func ProjectHandle(buyerArr []string, area, businessStr string, dataMap *map[string]map[string]interface{}, startIndex, PageSize int64, sourceType string) (*map[string]map[string]interface{}, int64) {
|
|
|
projectMap := &map[string]map[string]interface{}{}
|
|
|
count := int64(0)
|
|
|
- sqlStr := "select buyer,buyer_id,groupUniqArray(area) as area,count(1) as ocount,SUM(project_money) as project_money ,MAX(zbtime) as zbtime from transaction_info_all where"
|
|
|
- countSql := "select count(1) as count from (%s) b "
|
|
|
- if len(buyerArr) > 0 {
|
|
|
- buyer, buyerArgs := ConditionHandle(buyerArr)
|
|
|
- sqlStr += fmt.Sprintf(fmt.Sprintf(" buyer_id in (%s)", buyer), buyerArgs...)
|
|
|
- }
|
|
|
+ tscSql := `'` + strings.ReplaceAll(businessStr, ",", `','`) + `'`
|
|
|
+ sqlStr := `select buyer,buyer_id,groupUniqArray(area) as area,count(if(hasAny(topscopeclass,[`
|
|
|
+ sqlStr += tscSql + `])=1 and project_bidstatus>1,1,null)) as ocount,SUM(if(hasAny(topscopeclass,[`
|
|
|
+ sqlStr += tscSql + `])=1 and project_bidstatus>1,project_money,0)) as project_money ,MAX(zbtime) as zbtime from transaction_info_all where`
|
|
|
+ buyer, buyerArgs := ConditionHandle(buyerArr)
|
|
|
+ sqlStr += fmt.Sprintf(fmt.Sprintf(" buyer_id in (%s)", buyer), buyerArgs...)
|
|
|
if len(area) > 0 && area != "" {
|
|
|
areaStr, areaArgs := ConditionHandle(strings.Split(area, ","))
|
|
|
sqlStr += fmt.Sprintf(fmt.Sprintf(" area in (%s)", areaStr), areaArgs...)
|
|
|
}
|
|
|
- if len(businessStr) > 0 {
|
|
|
- business, businessArgs := ConditionHandle(strings.Split(businessStr, ","))
|
|
|
- sqlStr += fmt.Sprintf(fmt.Sprintf(" and hasAny(topscopeclass,[%s])>0", business), businessArgs...)
|
|
|
- }
|
|
|
sqlStr += " and project_bidstatus>1 GROUP by buyer,buyer_id "
|
|
|
if sourceType == "1" {
|
|
|
sqlStr += " HAVING ocount>2 "
|
|
|
}
|
|
|
sqlStr += " order by zbtime desc"
|
|
|
- countSql = fmt.Sprintf(countSql, sqlStr)
|
|
|
+ countSql := fmt.Sprintf("select count(1) as count from (%s) b ", sqlStr)
|
|
|
sqlStr += " limit ?,?"
|
|
|
//总数查询
|
|
|
rows, err1 := ClickhouseConn.Query(context.TODO(), sqlStr, startIndex, PageSize)
|