|
@@ -26,21 +26,22 @@ type ProjectData struct {
|
|
|
|
|
|
type ProjectEntry struct {
|
|
|
ProjectId string `ch:"project_id"`
|
|
|
- projectName string `ch:"project_name"`
|
|
|
+ ProjectName string `ch:"project_name"`
|
|
|
Buyer string `ch:"buyer"`
|
|
|
BuyerId string `ch:"buyer_id"`
|
|
|
Winner []string `ch:"winner"`
|
|
|
+ WinnerId []string `ch:"winner_id"`
|
|
|
Area string `ch:"area"`
|
|
|
- city string `ch:"city"`
|
|
|
+ City string `ch:"city"`
|
|
|
District string `ch:"district"`
|
|
|
ZbTime int64 `ch:"zbtime"`
|
|
|
EndTime int64 `ch:"endtime"`
|
|
|
- IsHandle int `json:"is_handle"`
|
|
|
- IsIgnore int `json:"is_ignore"`
|
|
|
- IsCreate int `json:"is_create"`
|
|
|
- MyConn bool `json:"my_conn"`
|
|
|
- ConnType int `json:"conn_type"`
|
|
|
- HighSuccess bool `json:"high_success"`
|
|
|
+ IsHandle int `json:"IsHandle"`
|
|
|
+ IsIgnore int `json:"IsIgnore"`
|
|
|
+ IsCreate int `json:"IsCreate"`
|
|
|
+ MyConn bool `json:"MyConn"`
|
|
|
+ ConnType int `json:"ConnType"`
|
|
|
+ HighSuccess bool `json:"HighSuccess"`
|
|
|
}
|
|
|
|
|
|
func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasNextPage bool, total int) {
|
|
@@ -57,7 +58,7 @@ func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasN
|
|
|
if req.SaleStatus == 0 {
|
|
|
isSqlPage = true // 是否sql分页
|
|
|
}
|
|
|
- findSql := getQuerySql(req, isSqlPage, buyerArr)
|
|
|
+ countSql, findSql := getQuerySql(req, isSqlPage, buyerArr)
|
|
|
rows, err := T.ClickhouseConn.Query(context.TODO(), findSql)
|
|
|
defer rows.Close()
|
|
|
if err != nil {
|
|
@@ -65,7 +66,7 @@ func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasN
|
|
|
}
|
|
|
for rows.Next() {
|
|
|
project := ProjectEntry{}
|
|
|
- rows.Scan(&project)
|
|
|
+ _ = rows.ScanStruct(&project)
|
|
|
resultList = append(resultList, &project)
|
|
|
}
|
|
|
|
|
@@ -79,14 +80,15 @@ func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasN
|
|
|
resultList = resultList[:pageSize]
|
|
|
}
|
|
|
total = len(resultList)
|
|
|
- if total > pageSize {
|
|
|
- hasNextPage = true
|
|
|
- } else {
|
|
|
- hasNextPage = false
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ _ = T.ClickhouseConn.QueryRow(context.TODO(), countSql).Scan(&total) //sql分页,查询总数
|
|
|
}
|
|
|
-
|
|
|
- moreInfo(req, resultList)
|
|
|
+ if total > pageSize {
|
|
|
+ hasNextPage = true
|
|
|
+ } else {
|
|
|
+ hasNextPage = false
|
|
|
+ }
|
|
|
+ moreInfo(req, resultList) // 补充信息
|
|
|
|
|
|
return
|
|
|
}
|
|
@@ -105,7 +107,7 @@ func preSalesStatus(posid int64) (m1 map[string]interface{}) {
|
|
|
return m1
|
|
|
}
|
|
|
|
|
|
-func getQuerySql(req *types.ProjectListReq, isPage bool, buyerArr []string) (findSql string) {
|
|
|
+func getQuerySql(req *types.ProjectListReq, isPage bool, buyerArr []string) (countSql, findSql string) {
|
|
|
querys := []string{}
|
|
|
// 左侧选中的业主id
|
|
|
if len(buyerArr) > 0 {
|
|
@@ -197,6 +199,7 @@ func getQuerySql(req *types.ProjectListReq, isPage bool, buyerArr []string) (fin
|
|
|
}
|
|
|
querys = append(querys, fmt.Sprintf(" a.property_form in (%s) ", strings.Join(arr, ",")))
|
|
|
}
|
|
|
+ countSql = fmt.Sprintf("select count(1) from %s where %s ", "information.transaction_info", strings.Join(querys, " and "))
|
|
|
findSql = "select a.project_id, a.project_name, a.buyer, a.buyer_id, a.winner, a.winner_id, a.area, a.city, a.district, a.zbtime, a.endtime "
|
|
|
findSql = fmt.Sprintf("%s from %s a where %s ", findSql, "information.transaction_info", strings.Join(querys, " and "))
|
|
|
if isPage {
|
|
@@ -278,7 +281,7 @@ func moreInfo(req *types.ProjectListReq, list []*ProjectEntry) (result []*Projec
|
|
|
|
|
|
// 人脉路径
|
|
|
// 有我的人脉标签时不需要查询人脉路径信息
|
|
|
- if m.MyConn == false {
|
|
|
+ if m.MyConn == false && m.BuyerId != "" {
|
|
|
ConnectionsHandle([]string{m.BuyerId}, req.PositionId, false)
|
|
|
}
|
|
|
}
|