|
@@ -161,18 +161,19 @@ func getQuerySql(req *types.ProjectListReq, plist []string, businessStr string)
|
|
|
countSql = "select count(1) from information.transaction_info_all a "
|
|
|
findSql = "select b.project_id as project_id,b.project_name as project_name,b.business_type as business_type,b.buyer as buyer,b.buyer_id as buyer_id,b.area as area,b.city as city,b.district as district,b.zbtime as zbtime,b.endtime as endtime,b.project_money as project_money,b.info_id as info_id,b.information_id as information_id,b.info_ids as info_ids from information.transaction_info_all a "
|
|
|
allArgs = []interface{}{}
|
|
|
- ors := []string{}
|
|
|
+ ors1 := []string{}
|
|
|
// 左侧选中的业主id
|
|
|
if req.PartyA != "" {
|
|
|
wh, args := common.WhArgs(strings.Split(req.PartyA, ","))
|
|
|
- ors = append(ors, "a.buyer_id in ("+wh+")")
|
|
|
+ ors1 = append(ors1, "a.buyer_id in ("+wh+")")
|
|
|
allArgs = append(allArgs, args...)
|
|
|
}
|
|
|
if len(plist) > 0 {
|
|
|
wh, args := common.WhArgs(plist)
|
|
|
- ors = append(ors, "a.project_id in ("+wh+")")
|
|
|
+ ors1 = append(ors1, "a.project_id in ("+wh+")")
|
|
|
allArgs = append(allArgs, args...)
|
|
|
}
|
|
|
+ ors2 := []string{}
|
|
|
winner_ids := []string{}
|
|
|
if req.Supplier != "" {
|
|
|
winner_ids = append(winner_ids, strings.Split(req.Supplier, ",")...)
|
|
@@ -182,14 +183,21 @@ func getQuerySql(req *types.ProjectListReq, plist []string, businessStr string)
|
|
|
}
|
|
|
if len(winner_ids) > 0 {
|
|
|
wh, args := common.WhArgs(winner_ids)
|
|
|
- ors = append(ors, "hasAny(a.winner_id,["+wh+"])")
|
|
|
+ ors2 = append(ors2, "hasAny(a.winner_id,["+wh+"])")
|
|
|
allArgs = append(allArgs, args...)
|
|
|
}
|
|
|
if req.Agency != "" {
|
|
|
wh, args := common.WhArgs(strings.Split(req.Agency, ","))
|
|
|
- ors = append(ors, "a.agency_id in ("+wh+")")
|
|
|
+ ors2 = append(ors2, "a.agency_id in ("+wh+")")
|
|
|
allArgs = append(allArgs, args...)
|
|
|
}
|
|
|
+ ors := []string{}
|
|
|
+ if len(ors1) > 0 {
|
|
|
+ ors = append(ors, "("+strings.Join(ors1, " or ")+") and a.project_id=b.project_id")
|
|
|
+ }
|
|
|
+ if len(ors2) > 0 {
|
|
|
+ ors = append(ors, "("+strings.Join(ors2, " or ")+") and a.buyer_id<>'' and a.buyer_id=b.buyer_id")
|
|
|
+ }
|
|
|
querys := []string{}
|
|
|
//业务类型
|
|
|
if businessStr != "" {
|
|
@@ -230,7 +238,7 @@ func getQuerySql(req *types.ProjectListReq, plist []string, businessStr string)
|
|
|
}
|
|
|
}
|
|
|
//过滤掉已中标的招标项目数据
|
|
|
- sqlAppend := "inner join information.transaction_info_all b on((" + strings.Join(ors, " or ") + ") and a.buyer_id<>'' and a.buyer_id=b.buyer_id) where b.project_bidstatus>1 and " + strings.Join(querys, " and ")
|
|
|
+ sqlAppend := "inner join information.transaction_info_all b on(" + strings.Join(ors, " or ") + ") where b.project_bidstatus>1 and " + strings.Join(querys, " and ")
|
|
|
countSql += sqlAppend
|
|
|
findSql += fmt.Sprintf(sqlAppend+" order by b.zbtime desc limit %d,%d", (req.PageNum-1)*req.PageSize, req.PageSize)
|
|
|
return
|